From db467a96b1f9b17c201df3aca73c73c178e74847 Mon Sep 17 00:00:00 2001 From: Rohit Kandimalla Date: Tue, 3 Aug 2021 13:43:18 -0400 Subject: [PATCH] Removed duplicate Timing attributes --- .../helpers/data_criteria_helpers.js.coffee | 31 ------------- ..._helpers_medication_request_spec.js.coffee | 43 ------------------- 2 files changed, 74 deletions(-) diff --git a/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee b/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee index 4c3bc54cf..e7f5e1625 100644 --- a/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee +++ b/app/assets/javascripts/helpers/data_criteria_helpers.js.coffee @@ -1214,37 +1214,6 @@ fhirResource.dosageInstruction[0].doseAndRate[0].rate = rate types: ['Ratio', 'Range', 'SimpleQuantity'] }, - { - path: 'dosageInstruction.timing.code' - title: 'dosageInstruction.timing.code' - getValue: (fhirResource) -> fhirResource?.dosageInstruction?[0]?.timing?.code?.coding?[0] - setValue: (fhirResource, coding) -> - if !coding? - fhirResource?.dosageInstruction?[0]?.timing?.code = null - else - fhirResource.dosageInstruction = [ new cqm.models.Dosage() ] unless fhirResource?.dosageInstruction - fhirResource.dosageInstruction[0].timing = new cqm.models.Timing() unless fhirResource?.dosageInstruction?[0]?.timing - fhirResource.dosageInstruction[0].timing.code = new cqm.models.CodeableConcept() - fhirResource.dosageInstruction[0].timing.code.coding = [ coding ] - - valueSets: () -> - [FhirValueSets.TIMING_ABBREVIATION_VS] - types: ['CodeableConcept'] - }, - { - path: 'dosageInstructions.timing.repeat.bounds' - title: 'dosageInstructions.timing.repeat.bounds' - getValue: (fhirResource) -> fhirResource?.dosageInstruction?[0]?.timing?.repeat?.bounds - setValue: (fhirResource, bounds) -> - if !bounds? - fhirResource?.dosageInstruction?[0]?.timing?.repeat?.bounds = null - else - fhirResource.dosageInstruction = [ new cqm.models.Dosage() ] unless fhirResource?.dosageInstruction - fhirResource.dosageInstruction[0].timing = new cqm.models.Timing() unless fhirResource?.dosageInstruction?[0]?.timing - fhirResource.dosageInstruction[0].timing.repeat = new cqm.models.TimingRepeat() unless fhirResource?.dosageInstruction?[0]?.timing?.repeat - fhirResource.dosageInstruction[0].timing.repeat.bounds = bounds - types: ['Duration', 'Range', 'Period'] - }, { path: 'reasonCode' title: 'reasonCode' diff --git a/spec/javascripts/helper_specs/data_criteria_helpers_medication_request_spec.js.coffee b/spec/javascripts/helper_specs/data_criteria_helpers_medication_request_spec.js.coffee index 3ea7d8717..6a7c81f4f 100644 --- a/spec/javascripts/helper_specs/data_criteria_helpers_medication_request_spec.js.coffee +++ b/spec/javascripts/helper_specs/data_criteria_helpers_medication_request_spec.js.coffee @@ -21,9 +21,6 @@ describe 'DataCriteriaHelpers', -> it 'should support MedicationRequest.statusReason', -> DataCriteriaAsserts.assertCodeableConcept('MedicationRequest', 'statusReason', 'statusReason') - it 'should support MedicationRequest.dosageInstruction.timing.code', -> - DataCriteriaAsserts.assertCodeableConcept('MedicationRequest', 'dosageInstruction.timing.code', 'dosageInstruction.timing.code') - it 'should support MedicationRequest.dispenseRequest.validityPeriod', -> DataCriteriaAsserts.assertPeriod('MedicationRequest', 'dispenseRequest.validityPeriod', 'dispenseRequest.validityPeriod') @@ -91,46 +88,6 @@ describe 'DataCriteriaHelpers', -> expect(value.reference.value).toEqual 'random-reference' - it 'should support MedicationRequest.dosageInstructions.timing.repeat.bounds', -> - attrs = DataCriteriaHelpers.DATA_ELEMENT_ATTRIBUTES['MedicationRequest'] - attr = attrs.find (attr) => attr.path is 'dosageInstructions.timing.repeat.bounds' - expect(attr.path).toEqual 'dosageInstructions.timing.repeat.bounds' - expect(attr.title).toEqual 'dosageInstructions.timing.repeat.bounds' - expect(attr.types).toEqual [ 'Duration', 'Range', 'Period' ] - - fhirResource = new cqm.models['MedicationRequest']() - - # Duration - duration = cqm.models.Duration.parse({"unit": "ml", "value": "100"}) - attr.setValue(fhirResource, duration) - value = attr.getValue(fhirResource.clone()) - - expect(value.value.value).toEqual '100' - expect(value.unit.value).toEqual 'ml' - - # Range - range = cqm.models.Range.parse({"low": {"value": "3", "unit": "h"}, "high": {"value": "4", "unit": "h"}}) - attr.setValue(fhirResource, range) - value = attr.getValue(fhirResource.clone()) - - expect(value.low.value.value).toEqual '3' - expect(value.low.unit.value).toEqual 'h' - - expect(value.high.value.value).toEqual '4' - expect(value.high.unit.value).toEqual 'h' - - # Period - DataCriteriaAsserts.assertPeriod('MedicationRequest', 'dosageInstructions.timing.repeat.bounds', 'dosageInstructions.timing.repeat.bounds') - period = new cqm.models.Period() - period.start = cqm.models.PrimitiveDateTime.parsePrimitive('2020-09-02T13:54:57') - period.end = cqm.models.PrimitiveDateTime.parsePrimitive('2020-10-02T13:54:57') - - attr.setValue(fhirResource, period) - value = attr.getValue(fhirResource.clone()) - - expect(value.start.value).toEqual '2020-09-02T13:54:57' - expect(value.end.value).toEqual '2020-10-02T13:54:57' - it 'should support MedicationRequest.dosageInstruction.timing', -> attrs = DataCriteriaHelpers.DATA_ELEMENT_ATTRIBUTES['MedicationRequest'] attr = attrs.find (attr) -> attr.path is 'dosageInstruction.timing'