Skip to content

Commit

Permalink
Merge pull request #788 from FluxNotes/expected-performance-time-fix
Browse files Browse the repository at this point in the history
Created ExpectedPerformanceTimeFix.
  • Loading branch information
Matthew Gramigna authored Oct 8, 2019
2 parents c899604 + c340d67 commit c3ee71d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/model/fluxExtensions/ExpectedPerformanceTimeFix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import ExpectedPerformanceTime from "../shr/core/ExpectedPerformanceTime";
import { FHIRHelper, uuid } from '../json-helper';

export default class ExpectedPerformanceTimeFix extends ExpectedPerformanceTime {
static fromFHIR(fhir, fhirType, shrId=uuid(), allEntries=[], mappedResources={}, referencesOut=[], asExtension=false) {
const inst = new ExpectedPerformanceTimeFix();
if (!asExtension && fhir != null) {
// reminder: ExpectedPerformanceTime.value can be: (dateTime|TimePeriod|Timing)

switch(fhirType) {
case 'dateTime':
inst.value = fhir;
break;

case 'Timing':
inst.value = FHIRHelper.createInstanceFromFHIR('shr.core.Timing', fhir, 'Timing', shrId, allEntries, mappedResources, referencesOut);
break;

// the one instance here where the FHIR type != the SHR type name....
case 'Period':
inst.value = FHIRHelper.createInstanceFromFHIR('shr.core.TimePeriod', fhir, 'Period', shrId, allEntries, mappedResources, referencesOut);
break;

default:
// do nothing
}
}
return inst;
}
}
2 changes: 2 additions & 0 deletions src/model/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CodingFix from './fluxExtensions/CodingFix';
import CodeableConceptFix from './fluxExtensions/CodeableConceptFix';
import BloodPressureFix from './fluxExtensions/BloodPressureFix';
import DataValueFix from './fluxExtensions/DataValueFix';
import ExpectedPerformanceTimeFix from './fluxExtensions/ExpectedPerformanceTimeFix';
import MedicationCodeOrReferenceFix from './fluxExtensions/MedicationCodeOrReferenceFix';
import MedicationRequestFix from './fluxExtensions/MedicationRequestFix';
import ReasonReferenceFix from './fluxExtensions/ReasonReferenceFix';
Expand Down Expand Up @@ -35,6 +36,7 @@ function init() {
ClassRegistry.set('shr.core', 'CodeableConcept', CodeableConceptFix);
ClassRegistry.set('shr.core', 'BloodPressure', BloodPressureFix);
ClassRegistry.set('shr.core', 'DataValue', DataValueFix);
ClassRegistry.set('shr.core', 'ExpectedPerformanceTime', ExpectedPerformanceTimeFix);
ClassRegistry.set('shr.core', 'MedicationCodeOrReference', MedicationCodeOrReferenceFix);
ClassRegistry.set('shr.core', 'MedicationRequest', MedicationRequestFix);
ClassRegistry.set('shr.core', 'ReasonReference', ReasonReferenceFix);
Expand Down

0 comments on commit c3ee71d

Please sign in to comment.