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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a9112723b0e517a2632987b6fc5fd7aea269156
4
- data.tar.gz: 48e94bfe9226c50e930774becde0777383a4597c
3
+ metadata.gz: 363b774ed856747c2e2072c19509c6b07cbc9f32
4
+ data.tar.gz: 6023d0d51527e7d983e654d07be048787b708e74
5
5
  SHA512:
6
- metadata.gz: c1f9ee3b7d996709c957066e1ecff149d55a71f8fac38d3ab63c0bd785514fab56ed5f1d1992e54a69ceac63df2aba5674471d2dc666fb52f7d91ab529accf12
7
- data.tar.gz: 46da62a6f59b1fc2c33bca35300e628181ea123f4289d8d0bd3543c271050b559ff12d8b2c1f4fa10f741bb67634e75fffe8766100c8d591241663c175d47c48
6
+ metadata.gz: e9cfd973933d81ab07bf72a680c81059dbcffa3db16dd42920d94f5886b141404199aebfcc885c9fcaeb9c2cefb0ea2b0c418d288174dc4db1f55db90980fdde
7
+ data.tar.gz: '08fcc6ffbb2d6c0f3998fb07c3d4238b5c334af360ecbf00acb01f624cfd0648cf522b5831c589ad2292d7d0a9916af33c804c601cdadbe853ba46e61972e85e'
data/.eslintrc.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "extends": "airbnb-base",
3
3
  "rules": {
4
4
  "max-len": ["error", {"code": 200, "ignoreComments": true}],
5
- "no-unused-vars": ["error", { "varsIgnorePattern": "DataElementSchema|ComponentSchema|FacilityLocationSchema|Code|Quantity|Interval|Integer|Array|Float|Time|Number|Date|Mixed|Any" }],
5
+ "no-unused-vars": ["error", { "varsIgnorePattern": "IdSchema|DataElementSchema|ComponentSchema|FacilityLocationSchema|Code|Quantity|Interval|Integer|Array|Float|Time|Number|Date|Mixed|Any" }],
6
6
  "camelcase": "off",
7
7
  "comma-dangle": ["error", {
8
8
  "arrays": "always-multiline",
@@ -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] = [
@@ -20,7 +21,7 @@ const AssessmentPerformedSchema = DataElementSchema({
20
21
  method: Code,
21
22
  result: Any,
22
23
  components: [ComponentSchema],
23
- relatedTo: [String],
24
+ relatedTo: [IdSchema],
24
25
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.117' },
25
26
  category: { type: String, default: 'assessment' },
26
27
  qdmStatus: { type: String, default: 'performed' },
@@ -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] = [
@@ -15,7 +16,7 @@ const [Number, String] = [
15
16
 
16
17
  const CareGoalSchema = DataElementSchema({
17
18
  relevantPeriod: Interval,
18
- relatedTo: [String],
19
+ relatedTo: [IdSchema],
19
20
  targetOutcome: Any,
20
21
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.7' },
21
22
  category: { type: String, default: 'care_goal' },
@@ -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] = [
@@ -15,7 +16,7 @@ const [Number, String] = [
15
16
 
16
17
  const CommunicationFromPatientToProviderSchema = DataElementSchema({
17
18
  authorDatetime: DateTime,
18
- relatedTo: [String],
19
+ relatedTo: [IdSchema],
19
20
  negationRationale: Code,
20
21
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.8' },
21
22
  category: { type: String, default: 'communication' },
@@ -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] = [
@@ -15,7 +16,7 @@ const [Number, String] = [
15
16
 
16
17
  const CommunicationFromProviderToPatientSchema = DataElementSchema({
17
18
  authorDatetime: DateTime,
18
- relatedTo: [String],
19
+ relatedTo: [IdSchema],
19
20
  negationRationale: Code,
20
21
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.9' },
21
22
  category: { type: String, default: 'communication' },
@@ -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] = [
@@ -15,7 +16,7 @@ const [Number, String] = [
15
16
 
16
17
  const CommunicationFromProviderToProviderSchema = DataElementSchema({
17
18
  authorDatetime: DateTime,
18
- relatedTo: [String],
19
+ relatedTo: [IdSchema],
19
20
  negationRationale: Code,
20
21
  hqmfOid: { type: String, default: '2.16.840.1.113883.10.20.28.3.10' },
21
22
  category: { type: String, default: 'communication' },
@@ -6,6 +6,7 @@ const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
7
 
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] = [
@@ -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] = [
@@ -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
 
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] = [
@@ -1,25 +1,17 @@
1
1
  const mongoose = require('mongoose');
2
- const { DataElementSchema } = require('./basetypes/DataElement');
3
- const Code = require('./basetypes/Code');
4
- const Interval = require('./basetypes/Interval');
5
- const Quantity = require('./basetypes/Quantity');
6
- const DateTime = require('./basetypes/DateTime');
7
- const { ComponentSchema } = require('./Component');
8
- const { FacilityLocationSchema } = require('./FacilityLocation');
9
- const Any = require('./basetypes/Any');
10
2
 
11
3
  const [Number, String] = [
12
4
  mongoose.Schema.Types.Number,
13
5
  mongoose.Schema.Types.String,
14
6
  ];
15
7
 
16
- const IdSchema = DataElementSchema({
8
+ const IdSchema = mongoose.Schema({
17
9
  namingSystem: String,
18
10
  value: String,
19
11
  qdmVersion: { type: String, default: '5.3' },
20
12
  _type: { type: String, default: 'Id' },
21
13
 
22
- });
14
+ }, { _id: false, id: false });
23
15
 
24
16
  module.exports.IdSchema = IdSchema;
25
17
  module.exports.Id = mongoose.model('Id', IdSchema);
@@ -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] = [
@@ -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] = [
@@ -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] = [
@@ -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] = [
@@ -90,15 +90,11 @@ PatientSchema.methods.getByProfile = function getByProfile(profile, isNegated =
90
90
  // If isNegated == null, return all matching data elements by type, regardless of negationRationale.
91
91
  const results = this.dataElements.filter(element => element._type === `QDM::${profile}` && (isNegated === null || !!element.negationRationale === isNegated));
92
92
  return results.map((result) => {
93
- const getCodeFunction = Object.getPrototypeOf(result).getCode;
94
- const codeFunction = Object.getPrototypeOf(result).code;
95
- const idField = result.id;
96
93
  const removedMongooseItems = AllDataElements[profile](result).toObject();
97
- // toObject() will remove all mongoose functions but also removed the getCode and code functions
98
- // the execution engine requires the code and getCode functions so we have to add them back
99
- removedMongooseItems.getCode = getCodeFunction;
100
- removedMongooseItems.code = codeFunction;
101
- removedMongooseItems.id = idField;
94
+ // toObject() will remove all mongoose functions but also remove the schema methods, so we add them back
95
+ Object.entries(Object.getPrototypeOf(result).schema.methods).forEach(([method_name, method]) => {
96
+ removedMongooseItems[method_name] = method;
97
+ });
102
98
  return removedMongooseItems;
103
99
  });
104
100
  };
@@ -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] = [
@@ -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] = [
@@ -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] = [
@@ -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] = [
@@ -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
 
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] = [