cqm-models 3.1.0 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.json +6 -0
- data/.github/workflows/ci.yml +2 -1
- data/README.md +3 -2
- data/app/assets/javascripts/AdverseEvent.js +2 -2
- data/app/assets/javascripts/AllDataElements.js +2 -2
- data/app/assets/javascripts/AllergyIntolerance.js +2 -2
- data/app/assets/javascripts/AssessmentOrder.js +2 -2
- data/app/assets/javascripts/AssessmentPerformed.js +3 -2
- data/app/assets/javascripts/AssessmentRecommended.js +2 -2
- data/app/assets/javascripts/CareGoal.js +2 -2
- data/app/assets/javascripts/CommunicationPerformed.js +3 -3
- data/app/assets/javascripts/DeviceOrder.js +2 -2
- data/app/assets/javascripts/DeviceRecommended.js +2 -2
- data/app/assets/javascripts/Diagnosis.js +2 -2
- data/app/assets/javascripts/DiagnosticStudyOrder.js +2 -2
- data/app/assets/javascripts/DiagnosticStudyPerformed.js +4 -2
- data/app/assets/javascripts/DiagnosticStudyRecommended.js +2 -2
- data/app/assets/javascripts/EncounterOrder.js +2 -2
- data/app/assets/javascripts/EncounterPerformed.js +7 -3
- data/app/assets/javascripts/EncounterRecommended.js +2 -2
- data/app/assets/javascripts/FamilyHistory.js +2 -2
- data/app/assets/javascripts/ImmunizationAdministered.js +2 -2
- data/app/assets/javascripts/ImmunizationOrder.js +2 -2
- data/app/assets/javascripts/InterventionOrder.js +2 -2
- data/app/assets/javascripts/InterventionPerformed.js +3 -2
- data/app/assets/javascripts/InterventionRecommended.js +2 -2
- data/app/assets/javascripts/LaboratoryTestOrder.js +2 -2
- data/app/assets/javascripts/LaboratoryTestPerformed.js +4 -2
- data/app/assets/javascripts/LaboratoryTestRecommended.js +2 -2
- data/app/assets/javascripts/MedicationActive.js +2 -2
- data/app/assets/javascripts/MedicationAdministered.js +2 -2
- data/app/assets/javascripts/MedicationDischarge.js +3 -3
- data/app/assets/javascripts/MedicationDispensed.js +4 -3
- data/app/assets/javascripts/MedicationOrder.js +3 -2
- data/app/assets/javascripts/Participation.js +1 -2
- data/app/assets/javascripts/PatientCareExperience.js +2 -2
- data/app/assets/javascripts/PatientCharacteristic.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicBirthdate.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicEthnicity.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicExpired.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicPayer.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicRace.js +1 -1
- data/app/assets/javascripts/PatientCharacteristicSex.js +1 -1
- data/app/assets/javascripts/PhysicalExamOrder.js +2 -2
- data/app/assets/javascripts/PhysicalExamPerformed.js +3 -2
- data/app/assets/javascripts/PhysicalExamRecommended.js +2 -2
- data/app/assets/javascripts/ProcedureOrder.js +2 -2
- data/app/assets/javascripts/ProcedurePerformed.js +3 -3
- data/app/assets/javascripts/ProcedureRecommended.js +2 -2
- data/app/assets/javascripts/ProviderCareExperience.js +2 -2
- data/app/assets/javascripts/QDMPatient.js +26 -1
- data/app/assets/javascripts/RelatedPerson.js +1 -1
- data/app/assets/javascripts/SubstanceAdministered.js +2 -2
- data/app/assets/javascripts/SubstanceOrder.js +2 -2
- data/app/assets/javascripts/SubstanceRecommended.js +2 -2
- data/app/assets/javascripts/Symptom.js +2 -2
- data/app/assets/javascripts/attributes/Component.js +2 -2
- data/app/assets/javascripts/attributes/DiagnosisComponent.js +1 -1
- data/app/assets/javascripts/attributes/Entity.js +2 -2
- data/app/assets/javascripts/attributes/FacilityLocation.js +1 -1
- data/app/assets/javascripts/attributes/Identifier.js +1 -1
- data/app/assets/javascripts/attributes/Location.js +32 -0
- data/app/assets/javascripts/attributes/Organization.js +1 -1
- data/app/assets/javascripts/basetypes/AnyEntity.js +3 -0
- data/app/assets/javascripts/basetypes/DataElement.js +26 -1
- data/app/models/hqmfOid_to_datatype_map.json +1 -1
- data/app/models/models.rb +2 -2
- data/app/models/qdm/adverse_event.rb +2 -2
- data/app/models/qdm/allergy_intolerance.rb +2 -2
- data/app/models/qdm/assessment_order.rb +2 -2
- data/app/models/qdm/assessment_performed.rb +3 -2
- data/app/models/qdm/assessment_recommended.rb +2 -2
- data/app/models/qdm/attributes/component.rb +1 -1
- data/app/models/qdm/attributes/diagnosis_component.rb +1 -1
- data/app/models/qdm/attributes/entity.rb +1 -1
- data/app/models/qdm/attributes/facility_location.rb +1 -1
- data/app/models/qdm/attributes/identifier.rb +1 -1
- data/app/models/qdm/attributes/location.rb +9 -0
- data/app/models/qdm/attributes/organization.rb +1 -1
- data/app/models/qdm/basetypes/data_element.rb +5 -0
- data/app/models/qdm/care_goal.rb +2 -2
- data/app/models/qdm/communication_performed.rb +3 -3
- data/app/models/qdm/device_order.rb +2 -2
- data/app/models/qdm/device_recommended.rb +2 -2
- data/app/models/qdm/diagnosis.rb +2 -2
- data/app/models/qdm/diagnostic_study_order.rb +2 -2
- data/app/models/qdm/diagnostic_study_performed.rb +4 -2
- data/app/models/qdm/diagnostic_study_recommended.rb +2 -2
- data/app/models/qdm/encounter_order.rb +2 -2
- data/app/models/qdm/encounter_performed.rb +4 -3
- data/app/models/qdm/encounter_recommended.rb +2 -2
- data/app/models/qdm/family_history.rb +2 -2
- data/app/models/qdm/immunization_administered.rb +2 -2
- data/app/models/qdm/immunization_order.rb +2 -2
- data/app/models/qdm/intervention_order.rb +2 -2
- data/app/models/qdm/intervention_performed.rb +3 -2
- data/app/models/qdm/intervention_recommended.rb +2 -2
- data/app/models/qdm/laboratory_test_order.rb +2 -2
- data/app/models/qdm/laboratory_test_performed.rb +4 -2
- data/app/models/qdm/laboratory_test_recommended.rb +2 -2
- data/app/models/qdm/medication_active.rb +2 -2
- data/app/models/qdm/medication_administered.rb +2 -2
- data/app/models/qdm/medication_discharge.rb +3 -3
- data/app/models/qdm/medication_dispensed.rb +4 -3
- data/app/models/qdm/medication_order.rb +3 -2
- data/app/models/qdm/participation.rb +1 -2
- data/app/models/qdm/patient.rb +1 -1
- data/app/models/qdm/patient_care_experience.rb +2 -2
- data/app/models/qdm/patient_characteristic.rb +1 -1
- data/app/models/qdm/patient_characteristic_birthdate.rb +1 -1
- data/app/models/qdm/patient_characteristic_clinical_trial_participant.rb +1 -1
- data/app/models/qdm/patient_characteristic_ethnicity.rb +1 -1
- data/app/models/qdm/patient_characteristic_expired.rb +1 -1
- data/app/models/qdm/patient_characteristic_payer.rb +1 -1
- data/app/models/qdm/patient_characteristic_race.rb +1 -1
- data/app/models/qdm/patient_characteristic_sex.rb +1 -1
- data/app/models/qdm/physical_exam_order.rb +2 -2
- data/app/models/qdm/physical_exam_performed.rb +3 -2
- data/app/models/qdm/physical_exam_recommended.rb +2 -2
- data/app/models/qdm/procedure_order.rb +2 -2
- data/app/models/qdm/procedure_performed.rb +3 -3
- data/app/models/qdm/procedure_recommended.rb +2 -2
- data/app/models/qdm/provider_care_experience.rb +2 -2
- data/app/models/qdm/related_person.rb +1 -1
- data/app/models/qdm/substance_administered.rb +2 -2
- data/app/models/qdm/substance_order.rb +2 -2
- data/app/models/qdm/substance_recommended.rb +2 -2
- data/app/models/qdm/symptom.rb +2 -2
- data/bin/validate_generator.sh +1 -1
- data/cqm-models.gemspec +1 -1
- data/data/oids_qdm_5.6.json +335 -0
- data/dist/browser.js +2200 -1451
- data/dist/index.js +2200 -1451
- data/lib/generate_entities.rb +18 -10
- data/lib/generate_models.rb +27 -19
- data/lib/generate_patients.rb +1 -1
- data/modelinfo/qdm-modelinfo-5.6.xml +1102 -0
- data/package.json +5 -5
- data/templates/models_template.rb.erb +3 -1
- data/templates/mongoose_template.js.erb +9 -2
- data/templates/patient_template.js.erb +25 -0
- data/yarn.lock +699 -682
- metadata +6 -4
- data/app/assets/javascripts/DeviceApplied.js +0 -48
- data/app/models/qdm/device_applied.rb +0 -19
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cqm-models",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.2",
|
4
4
|
"description": "This library contains auto generated Mongo (Mongoose.js) models that correspond to the QDM (Quality Data Model) specification.",
|
5
5
|
"main": "app/assets/javascripts/index.js",
|
6
6
|
"browser": {
|
@@ -16,13 +16,13 @@
|
|
16
16
|
],
|
17
17
|
"license": "Apache-2.0",
|
18
18
|
"dependencies": {
|
19
|
-
"cql-execution": "~2.
|
20
|
-
"mongoose": "^5.
|
19
|
+
"cql-execution": "~2.3.3",
|
20
|
+
"mongoose": "^5.13.12"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
23
|
"browserify": "^16.1.0",
|
24
|
-
"eslint": "^
|
25
|
-
"eslint-config-airbnb-base": "^
|
24
|
+
"eslint": "^7.0.0",
|
25
|
+
"eslint-config-airbnb-base": "^14.2.1",
|
26
26
|
"eslint-plugin-import": "^2.8.0",
|
27
27
|
"istanbul": "^0.4.5",
|
28
28
|
"jasmine": "^2.9.0"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Base QDM module (generated from lib/generate_models.rb) for QDM 5.
|
1
|
+
# Base QDM module (generated from lib/generate_models.rb) for QDM 5.6
|
2
2
|
module QDM
|
3
3
|
end
|
4
4
|
require 'mongoid'
|
@@ -25,6 +25,7 @@ require_relative 'qdm/attributes/diagnosis_component'
|
|
25
25
|
require_relative 'qdm/attributes/organization'
|
26
26
|
require_relative 'qdm/attributes/patient_entity'
|
27
27
|
require_relative 'qdm/attributes/practitioner'
|
28
|
+
require_relative 'qdm/attributes/location'
|
28
29
|
require_relative 'qdm/attributes/result_component'
|
29
30
|
|
30
31
|
# Tacoma-specific models
|
@@ -55,6 +56,7 @@ require_relative '../../lib/generate_patients'
|
|
55
56
|
<%- next if datatype.underscore == 'organization' -%>
|
56
57
|
<%- next if datatype.underscore == 'patient_entity' -%>
|
57
58
|
<%- next if datatype.underscore == 'practitioner' -%>
|
59
|
+
<%- next if datatype.underscore == 'location' -%>
|
58
60
|
<%- next if datatype.underscore == 'result_component' -%>
|
59
61
|
require_relative 'qdm/<%= datatype.underscore %>'
|
60
62
|
<%- end -%>
|
@@ -26,7 +26,7 @@ const QDMDate = require('../basetypes/QDMDate');
|
|
26
26
|
const Any = require('../basetypes/Any');
|
27
27
|
|
28
28
|
const [Schema] = [mongoose.Schema];
|
29
|
-
<% elsif datatype.downcase == 'carepartner' || datatype.downcase == 'organization' || datatype.downcase == 'practitioner' || datatype.downcase == 'patiententity'%>
|
29
|
+
<% elsif datatype.downcase == 'carepartner' || datatype.downcase == 'organization' || datatype.downcase == 'practitioner' || datatype.downcase == 'patiententity' || datatype.downcase == 'location'%>
|
30
30
|
const { EntitySchemaFunction } = require('./Entity');
|
31
31
|
const Code = require('../basetypes/Code');
|
32
32
|
const Interval = require('../basetypes/Interval');
|
@@ -65,7 +65,7 @@ const <%= datatype -%>Schema = ComponentSchemaFunction({
|
|
65
65
|
<% if attribute[:default] %><%= attribute[:name] %>: { type: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>, default: '<%= attribute[:default] %>' },<% else %><%= attribute[:name] %>: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>,<%- end %>
|
66
66
|
<%- end %>
|
67
67
|
});
|
68
|
-
<% elsif datatype.downcase == 'carepartner' || datatype.downcase == 'organization' || datatype.downcase == 'practitioner' || datatype.downcase == 'patiententity'%>
|
68
|
+
<% elsif datatype.downcase == 'carepartner' || datatype.downcase == 'organization' || datatype.downcase == 'practitioner' || datatype.downcase == 'patiententity' || datatype.downcase == 'location'%>
|
69
69
|
const <%= datatype -%>Schema = EntitySchemaFunction({
|
70
70
|
<%- for attribute in attrs_with_extras -%>
|
71
71
|
<% if attribute[:default] %><%= attribute[:name] %>: { type: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>, default: '<%= attribute[:default] %>' },<% else %><%= attribute[:name] %>: <%= TYPE_LOOKUP_JS[attribute[:type]] -%>,<%- end %>
|
@@ -83,6 +83,13 @@ class <%= datatype %> extends mongoose.Document {
|
|
83
83
|
constructor(object) {
|
84
84
|
super(object, <%= datatype %>Schema);
|
85
85
|
this._type = 'QDM::<%= datatype %>';
|
86
|
+
<%- for attribute in attrs_with_extras -%>
|
87
|
+
<%- if RESERVED_WORDS[attribute[:name].to_s] -%>
|
88
|
+
if (object && object.<%= RESERVED_WORDS[attribute[:name].to_s] %>) {
|
89
|
+
this.<%= attribute[:name] %> = object.<%= RESERVED_WORDS[attribute[:name].to_s] %>;
|
90
|
+
}
|
91
|
+
<%- end -%>
|
92
|
+
<%- end -%>
|
86
93
|
}
|
87
94
|
}
|
88
95
|
<% if datatype.downcase == 'entity' || datatype.downcase == 'component'%>
|
@@ -56,6 +56,31 @@ QDMPatientSchema.methods.getByQrdaOid = function getByQrdaOid(qrdaOid) {
|
|
56
56
|
return this.dataElements.filter(element => element.qrdaOid === qrdaOid);
|
57
57
|
};
|
58
58
|
|
59
|
+
// cql-execution prefers getId() over id() because some data models may have an id property
|
60
|
+
QDMPatientSchema.methods.getId = function getId() {
|
61
|
+
return this._id;
|
62
|
+
};
|
63
|
+
|
64
|
+
/* eslint no-underscore-dangle: 0 */
|
65
|
+
QDMPatientSchema.methods._is = function _is(typeSpecifier) {
|
66
|
+
return this._typeHierarchy().some(
|
67
|
+
t => t.type === typeSpecifier.type && t.name === typeSpecifier.name
|
68
|
+
);
|
69
|
+
};
|
70
|
+
|
71
|
+
/* eslint no-underscore-dangle: 0 */
|
72
|
+
QDMPatientSchema.methods._typeHierarchy = function _typeHierarchy() {
|
73
|
+
const ver = this.qdmVersion.replace('.', '_');
|
74
|
+
return [
|
75
|
+
{
|
76
|
+
name: `{urn:healthit-gov:qdm:v${ver}}Patient`,
|
77
|
+
type: 'NamedTypeSpecifier',
|
78
|
+
},
|
79
|
+
{ name: '{urn:hl7-org:elm-types:r1}Tuple', type: 'NamedTypeSpecifier' },
|
80
|
+
{ name: '{urn:hl7-org:elm-types:r1}Any', type: 'NamedTypeSpecifier' },
|
81
|
+
];
|
82
|
+
};
|
83
|
+
|
59
84
|
// Returns an array of elements that exist on this patient. Optionally
|
60
85
|
// takes a qdmCategory, which returns all elements of that QDM qdmCategory.
|
61
86
|
// Example: patient.getDataElements({qdmCategory: 'encounters'}) will return
|