cqm-models 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.json +1 -1
  3. data/.travis.yml +1 -0
  4. data/app/assets/javascripts/AdverseEvent.js +1 -0
  5. data/app/assets/javascripts/AllergyIntolerance.js +1 -0
  6. data/app/assets/javascripts/AssessmentPerformed.js +2 -1
  7. data/app/assets/javascripts/AssessmentRecommended.js +1 -0
  8. data/app/assets/javascripts/CareGoal.js +2 -1
  9. data/app/assets/javascripts/CommunicationFromPatientToProvider.js +1 -0
  10. data/app/assets/javascripts/CommunicationFromProviderToPatient.js +1 -0
  11. data/app/assets/javascripts/CommunicationFromProviderToProvider.js +1 -0
  12. data/app/assets/javascripts/Component.js +2 -1
  13. data/app/assets/javascripts/DeviceApplied.js +1 -0
  14. data/app/assets/javascripts/DeviceOrder.js +1 -0
  15. data/app/assets/javascripts/DeviceRecommended.js +1 -0
  16. data/app/assets/javascripts/Diagnosis.js +1 -0
  17. data/app/assets/javascripts/DiagnosticStudyOrder.js +1 -0
  18. data/app/assets/javascripts/DiagnosticStudyPerformed.js +2 -1
  19. data/app/assets/javascripts/DiagnosticStudyRecommended.js +1 -0
  20. data/app/assets/javascripts/EncounterOrder.js +1 -0
  21. data/app/assets/javascripts/EncounterPerformed.js +1 -0
  22. data/app/assets/javascripts/EncounterRecommended.js +1 -0
  23. data/app/assets/javascripts/FacilityLocation.js +1 -0
  24. data/app/assets/javascripts/FamilyHistory.js +1 -0
  25. data/app/assets/javascripts/Id.js +1 -0
  26. data/app/assets/javascripts/ImmunizationAdministered.js +1 -0
  27. data/app/assets/javascripts/ImmunizationOrder.js +1 -0
  28. data/app/assets/javascripts/InterventionOrder.js +1 -0
  29. data/app/assets/javascripts/InterventionPerformed.js +2 -1
  30. data/app/assets/javascripts/InterventionRecommended.js +1 -0
  31. data/app/assets/javascripts/LaboratoryTestOrder.js +1 -0
  32. data/app/assets/javascripts/LaboratoryTestPerformed.js +2 -1
  33. data/app/assets/javascripts/LaboratoryTestRecommended.js +1 -0
  34. data/app/assets/javascripts/Measure.js +2 -0
  35. data/app/assets/javascripts/MedicationActive.js +1 -0
  36. data/app/assets/javascripts/MedicationAdministered.js +1 -0
  37. data/app/assets/javascripts/MedicationDischarge.js +1 -0
  38. data/app/assets/javascripts/MedicationDispensed.js +1 -0
  39. data/app/assets/javascripts/MedicationOrder.js +1 -0
  40. data/app/assets/javascripts/Participation.js +1 -0
  41. data/app/assets/javascripts/PatientCareExperience.js +1 -0
  42. data/app/assets/javascripts/PatientCharacteristic.js +1 -0
  43. data/app/assets/javascripts/PatientCharacteristicBirthdate.js +1 -0
  44. data/app/assets/javascripts/PatientCharacteristicClinicalTrialParticipant.js +1 -0
  45. data/app/assets/javascripts/PatientCharacteristicEthnicity.js +1 -0
  46. data/app/assets/javascripts/PatientCharacteristicExpired.js +1 -0
  47. data/app/assets/javascripts/PatientCharacteristicPayer.js +1 -0
  48. data/app/assets/javascripts/PatientCharacteristicRace.js +1 -0
  49. data/app/assets/javascripts/PatientCharacteristicSex.js +1 -0
  50. data/app/assets/javascripts/PhysicalExamOrder.js +1 -0
  51. data/app/assets/javascripts/PhysicalExamPerformed.js +2 -1
  52. data/app/assets/javascripts/PhysicalExamRecommended.js +1 -0
  53. data/app/assets/javascripts/ProcedureOrder.js +1 -0
  54. data/app/assets/javascripts/ProcedurePerformed.js +2 -1
  55. data/app/assets/javascripts/ProcedureRecommended.js +1 -0
  56. data/app/assets/javascripts/ProviderCareExperience.js +1 -0
  57. data/app/assets/javascripts/ProviderCharacteristic.js +1 -0
  58. data/app/assets/javascripts/Ratio.js +1 -0
  59. data/app/assets/javascripts/ResultComponent.js +1 -0
  60. data/app/assets/javascripts/SubstanceAdministered.js +1 -0
  61. data/app/assets/javascripts/SubstanceOrder.js +1 -0
  62. data/app/assets/javascripts/SubstanceRecommended.js +1 -0
  63. data/app/assets/javascripts/Symptom.js +1 -0
  64. data/app/assets/javascripts/basetypes/Any.js +50 -0
  65. data/app/models/qdm/tacoma/measure.rb +2 -0
  66. data/cqm-models.gemspec +2 -2
  67. data/dist/index.js +687 -574
  68. data/lib/generate_models.rb +2 -2
  69. data/package.json +2 -2
  70. data/templates/mongoose_template.js.erb +1 -0
  71. metadata +5 -4
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const Any = require('./basetypes/Any');
7
8
 
8
9
  const [Number, String] = [
9
10
  mongoose.Schema.Types.Number,
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const Any = require('./basetypes/Any');
7
8
 
8
9
  const [Number, String] = [
9
10
  mongoose.Schema.Types.Number,
@@ -4,6 +4,7 @@ const Code = require('./basetypes/Code');
4
4
  const Interval = require('./basetypes/Interval');
5
5
  const Quantity = require('./basetypes/Quantity');
6
6
  const DateTime = require('./basetypes/DateTime');
7
+ const Any = require('./basetypes/Any');
7
8
 
8
9
  const [Number, String] = [
9
10
  mongoose.Schema.Types.Number,
@@ -0,0 +1,50 @@
1
+ const mongoose = require('mongoose');
2
+ const cql = require('cql-execution');
3
+
4
+ function Any(key, options) {
5
+ mongoose.SchemaType.call(this, key, options, 'Any');
6
+ }
7
+ Any.prototype = Object.create(mongoose.SchemaType.prototype);
8
+
9
+ function RecursiveCast(any) {
10
+ if (any && any.value && any.unit) {
11
+ return new cql.Quantity(any);
12
+ }
13
+ if (any && any.low) {
14
+ const casted = new cql.Interval(any.low, any.high, any.lowClosed, any.highClosed);
15
+
16
+ // Cast Low and High values to Quantities if it is a quantity
17
+ if (casted.low && casted.low.unit && casted.low.value) {
18
+ casted.low = new cql.Quantity(casted.low);
19
+ if (casted.high && casted.high.unit && casted.high.value) {
20
+ casted.high = new cql.Quantity(casted.high);
21
+ }
22
+ return casted;
23
+ }
24
+
25
+ // Cast to DateTime if it is a string representing a DateTime
26
+ if (casted.low && Date.parse(casted.low)) {
27
+ casted.low = cql.DateTime.fromDate(new Date(casted.low), 0);
28
+ }
29
+ if (casted.high && Date.parse(casted.high)) {
30
+ casted.high = cql.DateTime.fromDate(new Date(casted.high), 0);
31
+ }
32
+ return casted;
33
+ }
34
+ if (Array.isArray(any)) {
35
+ const casted = [];
36
+ any.forEach((val) => {
37
+ casted.push(RecursiveCast(val));
38
+ });
39
+ return casted;
40
+ }
41
+ if (Date.parse(any)) {
42
+ return cql.DateTime.fromDate(new Date(any), 0);
43
+ }
44
+ return any;
45
+ }
46
+
47
+ Any.prototype.cast = any => RecursiveCast(any);
48
+
49
+ mongoose.Schema.Types.Any = Any;
50
+ module.exports = Any;
@@ -63,6 +63,8 @@ module QDM
63
63
  field :populations, type: Array
64
64
  field :populations_cql_map, type: Hash
65
65
  field :observations, type: Array
66
+ # TODO: Depending on how we restructure the Measure/Population object, may be deleted in the future
67
+ field :population_ids, type: Hash
66
68
 
67
69
  field :value_set_oids, type: Array, default: []
68
70
  field :value_set_oid_version_objects, type: Array, default: []
data/cqm-models.gemspec CHANGED
@@ -4,11 +4,11 @@ $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.7.2'
7
+ spec.version = '0.7.3'
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.'
11
- spec.description = 'This library contains auto generated Mongoid (Ruby) and Mongoose (JavaScript) models that correspond to the QDM (Quality Data Model) specification.'
11
+ spec.description = 'This library contains auto generated Mongo (Mongoid) models that correspond to the QDM (Quality Data Model) specification.'
12
12
  spec.homepage = 'https://github.com/projecttacoma/cqm-models'
13
13
  spec.license = 'Apache-2.0'
14
14