Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1974 from MeasureAuthoringTool/MAT-3202
Browse files Browse the repository at this point in the history
Removed duplicate Timing attributes
  • Loading branch information
RohitKandimalla authored Aug 3, 2021
2 parents aa49782 + c691b5d commit 430f4bc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 74 deletions.
31 changes: 0 additions & 31 deletions app/assets/javascripts/helpers/data_criteria_helpers.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 430f4bc

Please sign in to comment.