cqm-models 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +1 -1
  3. data/app/assets/javascripts/AdverseEvent.js +1 -0
  4. data/app/assets/javascripts/AllergyIntolerance.js +1 -0
  5. data/app/assets/javascripts/AssessmentPerformed.js +2 -1
  6. data/app/assets/javascripts/AssessmentRecommended.js +1 -0
  7. data/app/assets/javascripts/CareGoal.js +2 -1
  8. data/app/assets/javascripts/CommunicationFromPatientToProvider.js +2 -1
  9. data/app/assets/javascripts/CommunicationFromProviderToPatient.js +2 -1
  10. data/app/assets/javascripts/CommunicationFromProviderToProvider.js +2 -1
  11. data/app/assets/javascripts/Component.js +1 -0
  12. data/app/assets/javascripts/DeviceApplied.js +1 -0
  13. data/app/assets/javascripts/DeviceOrder.js +1 -0
  14. data/app/assets/javascripts/DeviceRecommended.js +1 -0
  15. data/app/assets/javascripts/Diagnosis.js +1 -0
  16. data/app/assets/javascripts/DiagnosticStudyOrder.js +1 -0
  17. data/app/assets/javascripts/DiagnosticStudyPerformed.js +1 -0
  18. data/app/assets/javascripts/DiagnosticStudyRecommended.js +1 -0
  19. data/app/assets/javascripts/EncounterOrder.js +1 -0
  20. data/app/assets/javascripts/EncounterPerformed.js +1 -0
  21. data/app/assets/javascripts/EncounterRecommended.js +1 -0
  22. data/app/assets/javascripts/FacilityLocation.js +1 -0
  23. data/app/assets/javascripts/FamilyHistory.js +1 -0
  24. data/app/assets/javascripts/Id.js +2 -10
  25. data/app/assets/javascripts/ImmunizationAdministered.js +1 -0
  26. data/app/assets/javascripts/ImmunizationOrder.js +1 -0
  27. data/app/assets/javascripts/InterventionOrder.js +1 -0
  28. data/app/assets/javascripts/InterventionPerformed.js +1 -0
  29. data/app/assets/javascripts/InterventionRecommended.js +1 -0
  30. data/app/assets/javascripts/LaboratoryTestOrder.js +1 -0
  31. data/app/assets/javascripts/LaboratoryTestPerformed.js +1 -0
  32. data/app/assets/javascripts/LaboratoryTestRecommended.js +1 -0
  33. data/app/assets/javascripts/MedicationActive.js +1 -0
  34. data/app/assets/javascripts/MedicationAdministered.js +1 -0
  35. data/app/assets/javascripts/MedicationDischarge.js +1 -0
  36. data/app/assets/javascripts/MedicationDispensed.js +1 -0
  37. data/app/assets/javascripts/MedicationOrder.js +1 -0
  38. data/app/assets/javascripts/Participation.js +1 -0
  39. data/app/assets/javascripts/Patient.js +4 -8
  40. data/app/assets/javascripts/PatientCareExperience.js +1 -0
  41. data/app/assets/javascripts/PatientCharacteristic.js +1 -0
  42. data/app/assets/javascripts/PatientCharacteristicBirthdate.js +1 -0
  43. data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +1 -0
  44. data/app/assets/javascripts/PatientCharacteristicEthnicity.js +1 -0
  45. data/app/assets/javascripts/PatientCharacteristicExpired.js +1 -0
  46. data/app/assets/javascripts/PatientCharacteristicPayer.js +1 -0
  47. data/app/assets/javascripts/PatientCharacteristicRace.js +1 -0
  48. data/app/assets/javascripts/PatientCharacteristicSex.js +1 -0
  49. data/app/assets/javascripts/PhysicalExamOrder.js +1 -0
  50. data/app/assets/javascripts/PhysicalExamPerformed.js +1 -0
  51. data/app/assets/javascripts/PhysicalExamRecommended.js +1 -0
  52. data/app/assets/javascripts/ProcedureOrder.js +1 -0
  53. data/app/assets/javascripts/ProcedurePerformed.js +1 -0
  54. data/app/assets/javascripts/ProcedureRecommended.js +1 -0
  55. data/app/assets/javascripts/ProviderCareExperience.js +1 -0
  56. data/app/assets/javascripts/ProviderCharacteristic.js +1 -0
  57. data/app/assets/javascripts/Ratio.js +1 -0
  58. data/app/assets/javascripts/ResultComponent.js +1 -0
  59. data/app/assets/javascripts/SubstanceAdministered.js +1 -0
  60. data/app/assets/javascripts/SubstanceOrder.js +1 -0
  61. data/app/assets/javascripts/SubstanceRecommended.js +1 -0
  62. data/app/assets/javascripts/Symptom.js +1 -0
  63. data/app/assets/javascripts/basetypes/Any.js +1 -1
  64. data/app/assets/javascripts/basetypes/DataElement.js +7 -0
  65. data/app/models/models.rb +3 -1
  66. data/app/models/qdm/assessment_performed.rb +1 -1
  67. data/app/models/qdm/basetypes/data_element.rb +8 -5
  68. data/app/models/qdm/care_goal.rb +1 -1
  69. data/app/models/qdm/communication_from_patient_to_provider.rb +1 -1
  70. data/app/models/qdm/communication_from_provider_to_patient.rb +1 -1
  71. data/app/models/qdm/communication_from_provider_to_provider.rb +1 -1
  72. data/app/models/qdm/component.rb +0 -1
  73. data/app/models/qdm/facility_location.rb +0 -1
  74. data/app/models/qdm/id.rb +2 -2
  75. data/cqm-models.gemspec +1 -1
  76. data/dist/index.js +137 -84
  77. data/lib/generate_models.rb +27 -19
  78. data/package.json +1 -1
  79. data/templates/id_template.js.erb +15 -0
  80. data/templates/models_template.rb.erb +4 -0
  81. data/templates/mongoose_template.js.erb +1 -0
  82. data/templates/patient_template.js.erb +4 -8
  83. metadata +4 -3
@@ -6,6 +6,7 @@ const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
7
  const { ComponentSchema } = require('./Component');
8
8
  const { FacilityLocationSchema } = require('./FacilityLocation');
9
+ const { IdSchema } = require('./Id');
9
10
  const Any = require('./basetypes/Any');
10
11
 
11
12
  const [Number, String] = [
@@ -6,6 +6,7 @@ const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
7
  const { ComponentSchema } = require('./Component');
8
8
  const { FacilityLocationSchema } = require('./FacilityLocation');
9
+ const { IdSchema } = require('./Id');
9
10
  const Any = require('./basetypes/Any');
10
11
 
11
12
  const [Number, String] = [
@@ -6,6 +6,7 @@ const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
7
  const { ComponentSchema } = require('./Component');
8
8
  const { FacilityLocationSchema } = require('./FacilityLocation');
9
+ const { IdSchema } = require('./Id');
9
10
  const Any = require('./basetypes/Any');
10
11
 
11
12
  const [Number, String] = [
@@ -6,6 +6,7 @@ const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
7
  const { ComponentSchema } = require('./Component');
8
8
  const { FacilityLocationSchema } = require('./FacilityLocation');
9
+ const { IdSchema } = require('./Id');
9
10
  const Any = require('./basetypes/Any');
10
11
 
11
12
  const [Number, String] = [
@@ -53,7 +53,7 @@ function RecursiveCast(any) {
53
53
  });
54
54
  return casted;
55
55
  }
56
- if (Number.isInteger(any)) {
56
+ if (Number.isFinite(any)) {
57
57
  return any;
58
58
  }
59
59
  if (Date.parse(any)) {
@@ -1,6 +1,7 @@
1
1
  const mongoose = require('mongoose');
2
2
  const Code = require('./Code.js');
3
3
  const cql = require('cql-execution');
4
+ const Id = require('../Id');
4
5
 
5
6
  const [Schema] = [mongoose.Schema];
6
7
 
@@ -8,6 +9,12 @@ function DataElementSchema(add, options) {
8
9
  const extended = new Schema({
9
10
  dataElementCodes: { type: [] },
10
11
  description: { type: String },
12
+ id: {
13
+ type: Id.IdSchema,
14
+ default() {
15
+ return new Id.Id({ value: (this._id ? this._id.toString() : mongoose.Types.ObjectId().toString()), namingSystem: null });
16
+ },
17
+ },
11
18
  }, options);
12
19
 
13
20
  if (add) {
data/app/models/models.rb CHANGED
@@ -3,6 +3,9 @@ module QDM
3
3
  end
4
4
  require 'mongoid'
5
5
 
6
+ # Generated models that are dependencies for base types
7
+ require_relative 'qdm/id'
8
+
6
9
  # base types
7
10
  require_relative 'qdm/basetypes/code'
8
11
  require_relative 'qdm/basetypes/interval'
@@ -18,7 +21,6 @@ require_relative 'qdm/tacoma/individual_result'
18
21
 
19
22
  # Generated models
20
23
  require_relative 'qdm/patient'
21
- require_relative 'qdm/id'
22
24
  require_relative 'qdm/ratio'
23
25
  require_relative 'qdm/physical_exam_order'
24
26
  require_relative 'qdm/participation'
@@ -9,7 +9,7 @@ module QDM
9
9
  field :method, type: QDM::Code
10
10
  field :result
11
11
  field :components, type: Array
12
- field :relatedTo, type: Array
12
+ embeds_many :relatedTo, class_name: 'QDM::Id'
13
13
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.3.117'
14
14
  field :category, type: String, default: 'assessment'
15
15
  field :qdmStatus, type: String, default: 'performed'
@@ -10,6 +10,14 @@ module QDM
10
10
  # Optional description.
11
11
  field :description, type: String
12
12
 
13
+ embeds_one :id, class_name: 'QDM::Id'
14
+
15
+ def initialize(options = {})
16
+ super(options)
17
+ # default id to the mongo ObjectId for this DataElement if it isnt already defined
18
+ self.id = QDM::Id.new(value: _id.to_s) unless id?
19
+ end
20
+
13
21
  # Returns the attribute requested on the datatype.
14
22
  def get(attribute)
15
23
  send(attribute) if has_attribute?(attribute)
@@ -29,11 +37,6 @@ module QDM
29
37
  dataElementCodes.collect { |code| QDM::Code.demongoize(code) }
30
38
  end
31
39
 
32
- # Return the Mongo id for this datatype.
33
- def id
34
- _id
35
- end
36
-
37
40
  def mongoize
38
41
  json_representation = {}
39
42
  attribute_names.each do |field|
@@ -4,7 +4,7 @@ module QDM
4
4
  include Mongoid::Document
5
5
  embedded_in :patient
6
6
  field :relevantPeriod, type: QDM::Interval
7
- field :relatedTo, type: Array
7
+ embeds_many :relatedTo, class_name: 'QDM::Id'
8
8
  field :targetOutcome
9
9
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.3.7'
10
10
  field :category, type: String, default: 'care_goal'
@@ -4,7 +4,7 @@ module QDM
4
4
  include Mongoid::Document
5
5
  embedded_in :patient
6
6
  field :authorDatetime, type: DateTime
7
- field :relatedTo, type: Array
7
+ embeds_many :relatedTo, class_name: 'QDM::Id'
8
8
  field :negationRationale, type: QDM::Code
9
9
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.3.8'
10
10
  field :category, type: String, default: 'communication'
@@ -4,7 +4,7 @@ module QDM
4
4
  include Mongoid::Document
5
5
  embedded_in :patient
6
6
  field :authorDatetime, type: DateTime
7
- field :relatedTo, type: Array
7
+ embeds_many :relatedTo, class_name: 'QDM::Id'
8
8
  field :negationRationale, type: QDM::Code
9
9
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.3.9'
10
10
  field :category, type: String, default: 'communication'
@@ -4,7 +4,7 @@ module QDM
4
4
  include Mongoid::Document
5
5
  embedded_in :patient
6
6
  field :authorDatetime, type: DateTime
7
- field :relatedTo, type: Array
7
+ embeds_many :relatedTo, class_name: 'QDM::Id'
8
8
  field :negationRationale, type: QDM::Code
9
9
  field :hqmfOid, type: String, default: '2.16.840.1.113883.10.20.28.3.10'
10
10
  field :category, type: String, default: 'communication'
@@ -2,7 +2,6 @@ module QDM
2
2
  # app/models/qdm/component.rb
3
3
  class Component < DataElement
4
4
  include Mongoid::Document
5
- embedded_in :patient
6
5
  field :code, type: QDM::Code
7
6
  field :result
8
7
  field :qdmVersion, type: String, default: '5.3'
@@ -2,7 +2,6 @@ module QDM
2
2
  # app/models/qdm/facility_location.rb
3
3
  class FacilityLocation < DataElement
4
4
  include Mongoid::Document
5
- embedded_in :patient
6
5
  field :code, type: QDM::Code
7
6
  field :locationPeriod, type: QDM::Interval
8
7
  field :qdmVersion, type: String, default: '5.3'
data/app/models/qdm/id.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module QDM
2
2
  # app/models/qdm/id.rb
3
- class Id < DataElement
3
+ class Id
4
4
  include Mongoid::Document
5
- embedded_in :patient
5
+ embedded_in :data_element
6
6
  field :namingSystem, type: String
7
7
  field :value, type: String
8
8
  field :qdmVersion, type: String, default: '5.3'
data/cqm-models.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'cqm-models'
7
- spec.version = '0.8.3'
7
+ spec.version = '0.8.4'
8
8
  spec.authors = ['aholmes@mitre.org', 'mokeefe@mitre.org', 'lades@mitre.org']
9
9
 
10
10
  spec.summary = 'Mongo models that correspond to the QDM specification.'