blue-button-fhir
Advanced tools
Comparing version 1.5.0-beta.1 to 1.5.0-beta.2
@@ -14,23 +14,19 @@ "use strict"; | ||
var overrideMethods = { | ||
dataKeyPieceOverride: function (input, dataKeyPiece) { | ||
if (dataKeyPiece === 'reference') { | ||
var id = input; | ||
input = this.resourceDict[input]; | ||
if (!bbuobject.exists(input)) { | ||
logger.debug({ | ||
missingResource: id | ||
}); | ||
return null; | ||
} | ||
return input; | ||
} else { | ||
return input; | ||
exports.instance = function (resourceDict) { | ||
var getResource = function (input) { | ||
var id = input; | ||
input = resourceDict[id]; | ||
if (!bbuobject.exists(input)) { | ||
logger.debug({ | ||
missingResource: id | ||
}); | ||
return null; | ||
} | ||
} | ||
}; | ||
return input; | ||
}; | ||
exports.instance = function (resourceDict) { | ||
var overrides = { | ||
dataKeyPieceOverride: overrideMethods.dataKeyPieceOverride, | ||
dataKeyFnOptions: { | ||
getResource: getResource | ||
}, | ||
resourceDict: resourceDict, | ||
@@ -37,0 +33,0 @@ logger: logger |
@@ -9,2 +9,4 @@ "use strict"; | ||
var jp = bbu.jsonpath.instance; | ||
var severity = { | ||
@@ -20,7 +22,7 @@ content: { | ||
value: value.concept, | ||
dataKey: 'reference.symptom.0.code.coding.0' | ||
dataKey: jp('reference.getResource().symptom[0].code.coding[0]') | ||
}, | ||
'severity.code': { | ||
value: value.codeToValueSet('reactionSeverity'), | ||
dataKey: 'reference.symptom.0.severity' | ||
dataKey: jp('reference.getResource().symptom[0].severity') | ||
} | ||
@@ -42,7 +44,6 @@ } | ||
value: value.concept, | ||
dataKey: 'substance.reference.type.coding.0' | ||
dataKey: jp('substance.reference.getResource().type.coding[0]') | ||
}, | ||
'allergen.name': { | ||
dataKey: 'substance.reference.type.text', | ||
existsWhen: predicate.hasNoProperty('substance.reference.type.coding.0') | ||
dataKey: jp('substance.reference.getResource().type.text') | ||
}, | ||
@@ -49,0 +50,0 @@ reactions: { |
"use strict"; | ||
var bbu = require("blue-button-util"); | ||
var value = require('./value'); | ||
var jp = bbu.jsonpath.instance; | ||
var problem = { | ||
@@ -9,3 +13,3 @@ content: { | ||
value: value.concept, | ||
dataKey: 'code.coding.0' | ||
dataKey: jp('code.coding[0]') | ||
}, | ||
@@ -12,0 +16,0 @@ 'date_time.low': { |
"use strict"; | ||
var bbu = require("blue-button-util"); | ||
var value = require('./value'); | ||
var jp = bbu.jsonpath.instance; | ||
var whenGiven = { | ||
@@ -33,7 +37,7 @@ content: { | ||
value: value.concept, | ||
dataKey: 'route.coding.0' | ||
dataKey: jp('route.coding[0]') | ||
}, | ||
site: { | ||
value: value.concept, | ||
dataKey: 'site.coding.0', | ||
dataKey: jp('site.coding[0]'), | ||
}, | ||
@@ -63,3 +67,3 @@ dose: { | ||
value: repeat, | ||
dataKey: 'dosageInstruction.0.timingSchedule.repeat' | ||
dataKey: jp('dosageInstruction[0].timingSchedule.repeat') | ||
}, | ||
@@ -82,20 +86,20 @@ sig: { | ||
value: dosage, | ||
dataKey: 'dosage.0' | ||
dataKey: jp('dosage[0]') | ||
}, | ||
'precondition.value': { | ||
value: value.concept, | ||
dataKey: 'dosage.0.asNeededCodeableConcept.coding.0' | ||
dataKey: jp('dosage[0].asNeededCodeableConcept.coding[0]') | ||
}, | ||
'product.product': { | ||
value: value.concept, | ||
dataKey: 'medication.reference.code.coding.0', | ||
dataKey: jp('medication.reference.getResource().code.coding[0]'), | ||
}, | ||
'administration.interval': { | ||
value: repeat, | ||
dataKey: 'prescription.reference.dosageInstruction.0.timingSchedule.repeat', | ||
dataKey: jp('prescription.reference.getResource().dosageInstruction[0].timingSchedule.repeat'), | ||
}, | ||
'sig': { | ||
dataKey: 'prescription.reference.text.div' | ||
dataKey: jp('prescription.reference.getResource().text.div') | ||
} | ||
} | ||
}; |
@@ -9,2 +9,4 @@ "use strict"; | ||
var jp = bbu.jsonpath.instance; | ||
var repeat = { | ||
@@ -38,21 +40,21 @@ content: { | ||
value: value.concept, | ||
dataKey: 'medication.reference.code.coding.0' | ||
dataKey: jp('medication.reference.getResource().code.coding[0]') | ||
}, | ||
'administration.site': { | ||
value: value.concept, | ||
dataKey: 'dosageInstruction.0.site.coding.0' | ||
dataKey: jp('dosageInstruction[0].site.coding[0]') | ||
}, | ||
'administration.route': { | ||
value: value.concept, | ||
dataKey: 'dosageInstruction.0.route.coding.0' | ||
dataKey: jp('dosageInstruction[0].route.coding[0]') | ||
}, | ||
'administration.dose.value': { | ||
dataKey: 'dosageInstruction.0.doseQuantity.value' | ||
dataKey: jp('dosageInstruction[0].doseQuantity.value') | ||
}, | ||
'administration.dose.unit': { | ||
dataKey: 'dosageInstruction.0.doseQuantity.units' | ||
dataKey: jp('dosageInstruction[0].doseQuantity.units') | ||
}, | ||
'administration.interval': { | ||
value: repeat, | ||
dataKey: 'dosageInstruction.0.timingSchedule.repeat', | ||
dataKey: jp('dosageInstruction[0].timingSchedule.repeat'), | ||
existsWhen: predicate.hasNoProperty('dosageInstruction.0.timingSchedule.repeat.when') | ||
@@ -62,11 +64,11 @@ }, | ||
value: value.codeToValueSet('scheduleWhen'), | ||
dataKey: 'dosageInstruction.0.timingSchedule.repeat.when' | ||
dataKey: jp('dosageInstruction[0].timingSchedule.repeat.when') | ||
}, | ||
'precondition.value': { | ||
value: value.concept, | ||
dataKey: 'dosageInstruction.0.asNeededCodeableConcept.coding.0' | ||
dataKey: jp('dosageInstruction[0].asNeededCodeableConcept.coding[0]') | ||
}, | ||
'date_time.high': { | ||
value: value.datetime, | ||
dataKey: ['dosageInstruction.0.timingSchedule.repeat.end', 'dosageInstruction.0.timingPeriod.end'] | ||
dataKey: [jp('dosageInstruction[0].timingSchedule.repeat.end'), jp('dosageInstruction[0].timingPeriod.end')] | ||
}, | ||
@@ -73,0 +75,0 @@ sig: { |
"use strict"; | ||
var bbu = require("blue-button-util"); | ||
var value = require('./value'); | ||
@@ -7,2 +9,3 @@ var observation_result = require('./observation-result'); | ||
var result = observation_result.result; | ||
var jp = bbu.jsonpath.instance; | ||
@@ -14,3 +17,3 @@ exports.template = { | ||
value: value.concept, | ||
dataKey: 'name.coding.0' | ||
dataKey: jp('name.coding[0]') | ||
}, | ||
@@ -17,0 +20,0 @@ results: { |
"use strict"; | ||
var bbu = require("blue-button-util"); | ||
var value = require('./value'); | ||
var jp = bbu.jsonpath.instance; | ||
var referenceRange = { | ||
@@ -41,3 +45,3 @@ content: { | ||
value: referenceRange, | ||
dataKey: 'referenceRange.0' | ||
dataKey: jp('referenceRange[0]') | ||
}, | ||
@@ -63,9 +67,9 @@ 'date_time.point': { | ||
value: value.concept, | ||
dataKey: 'name.coding.0' | ||
dataKey: jp('name.coding[0]') | ||
}, | ||
results: { | ||
value: result, | ||
dataKey: 'related.target.reference' | ||
dataKey: jp('related[*].target.reference.getResource()') | ||
} | ||
} | ||
}; |
"use strict"; | ||
var bbu = require("blue-button-util"); | ||
var value = require('./value'); | ||
var predicate = bbu.predicate; | ||
var jp = bbu.jsonpath.instance; | ||
exports.template = { | ||
@@ -10,3 +16,3 @@ type: 'vital', | ||
value: value.concept, | ||
dataKey: 'name.coding.0' | ||
dataKey: jp('name.coding[0]') | ||
}, | ||
@@ -13,0 +19,0 @@ 'date_time.point': { |
@@ -87,17 +87,14 @@ "use strict"; | ||
religion: { | ||
dataKey: jp('extension[?(@.url==="http://hl7.org/fhir/StructureDefinition/us-core-religion")].valueCodeableConcept.coding[0].display', { | ||
wrap: false | ||
}) | ||
dataKey: jp('extension[?(@.url==="http://hl7.org/fhir/StructureDefinition/us-core-religion")].valueCodeableConcept.coding[0].display'), | ||
single: true | ||
}, | ||
race: { | ||
dataKey: jp('extension[?(@.url==="http://hl7.org/fhir/Profile/us-core#race")].valueCodeableConcept.coding[0].display', { | ||
wrap: false | ||
}) | ||
dataKey: jp('extension[?(@.url==="http://hl7.org/fhir/Profile/us-core#race")].valueCodeableConcept.coding[0].display'), | ||
single: true | ||
}, | ||
ethnicity: { | ||
dataKey: jp('extension[?(@.url==="http://hl7.org/fhir/Profile/us-core#ethnicity")].valueCodeableConcept.coding[0].display', { | ||
wrap: false | ||
}) | ||
dataKey: jp('extension[?(@.url==="http://hl7.org/fhir/Profile/us-core#ethnicity")].valueCodeableConcept.coding[0].display'), | ||
single: true | ||
} | ||
} | ||
}; |
{ | ||
"name": "blue-button-fhir", | ||
"version": "1.5.0-beta.1", | ||
"version": "1.5.0-beta.2", | ||
"description": "Blue Button FHIR to Model Translator", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
100916
2900