-
Notifications
You must be signed in to change notification settings - Fork 19
Updating Generated ES6 classes
Dylan Hall edited this page Feb 25, 2019
·
6 revisions
- Flux has added the following line to
createInstance()
in order to handle null values in JSON:
if (value == null) return null;
Insert this line before the if (typeof value === 'object')
block (as of 5/3/2018, this is line 134). The additional line allows you to set { "Value": null } properly.
- Flux created SourceClinicalNote while it is still in development in the SHR. Due to this, some manual edits to the generated classes is needed:
- Manually create the
src/model/shr/base/SourceClinicalNote.js
file. - Add
get
andset
methods for SourceClinicalNotes insrc/model/shr/base/Entry.js
.
- Until this issue is resolved: https://github.com/standardhealth/shr-es6-export/issues/37 the generated Coding and CodeableConcept classes do not support implicit mapping from codes. Current workaround is to manually update the fromFHIR methods in these 2 classes, and add a case where the
fhir
parameter is a string instead of the expected object: Coding.js
static fromFHIR(fhir, shrId=uuid(), allEntries=[], mappedResources={}, referencesOut=[], asExtension=false) {
const inst = new Coding();
if (typeof fhir === 'string') {
inst.code = FHIRHelper.createInstanceFromFHIR('shr.core.Code', fhir, shrId, allEntries, mappedResources, referencesOut, false);
inst.displayText = FHIRHelper.createInstanceFromFHIR('shr.core.DisplayText', fhir, shrId, allEntries, mappedResources, referencesOut, false);
} else {
if (fhir['system'] != null) {
inst.codeSystem = FHIRHelper.createInstanceFromFHIR('shr.core.CodeSystem', fhir['system'], shrId, allEntries, mappedResources, referencesOut, false);
}
if (fhir['version'] != null) {
inst.codeSystemVersion = FHIRHelper.createInstanceFromFHIR('shr.core.CodeSystemVersion', fhir['version'], shrId, allEntries, mappedResources, referencesOut, false);
}
if (fhir['code'] != null) {
inst.code = FHIRHelper.createInstanceFromFHIR('shr.core.Code', fhir['code'], shrId, allEntries, mappedResources, referencesOut, false);
}
if (fhir['display'] != null) {
inst.displayText = FHIRHelper.createInstanceFromFHIR('shr.core.DisplayText', fhir['display'], shrId, allEntries, mappedResources, referencesOut, false);
}
}
return inst;
}
CodeableConcept.js
static fromFHIR(fhir, shrId=uuid(), allEntries=[], mappedResources={}, referencesOut=[], asExtension=false) {
const inst = new CodeableConcept();
if (typeof fhir === 'string') {
inst.coding = inst.coding || [];
const inst_coding = FHIRHelper.createInstanceFromFHIR('shr.core.Coding', fhir, shrId, allEntries, mappedResources, referencesOut, false);
inst.coding.push(inst_coding);
inst.displayText = FHIRHelper.createInstanceFromFHIR('shr.core.DisplayText', fhir, shrId, allEntries, mappedResources, referencesOut, false);
} else {
for (const fhir_coding of fhir['coding'] || []) {
inst.coding = inst.coding || [];
const inst_coding = FHIRHelper.createInstanceFromFHIR('shr.core.Coding', fhir_coding, shrId, allEntries, mappedResources, referencesOut, false);
inst.coding.push(inst_coding);
}
if (fhir['text'] != null) {
inst.displayText = FHIRHelper.createInstanceFromFHIR('shr.core.DisplayText', fhir['text'], shrId, allEntries, mappedResources, referencesOut, false);
}
if (asExtension) {
inst.value = fhir['valueCodeableConcept'];
}
}
return inst;
}
Copyright © 2017 The MITRE Corporation | Approved for Public Release; Distribution Unlimited. Case Number 16‑1988
- Home
- About Flux Notes
- Active Treatment Summary Objects
- Data Standards for Breast Cancer
- Database decision
- Declarative Shortcut Format
- Demo Script
- Deployment Plan - Lite Mode
- Dragon Software Information and Troubleshooting
- Flux Notes Lite Demo Script
- How To Create New Shortcuts
- Interaction Between REACT.js Components in Flux
- JavaScript and HTML Code Style Guide
- Key Application Features
- Minimap Evaluation
- Naming Convention for Visual Components
- NLP Server: Provisioning and Troubleshooting
- Pre Release Testing Script
- Profiling and Performance
- Redux Implementation Guide
- Shorthand Context Problem
- Testing
- Third Party Libraries Changes
- Demo Scenarios -- (out of date)