cqm-models 1.1.1.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +1 -1
  3. data/.github/workflows/gitleaks_github_actions.yml +28 -0
  4. data/.travis.yml +3 -3
  5. data/README.md +12 -9
  6. data/app/assets/javascripts/AdverseEvent.js +9 -3
  7. data/app/assets/javascripts/AllDataElements.js +18 -6
  8. data/app/assets/javascripts/AllergyIntolerance.js +8 -2
  9. data/app/assets/javascripts/AssessmentOrder.js +8 -2
  10. data/app/assets/javascripts/AssessmentPerformed.js +11 -3
  11. data/app/assets/javascripts/AssessmentRecommended.js +8 -2
  12. data/app/assets/javascripts/CareGoal.js +10 -3
  13. data/app/assets/javascripts/CommunicationPerformed.js +12 -6
  14. data/app/assets/javascripts/DeviceApplied.js +9 -2
  15. data/app/assets/javascripts/DeviceOrder.js +8 -2
  16. data/app/assets/javascripts/DeviceRecommended.js +8 -2
  17. data/app/assets/javascripts/Diagnosis.js +8 -2
  18. data/app/assets/javascripts/DiagnosticStudyOrder.js +8 -2
  19. data/app/assets/javascripts/DiagnosticStudyPerformed.js +9 -2
  20. data/app/assets/javascripts/DiagnosticStudyRecommended.js +8 -2
  21. data/app/assets/javascripts/EncounterOrder.js +9 -2
  22. data/app/assets/javascripts/EncounterPerformed.js +11 -5
  23. data/app/assets/javascripts/EncounterRecommended.js +8 -2
  24. data/app/assets/javascripts/FamilyHistory.js +8 -2
  25. data/app/assets/javascripts/ImmunizationAdministered.js +9 -2
  26. data/app/assets/javascripts/ImmunizationOrder.js +8 -2
  27. data/app/assets/javascripts/InterventionOrder.js +8 -2
  28. data/app/assets/javascripts/InterventionPerformed.js +9 -2
  29. data/app/assets/javascripts/InterventionRecommended.js +8 -2
  30. data/app/assets/javascripts/LaboratoryTestOrder.js +8 -2
  31. data/app/assets/javascripts/LaboratoryTestPerformed.js +9 -2
  32. data/app/assets/javascripts/LaboratoryTestRecommended.js +8 -2
  33. data/app/assets/javascripts/MedicationActive.js +9 -2
  34. data/app/assets/javascripts/MedicationAdministered.js +9 -2
  35. data/app/assets/javascripts/MedicationDischarge.js +9 -2
  36. data/app/assets/javascripts/MedicationDispensed.js +10 -4
  37. data/app/assets/javascripts/MedicationOrder.js +9 -4
  38. data/app/assets/javascripts/Participation.js +8 -2
  39. data/app/assets/javascripts/PatientCareExperience.js +8 -2
  40. data/app/assets/javascripts/PatientCharacteristic.js +7 -2
  41. data/app/assets/javascripts/PatientCharacteristicBirthdate.js +7 -2
  42. data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +7 -2
  43. data/app/assets/javascripts/PatientCharacteristicEthnicity.js +7 -2
  44. data/app/assets/javascripts/PatientCharacteristicExpired.js +7 -2
  45. data/app/assets/javascripts/PatientCharacteristicPayer.js +7 -2
  46. data/app/assets/javascripts/PatientCharacteristicRace.js +7 -2
  47. data/app/assets/javascripts/PatientCharacteristicSex.js +7 -2
  48. data/app/assets/javascripts/PhysicalExamOrder.js +8 -2
  49. data/app/assets/javascripts/PhysicalExamPerformed.js +9 -2
  50. data/app/assets/javascripts/PhysicalExamRecommended.js +8 -2
  51. data/app/assets/javascripts/ProcedureOrder.js +10 -3
  52. data/app/assets/javascripts/ProcedurePerformed.js +11 -3
  53. data/app/assets/javascripts/ProcedureRecommended.js +9 -3
  54. data/app/assets/javascripts/ProviderCareExperience.js +8 -2
  55. data/app/assets/javascripts/QDMPatient.js +25 -9
  56. data/app/assets/javascripts/RelatedPerson.js +42 -0
  57. data/app/assets/javascripts/SubstanceAdministered.js +9 -2
  58. data/app/assets/javascripts/SubstanceOrder.js +9 -2
  59. data/app/assets/javascripts/SubstanceRecommended.js +8 -2
  60. data/app/assets/javascripts/Symptom.js +8 -2
  61. data/app/assets/javascripts/attributes/CarePartner.js +33 -0
  62. data/app/assets/javascripts/attributes/Component.js +22 -1
  63. data/app/assets/javascripts/attributes/DiagnosisComponent.js +34 -0
  64. data/app/assets/javascripts/attributes/Entity.js +58 -0
  65. data/app/assets/javascripts/attributes/FacilityLocation.js +4 -1
  66. data/app/assets/javascripts/attributes/Identifier.js +23 -0
  67. data/app/assets/javascripts/attributes/Organization.js +33 -0
  68. data/app/assets/javascripts/attributes/PatientEntity.js +32 -0
  69. data/app/assets/javascripts/attributes/Practitioner.js +35 -0
  70. data/app/assets/javascripts/attributes/ResultComponent.js +31 -0
  71. data/app/assets/javascripts/basetypes/Any.js +24 -15
  72. data/app/assets/javascripts/basetypes/AnyEntity.js +44 -0
  73. data/app/assets/javascripts/basetypes/Code.js +8 -12
  74. data/app/assets/javascripts/basetypes/DataElement.js +17 -6
  75. data/app/assets/javascripts/basetypes/Interval.js +10 -8
  76. data/app/assets/javascripts/basetypes/QDMDate.js +36 -0
  77. data/app/assets/javascripts/basetypes/Quantity.js +1 -1
  78. data/app/assets/javascripts/basetypes/Ratio.js +1 -1
  79. data/app/assets/javascripts/cqm/AllCQMModels.js +2 -0
  80. data/app/assets/javascripts/cqm/ClauseResult.js +28 -0
  81. data/app/assets/javascripts/{IndividualResult.js → cqm/IndividualResult.js} +28 -2
  82. data/app/assets/javascripts/cqm/Measure.js +1 -1
  83. data/app/assets/javascripts/cqm/Provider.js +0 -2
  84. data/app/assets/javascripts/cqm/StatementResult.js +41 -0
  85. data/app/assets/javascripts/index.js +6 -2
  86. data/app/models/cqm/clause_result.rb +21 -0
  87. data/app/models/{qdm/tacoma → cqm}/individual_result.rb +24 -3
  88. data/app/models/cqm/measure.rb +2 -0
  89. data/app/models/cqm/patient.rb +1 -0
  90. data/app/models/cqm/provider.rb +4 -4
  91. data/app/models/cqm/statement_result.rb +27 -0
  92. data/app/models/hqmfOid_to_datatype_map.json +5 -1
  93. data/app/models/model_finder.rb +1 -0
  94. data/app/models/models.rb +15 -6
  95. data/app/models/qdm/adverse_event.rb +3 -2
  96. data/app/models/qdm/allergy_intolerance.rb +2 -1
  97. data/app/models/qdm/assessment_order.rb +2 -1
  98. data/app/models/qdm/assessment_performed.rb +5 -2
  99. data/app/models/qdm/assessment_recommended.rb +2 -1
  100. data/app/models/qdm/attributes/attribute.rb +1 -0
  101. data/app/models/qdm/attributes/care_partner.rb +10 -0
  102. data/app/models/qdm/attributes/component.rb +1 -1
  103. data/app/models/qdm/attributes/diagnosis_component.rb +10 -0
  104. data/app/models/qdm/attributes/entity.rb +15 -0
  105. data/app/models/qdm/attributes/facility_location.rb +1 -1
  106. data/app/models/qdm/{id.rb → attributes/identifier.rb} +3 -4
  107. data/app/models/qdm/attributes/organization.rb +10 -0
  108. data/app/models/qdm/attributes/patient_entity.rb +9 -0
  109. data/app/models/qdm/attributes/practitioner.rb +12 -0
  110. data/app/models/qdm/{result_component.rb → attributes/result_component.rb} +1 -3
  111. data/app/models/qdm/basetypes/code.rb +9 -10
  112. data/app/models/qdm/basetypes/data_element.rb +64 -12
  113. data/app/models/qdm/basetypes/date.rb +39 -0
  114. data/app/models/qdm/basetypes/interval.rb +26 -3
  115. data/app/models/qdm/basetypes/quantity.rb +1 -0
  116. data/app/models/qdm/basetypes/ratio.rb +1 -0
  117. data/app/models/qdm/care_goal.rb +4 -2
  118. data/app/models/qdm/communication_performed.rb +6 -5
  119. data/app/models/qdm/device_applied.rb +3 -1
  120. data/app/models/qdm/device_order.rb +2 -1
  121. data/app/models/qdm/device_recommended.rb +2 -1
  122. data/app/models/qdm/diagnosis.rb +2 -1
  123. data/app/models/qdm/diagnostic_study_order.rb +2 -1
  124. data/app/models/qdm/diagnostic_study_performed.rb +3 -1
  125. data/app/models/qdm/diagnostic_study_recommended.rb +2 -1
  126. data/app/models/qdm/encounter_order.rb +3 -1
  127. data/app/models/qdm/encounter_performed.rb +3 -2
  128. data/app/models/qdm/encounter_recommended.rb +2 -1
  129. data/app/models/qdm/family_history.rb +2 -1
  130. data/app/models/qdm/immunization_administered.rb +3 -1
  131. data/app/models/qdm/immunization_order.rb +2 -1
  132. data/app/models/qdm/intervention_order.rb +2 -1
  133. data/app/models/qdm/intervention_performed.rb +3 -1
  134. data/app/models/qdm/intervention_recommended.rb +2 -1
  135. data/app/models/qdm/laboratory_test_order.rb +2 -1
  136. data/app/models/qdm/laboratory_test_performed.rb +3 -1
  137. data/app/models/qdm/laboratory_test_recommended.rb +2 -1
  138. data/app/models/qdm/medication_active.rb +3 -1
  139. data/app/models/qdm/medication_administered.rb +3 -1
  140. data/app/models/qdm/medication_discharge.rb +3 -1
  141. data/app/models/qdm/medication_dispensed.rb +4 -3
  142. data/app/models/qdm/medication_order.rb +3 -3
  143. data/app/models/qdm/participation.rb +2 -1
  144. data/app/models/qdm/patient.rb +2 -2
  145. data/app/models/qdm/patient_care_experience.rb +2 -1
  146. data/app/models/qdm/patient_characteristic.rb +1 -1
  147. data/app/models/qdm/patient_characteristic_birthdate.rb +1 -1
  148. data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +1 -1
  149. data/app/models/qdm/patient_characteristic_ethnicity.rb +1 -1
  150. data/app/models/qdm/patient_characteristic_expired.rb +1 -1
  151. data/app/models/qdm/patient_characteristic_payer.rb +1 -1
  152. data/app/models/qdm/patient_characteristic_race.rb +1 -1
  153. data/app/models/qdm/patient_characteristic_sex.rb +1 -1
  154. data/app/models/qdm/physical_exam_order.rb +2 -1
  155. data/app/models/qdm/physical_exam_performed.rb +3 -1
  156. data/app/models/qdm/physical_exam_recommended.rb +2 -1
  157. data/app/models/qdm/procedure_order.rb +4 -2
  158. data/app/models/qdm/procedure_performed.rb +5 -2
  159. data/app/models/qdm/procedure_recommended.rb +3 -2
  160. data/app/models/qdm/provider_care_experience.rb +2 -1
  161. data/app/models/qdm/related_person.rb +13 -0
  162. data/app/models/qdm/substance_administered.rb +3 -1
  163. data/app/models/qdm/substance_order.rb +3 -1
  164. data/app/models/qdm/substance_recommended.rb +2 -1
  165. data/app/models/qdm/symptom.rb +2 -1
  166. data/bin/validate_generator.sh +1 -1
  167. data/cqm-models.gemspec +5 -5
  168. data/data/oids_qdm_5.5.json +337 -0
  169. data/dist/browser.js +41069 -34668
  170. data/dist/index.js +41068 -34667
  171. data/lib/generate_entities.rb +56 -0
  172. data/lib/generate_models.rb +77 -39
  173. data/lib/generate_patients.rb +20 -14
  174. data/lib/generate_types.rb +54 -14
  175. data/lib/generator_helpers.rb +14 -0
  176. data/modelinfo/qdm-modelinfo-5.5.xml +982 -0
  177. data/package.json +4 -4
  178. data/templates/entity_extension.rb.erb +6 -0
  179. data/templates/identifier_extension.rb.erb +58 -0
  180. data/templates/{id_template.js.erb → identifier_template.js.erb} +6 -5
  181. data/templates/index_template.js.erb +6 -2
  182. data/templates/models_template.rb.erb +22 -5
  183. data/templates/mongoose_template.js.erb +86 -12
  184. data/templates/patient_extension.rb.erb +1 -1
  185. data/templates/patient_template.js.erb +0 -4
  186. data/yarn.lock +525 -391
  187. metadata +46 -21
  188. data/app/assets/javascripts/Id.js +0 -21
  189. data/app/assets/javascripts/ProviderCharacteristic.js +0 -36
  190. data/app/assets/javascripts/ResultComponent.js +0 -33
  191. data/app/models/qdm/provider_characteristic.rb +0 -12
@@ -20,5 +20,9 @@ module.exports.ValueSet = require('./cqm/ValueSet.js').ValueSet;
20
20
  module.exports.ValueSetSchema = require('./cqm/ValueSet.js').ValueSetSchema;
21
21
  module.exports.Concept = require('./cqm/Concept.js').Concept;
22
22
  module.exports.ConceptSchema = require('./cqm/Concept.js').ConceptSchema;
23
- module.exports.IndividualResult = require('./IndividualResult').IndividualResult;
24
- module.exports.IndividualResultSchema = require('./IndividualResult').IndividualResultSchema;
23
+ module.exports.IndividualResult = require('./cqm/IndividualResult.js').IndividualResult;
24
+ module.exports.IndividualResultSchema = require('./cqm/IndividualResult.js').IndividualResultSchema;
25
+ module.exports.ClauseResult = require('./cqm/ClauseResult.js').ClauseResult;
26
+ module.exports.ClauseResultSchema = require('./cqm/ClauseResult.js').ClauseResultSchema;
27
+ module.exports.StatementResult = require('./cqm/StatementResult.js').StatementResult;
28
+ module.exports.StatementResultSchema = require('./cqm/StatementResult.js').StatementResultchema;
@@ -0,0 +1,21 @@
1
+ module CQM
2
+ # ClauseResult is used to store clause result information in IndividualResult
3
+ class ClauseResult
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+
7
+ # Library the clause this result is for is in
8
+ field :library_name, type: String
9
+ # Statment the clause this result is for is in
10
+ field :statement_name, type: String
11
+ # LocalId of the clause this result is for
12
+ field :localId, type: String
13
+ # Final, processed result of raw calculation
14
+ field :final, type: String
15
+ # Raw result of clause calculation
16
+ field :raw
17
+
18
+ # Relations to other model classes
19
+ embedded_in :individual_result
20
+ end
21
+ end
@@ -1,4 +1,4 @@
1
- module QDM
1
+ module CQM
2
2
  # IndividualResult stores the patient-level (population/clause) results for a patient/measure combination
3
3
  class IndividualResult
4
4
  include Mongoid::Document
@@ -20,9 +20,11 @@ module QDM
20
20
  field :MSRPOPLEX, type: Integer
21
21
 
22
22
  # Result Attributes
23
- field :clause_results, type: Hash
23
+ embeds_many :clause_results
24
+ embeds_many :statement_results
24
25
  field :episode_results, type: Hash
25
- field :statement_results, type: Hash
26
+ field :observation_values, type: Array, default: []
27
+ field :population_relevance, type: Hash
26
28
 
27
29
  # This field is for application specific information only. If both Bonnie and
28
30
  # Cypress use a common field, it should be made a field on this model,
@@ -35,5 +37,24 @@ module QDM
35
37
  # Relations to other model classes
36
38
  belongs_to :measure
37
39
  belongs_to :patient
40
+
41
+ # Convert the stored array into a hash between clause and result
42
+ def clause_results_by_clause
43
+ clause_results_hash = {}
44
+ clause_results.each do |result|
45
+ clause_results_hash[result['library_name']] = {} unless clause_results_hash[result['library_name']]
46
+ clause_results_hash[result['library_name']][result['localId']] = result
47
+ end
48
+ return clause_results_hash
49
+ end
50
+
51
+ def statement_results_by_statement
52
+ statement_results_hash = {}
53
+ statement_results.each do |result|
54
+ statement_results_hash[result['library_name']] = {} unless statement_results_hash[result['library_name']]
55
+ statement_results_hash[result['library_name']][result['statement_name']] = result
56
+ end
57
+ return statement_results_hash
58
+ end
38
59
  end
39
60
  end
@@ -73,6 +73,8 @@ module CQM
73
73
  # hence the 'inverse_of: nil')
74
74
  has_and_belongs_to_many :value_sets, inverse_of: nil
75
75
 
76
+ has_many :calculation_results, class_name: 'CQM::IndividualResult'
77
+
76
78
  def all_stratifications
77
79
  population_sets.flat_map(&:stratifications)
78
80
  end
@@ -11,6 +11,7 @@ module CQM
11
11
 
12
12
  has_and_belongs_to_many :providers, class_name: 'CQM::Provider'
13
13
  embeds_one :qdmPatient, class_name: 'QDM::Patient', autobuild: true
14
+ has_many :calculation_results, class_name: 'CQM::IndividualResult'
14
15
 
15
16
  # Include '_type' in any JSON output. This is necessary for deserialization.
16
17
  def to_json(options = nil)
@@ -16,7 +16,7 @@ module CQM
16
16
 
17
17
  embeds_many :addresses
18
18
  embeds_many :telecoms
19
- embeds_many :ids, class_name: 'QDM::Id'
19
+ embeds_many :ids, class_name: 'QDM::Identifier'
20
20
 
21
21
  def npi=(an_npi)
22
22
  cda_id_npi = ids.where(namingSystem: NPI_OID).first
@@ -24,7 +24,7 @@ module CQM
24
24
  cda_id_npi.value = an_npi
25
25
  cda_id_npi.save!
26
26
  else
27
- ids << QDM::Id.new(namingSystem: NPI_OID, value: an_npi)
27
+ ids << QDM::Identifier.new(namingSystem: NPI_OID, value: an_npi)
28
28
  end
29
29
  end
30
30
 
@@ -34,7 +34,7 @@ module CQM
34
34
  end
35
35
 
36
36
  def tin=(a_tin)
37
- ids << QDM::Id.new(namingSystem: TAX_ID_OID, value: a_tin)
37
+ ids << QDM::Identifier.new(namingSystem: TAX_ID_OID, value: a_tin)
38
38
  end
39
39
 
40
40
  def tin
@@ -48,7 +48,7 @@ module CQM
48
48
  cda_id_ccn.value = a_ccn
49
49
  cda_id_ccn.save!
50
50
  else
51
- ids << QDM::Id.new(namingSystem: CCN_OID, value: a_ccn)
51
+ ids << QDM::Identifier.new(namingSystem: CCN_OID, value: a_ccn)
52
52
  end
53
53
  end
54
54
 
@@ -0,0 +1,27 @@
1
+ module CQM
2
+ # StatementResult is used to store statement result information in IndividualResult
3
+ class StatementResult
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+
7
+ # These are the Mongoid equivalent of the Mongoose "enum" attribute for the respective fields.
8
+ # They throw an error if you try to assign a value that's not in the array.
9
+ validates_inclusion_of :relevance, in: %w[NA TRUE FALSE]
10
+
11
+ # Library the clause this result is for is in
12
+ field :library_name, type: String
13
+ # Statment the clause this result is for is in
14
+ field :statement_name, type: String
15
+ # LocalId of the clause this result is for
16
+ field :pretty, type: String
17
+ # Final, processed result of raw calculation
18
+ field :final, type: String
19
+ # Raw result of clause calculation
20
+ field :raw
21
+
22
+ field :relevance, type: String
23
+
24
+ # Relations to other model classes
25
+ embedded_in :individual_result
26
+ end
27
+ end
@@ -1,4 +1,9 @@
1
1
  {
2
+ "2.16.840.1.113883.10.20.28.4.136": "PatientEntity",
3
+ "2.16.840.1.113883.10.20.28.4.134": "CarePartner",
4
+ "2.16.840.1.113883.10.20.28.4.141": "RelatedPerson",
5
+ "2.16.840.1.113883.10.20.28.4.137": "Practitioner",
6
+ "2.16.840.1.113883.10.20.28.4.135": "Organization",
2
7
  "2.16.840.1.113883.10.20.28.4.61": "PhysicalExamOrder",
3
8
  "2.16.840.1.113883.10.20.28.4.130": "Participation",
4
9
  "2.16.840.1.113883.10.20.28.4.55": "PatientCharacteristicSex",
@@ -33,7 +38,6 @@
33
38
  "2.16.840.1.113883.10.20.28.4.28": "EncounterRecommended",
34
39
  "2.16.840.1.113883.10.20.28.4.67": "ProcedurePerformed",
35
40
  "2.16.840.1.113883.10.20.28.4.119": "AllergyIntolerance",
36
- "2.16.840.1.113883.10.20.28.4.71": "ProviderCharacteristic",
37
41
  "22.16.840.1.113883.10.20.28.4.63": "PhysicalExamRecommended",
38
42
  "2.16.840.1.113883.10.20.28.4.54": "PatientCharacteristicBirthdate",
39
43
  "2.16.840.1.113883.10.20.28.4.120": "AdverseEvent",
@@ -6,6 +6,7 @@ module QDM
6
6
  def self.by_hqmf_oid(hqmfOid)
7
7
  datatype = @hqmfOidToDatatypeMap[hqmfOid]
8
8
  return nil if datatype.nil?
9
+
9
10
  return QDM.const_get(datatype)
10
11
  end
11
12
  end
@@ -1,4 +1,4 @@
1
- # Base QDM module (generated from lib/generate_models.rb) for QDM 5.3
1
+ # Base QDM module (generated from lib/generate_models.rb) for QDM 5.5
2
2
  module QDM
3
3
  end
4
4
  require 'mongoid'
@@ -7,17 +7,25 @@ require 'mongoid'
7
7
  require_relative 'model_finder'
8
8
 
9
9
  # Generated models that are dependencies for base types
10
- require_relative 'qdm/id'
10
+ require_relative 'qdm/attributes/attribute'
11
+ require_relative 'qdm/attributes/identifier'
11
12
 
12
13
  # base types
13
14
  require_relative 'qdm/basetypes/code'
14
15
  require_relative 'qdm/basetypes/data_element'
16
+ require_relative 'qdm/basetypes/date'
15
17
  require_relative 'qdm/basetypes/interval'
16
18
  require_relative 'qdm/basetypes/quantity'
17
19
  require_relative 'qdm/basetypes/ratio'
18
- require_relative 'qdm/attributes/attribute'
19
20
  require_relative 'qdm/attributes/facility_location'
20
21
  require_relative 'qdm/attributes/component'
22
+ require_relative 'qdm/attributes/entity'
23
+ require_relative 'qdm/attributes/care_partner'
24
+ require_relative 'qdm/attributes/diagnosis_component'
25
+ require_relative 'qdm/attributes/organization'
26
+ require_relative 'qdm/attributes/patient_entity'
27
+ require_relative 'qdm/attributes/practitioner'
28
+ require_relative 'qdm/attributes/result_component'
21
29
 
22
30
  # Tacoma-specific models
23
31
  require_relative 'cqm/measure'
@@ -29,13 +37,16 @@ require_relative 'cqm/cql_library'
29
37
  require_relative 'cqm/population_set'
30
38
  require_relative 'cqm/patient'
31
39
  require_relative 'cqm/provider'
32
- require_relative 'qdm/tacoma/individual_result'
40
+ require_relative 'cqm/individual_result'
41
+ require_relative 'cqm/statement_result'
42
+ require_relative 'cqm/clause_result'
33
43
 
34
44
  # Make Patient Generation Available
35
45
  require_relative '../../lib/generate_patients'
36
46
 
37
47
  # Generated models
38
48
  require_relative 'qdm/patient'
49
+ require_relative 'qdm/related_person'
39
50
  require_relative 'qdm/physical_exam_order'
40
51
  require_relative 'qdm/participation'
41
52
  require_relative 'qdm/patient_characteristic_sex'
@@ -56,7 +67,6 @@ require_relative 'qdm/device_order'
56
67
  require_relative 'qdm/diagnostic_study_performed'
57
68
  require_relative 'qdm/intervention_order'
58
69
  require_relative 'qdm/family_history'
59
- require_relative 'qdm/result_component'
60
70
  require_relative 'qdm/medication_active'
61
71
  require_relative 'qdm/laboratory_test_order'
62
72
  require_relative 'qdm/diagnostic_study_order'
@@ -71,7 +81,6 @@ require_relative 'qdm/encounter_order'
71
81
  require_relative 'qdm/encounter_recommended'
72
82
  require_relative 'qdm/procedure_performed'
73
83
  require_relative 'qdm/allergy_intolerance'
74
- require_relative 'qdm/provider_characteristic'
75
84
  require_relative 'qdm/physical_exam_recommended'
76
85
  require_relative 'qdm/patient_characteristic_birthdate'
77
86
  require_relative 'qdm/adverse_event'
@@ -4,13 +4,14 @@ module QDM
4
4
  include Mongoid::Document
5
5
  embedded_in :patient
6
6
  field :authorDatetime, type: DateTime
7
- field :relevantPeriod, type: QDM::Interval
7
+ field :relevantDatetime, type: DateTime
8
8
  field :severity, type: QDM::Code
9
9
  field :facilityLocation, type: QDM::FacilityLocation
10
10
  field :type, type: QDM::Code
11
+ embeds_one :recorder, class_name: 'QDM::Entity'
11
12
  field :qdmTitle, type: String, default: 'Adverse Event'
12
13
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.120'
13
14
  field :qdmCategory, type: String, default: 'adverse_event'
14
- field :qdmVersion, type: String, default: '5.4'
15
+ field :qdmVersion, type: String, default: '5.5'
15
16
  end
16
17
  end
@@ -7,10 +7,11 @@ module QDM
7
7
  field :prevalencePeriod, type: QDM::Interval
8
8
  field :type, type: QDM::Code
9
9
  field :severity, type: QDM::Code
10
+ embeds_one :recorder, class_name: 'QDM::Entity'
10
11
  field :qdmTitle, type: String, default: 'Allergy/Intolerance'
11
12
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.119'
12
13
  field :qdmCategory, type: String, default: 'allergy'
13
14
  field :qdmStatus, type: String, default: 'intolerance'
14
- field :qdmVersion, type: String, default: '5.4'
15
+ field :qdmVersion, type: String, default: '5.5'
15
16
  end
16
17
  end
@@ -6,10 +6,11 @@ module QDM
6
6
  field :authorDatetime, type: DateTime
7
7
  field :negationRationale, type: QDM::Code
8
8
  field :reason, type: QDM::Code
9
+ embeds_one :requester, class_name: 'QDM::Entity'
9
10
  field :qdmTitle, type: String, default: 'Assessment, Order'
10
11
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.131'
11
12
  field :qdmCategory, type: String, default: 'assessment'
12
13
  field :qdmStatus, type: String, default: 'order'
13
- field :qdmVersion, type: String, default: '5.4'
14
+ field :qdmVersion, type: String, default: '5.5'
14
15
  end
15
16
  end
@@ -4,16 +4,19 @@ module QDM
4
4
  include Mongoid::Document
5
5
  embedded_in :patient
6
6
  field :authorDatetime, type: DateTime
7
+ field :relevantDatetime, type: DateTime
8
+ field :relevantPeriod, type: QDM::Interval
7
9
  field :negationRationale, type: QDM::Code
8
10
  field :reason, type: QDM::Code
9
11
  field :method, type: QDM::Code
10
12
  field :result
11
13
  field :components, type: Array
12
- embeds_many :relatedTo, class_name: 'QDM::Id'
14
+ field :relatedTo, type: Array
15
+ embeds_one :performer, class_name: 'QDM::Entity'
13
16
  field :qdmTitle, type: String, default: 'Assessment, Performed'
14
17
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.117'
15
18
  field :qdmCategory, type: String, default: 'assessment'
16
19
  field :qdmStatus, type: String, default: 'performed'
17
- field :qdmVersion, type: String, default: '5.4'
20
+ field :qdmVersion, type: String, default: '5.5'
18
21
  end
19
22
  end
@@ -6,10 +6,11 @@ module QDM
6
6
  field :authorDatetime, type: DateTime
7
7
  field :negationRationale, type: QDM::Code
8
8
  field :reason, type: QDM::Code
9
+ embeds_one :requester, class_name: 'QDM::Entity'
9
10
  field :qdmTitle, type: String, default: 'Assessment, Recommended'
10
11
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.118'
11
12
  field :qdmCategory, type: String, default: 'assessment'
12
13
  field :qdmStatus, type: String, default: 'recommended'
13
- field :qdmVersion, type: String, default: '5.4'
14
+ field :qdmVersion, type: String, default: '5.5'
14
15
  end
15
16
  end
@@ -30,6 +30,7 @@ module QDM
30
30
  # this custom class from it.
31
31
  def demongoize(object)
32
32
  return nil unless object
33
+
33
34
  object = object.symbolize_keys
34
35
  if object.is_a?(Hash)
35
36
  # This will turn the object into the concrete type eg: facilityLocation
@@ -0,0 +1,10 @@
1
+ module QDM
2
+ # app/models/qdm/care_partner.rb
3
+ class CarePartner < Entity
4
+ include Mongoid::Document
5
+ embedded_in :data_element
6
+ field :relationship, type: QDM::Code
7
+ field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.134'
8
+ field :qrdaOid, type: String, default: '2.16.840.1.113883.10.20.24.3.160'
9
+ end
10
+ end
@@ -4,6 +4,6 @@ module QDM
4
4
  include Mongoid::Document
5
5
  field :code, type: QDM::Code
6
6
  field :result
7
- field :qdmVersion, type: String, default: '5.4'
7
+ field :qdmVersion, type: String, default: '5.5'
8
8
  end
9
9
  end
@@ -0,0 +1,10 @@
1
+ module QDM
2
+ # app/models/qdm/diagnosis_component.rb
3
+ class DiagnosisComponent < Attribute
4
+ include Mongoid::Document
5
+ field :code, type: QDM::Code
6
+ field :presentOnAdmissionIndicator, type: QDM::Code
7
+ field :rank, type: Integer
8
+ field :qdmVersion, type: String, default: '5.5'
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ module QDM
2
+ # app/models/qdm/entity.rb
3
+ class Entity < Attribute
4
+ include Mongoid::Document
5
+ embedded_in :data_element
6
+ field :id, type: String
7
+ embeds_one :identifier, class_name: 'QDM::Identifier'
8
+ field :qdmVersion, type: String, default: '5.5'
9
+ def initialize(options = {})
10
+ super(options)
11
+ # default id to the mongo ObjectId for this DataElement if it isnt already defined
12
+ self.id = _id.to_s unless id?
13
+ end
14
+ end
15
+ end
@@ -4,6 +4,6 @@ module QDM
4
4
  include Mongoid::Document
5
5
  field :code, type: QDM::Code
6
6
  field :locationPeriod, type: QDM::Interval
7
- field :qdmVersion, type: String, default: '5.4'
7
+ field :qdmVersion, type: String, default: '5.5'
8
8
  end
9
9
  end
@@ -1,10 +1,9 @@
1
1
  module QDM
2
- # app/models/qdm/id.rb
3
- class Id
2
+ # app/models/qdm/identifier.rb
3
+ class Identifier < Attribute
4
4
  include Mongoid::Document
5
- embedded_in :data_element
6
5
  field :namingSystem, type: String
7
6
  field :value, type: String
8
- field :qdmVersion, type: String, default: '5.4'
7
+ field :qdmVersion, type: String, default: '5.5'
9
8
  end
10
9
  end
@@ -0,0 +1,10 @@
1
+ module QDM
2
+ # app/models/qdm/organization.rb
3
+ class Organization < Entity
4
+ include Mongoid::Document
5
+ embedded_in :data_element
6
+ field :type, type: QDM::Code
7
+ field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.135'
8
+ field :qrdaOid, type: String, default: '2.16.840.1.113883.10.20.24.3.163'
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module QDM
2
+ # app/models/qdm/patient_entity.rb
3
+ class PatientEntity < Entity
4
+ include Mongoid::Document
5
+ embedded_in :data_element
6
+ field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.136'
7
+ field :qrdaOid, type: String, default: '2.16.840.1.113883.10.20.24.3.161'
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module QDM
2
+ # app/models/qdm/practitioner.rb
3
+ class Practitioner < Entity
4
+ include Mongoid::Document
5
+ embedded_in :data_element
6
+ field :role, type: QDM::Code
7
+ field :specialty, type: QDM::Code
8
+ field :qualification, type: QDM::Code
9
+ field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.4.137'
10
+ field :qrdaOid, type: String, default: '2.16.840.1.113883.10.20.24.3.162'
11
+ end
12
+ end