Skip to main content

fhir-fr@1.0.4

This adaptor exports the following namespaced functions:

utils.addExtension(resource, url, value)
utils.cc()
utils.coding(code, system)
utils.composite(object, key, value)
utils.concept()
utils.findExtension(obj, targetUrl, [path])
utils.id()
utils.identifier(input, [system])
utils.ref()
utils.reference(ref)
utils.setSystemMap()
builders.address(type, props)
builders.appointment(type, props)
builders.contactPoint(type, props)
builders.encounter(type, props)
builders.extension(type, props)
builders.healthcareService(type, props)
builders.humanName(type, props)
builders.location(type, props)
builders.medicationAdministration(type, props)
builders.observation(type, props)
builders.organization(type, props)
builders.patient(type, props)
builders.practitioner(type, props)
builders.practitionerRole(type, props)
builders.relatedPerson(type, props)
builders.schedule(type, props)
builders.slot(type, props)

This adaptor exports the following from common:

cursor()
dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
lastReferenceValue()
merge()
sourceValue()

utils

These functions belong to the utils namespace.

utils.addExtension

addExtension(resource, url, value)

Add an extension to a resource (or object). An object will be created and added to an extension array on the provided resource. The extension array will be set if it does not exist on the resource. The value will be smartly written to the object, ie, valueDateTime or valueReference or valueString

ParamTypeDescription
resourcea FHIR resource object to add an extension too
urlstringthe URL to set for the extension
valuethe value that the extension should contain

utils.cc

cc()

Alias for util.concept()


utils.coding

coding(code, system)

Create a coding object { code, system }. Systems will be mapped using the system map.

ParamTypeDescription
codestringthe code value
systemstringURL to the system. Well be mapped using the system map.

utils.composite

composite(object, key, value)

Write a value to the target object using a typed key Ie, if key is value and the value is a date time string, this function will write valueDateTime to the object.

This function is poorly named.

ParamTypeDescription
objectthe object to write the composite key to
keystringthe base key to use to write the value
valuesome value to write to the object

utils.concept

concept()

Create a codeableConcept. Codings can be coding objects or [code, system] tuples if the first argument is a string, it will be set as the text. Systems will be mapped with the system map

Example: <Create a codeableConcept

const myConcept = util.concept(['abc', 'http://moh.gov.et/fhir/hiv/identifier/SmartCareID'])
* @example <caption><Create a codeableConcept with text</caption>
const myConcept = util.concept('smart care id', ['abc', 'http://moh.gov.et/fhir/hiv/identifier/SmartCareID'])

utils.findExtension

findExtension(obj, targetUrl, [path])

Find an extension with a given url in some array

ParamTypeDescription
obja fhir resource
targetUrlstringthe extension URL you want to find
[path]stringa path to extract from the resource. Optional.

utils.id

id()

Alias for util.identifier()


utils.identifier

identifier(input, [system])

Create an identifier resource. Systems will be mapped against the system map. The input can be a string value, or an identifier object. If input is an array of identifiers, an array of mapped/parsed values will be returned.

ParamTypeDescription
inputan array of strings, or a identifier value as a string or object
[system]stringthe string system to use by default if

utils.ref

ref()

Alias for util.reference()


utils.reference

reference(ref)

Create a reference object of the form { reference } If ref is an array, each item will be mapped and an array returned. If ref is a FHIR resource, a reference to it will be generated If ref is a string, it'll be treated as a reference id and returned as an object If ref is a valid FHIR reference, it'll just be returned.

ParamDescription
refthe thing to generate a reference from

utils.setSystemMap

setSystemMap()

Define a set of mapped system values.

Builder functions will use this mappings when they encounter them in system keys. Useful for setting shortcuts.

Example: Set shortcut sustem mappings

util.setSystemMap({
SmartCareID: 'http://moh.gov.et/fhir/hiv/identifier/SmartCareID'
});
builders.patient('patient', { identifier: util.identifier('xyz', 'SmartCareId') })
};

builders

These functions belong to the builders namespace.

builders.address

address(type, props)

Create a FHIR Address resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.appointment

appointment(type, props)

Create a FHIR Appointment resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.contactPoint

contactPoint(type, props)

Create a FHIR ContactPoint resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.encounter

encounter(type, props)

Create a FHIR Encounter resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.extension

extension(type, props)

Create a FHIR Extension resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.healthcareService

healthcareService(type, props)

Create a FHIR HealthcareService resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.humanName

humanName(type, props)

Create a FHIR HumanName resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.location

location(type, props)

Create a FHIR Location resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.medicationAdministration

medicationAdministration(type, props)

Create a FHIR MedicationAdministration resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.observation

observation(type, props)

Create a FHIR Observation resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.organization

organization(type, props)

Create a FHIR Organization resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.patient

patient(type, props)

Create a FHIR Patient resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.practitioner

practitioner(type, props)

Create a FHIR Practitioner resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.practitionerRole

practitionerRole(type, props)

Create a FHIR PractitionerRole resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.relatedPerson

relatedPerson(type, props)

Create a FHIR RelatedPerson resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.schedule

schedule(type, props)

Create a FHIR Schedule resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource

builders.slot

slot(type, props)

Create a FHIR Slot resource.

ParamTypeDescription
typestringThe profile id for the resource variant
propsProperties to apply to the resource