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
Param | Type | Description |
---|---|---|
resource | a FHIR resource object to add an extension too | |
url | string | the URL to set for the extension |
value | the 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.
Param | Type | Description |
---|---|---|
code | string | the code value |
system | string | URL 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.
Param | Type | Description |
---|---|---|
object | the object to write the composite key to | |
key | string | the base key to use to write the value |
value | some 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
Param | Type | Description |
---|---|---|
obj | a fhir resource | |
targetUrl | string | the extension URL you want to find |
[path] | string | a 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.
Param | Type | Description |
---|---|---|
input | an array of strings, or a identifier value as a string or object | |
[system] | string | the 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.
Param | Description |
---|---|
ref | the 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.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.appointment
appointment(type, props)
Create a FHIR Appointment resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.contactPoint
contactPoint(type, props)
Create a FHIR ContactPoint resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.encounter
encounter(type, props)
Create a FHIR Encounter resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.extension
extension(type, props)
Create a FHIR Extension resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.healthcareService
healthcareService(type, props)
Create a FHIR HealthcareService resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.humanName
humanName(type, props)
Create a FHIR HumanName resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.location
location(type, props)
Create a FHIR Location resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.medicationAdministration
medicationAdministration(type, props)
Create a FHIR MedicationAdministration resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.observation
observation(type, props)
Create a FHIR Observation resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.organization
organization(type, props)
Create a FHIR Organization resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.patient
patient(type, props)
Create a FHIR Patient resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.practitioner
practitioner(type, props)
Create a FHIR Practitioner resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.practitionerRole
practitionerRole(type, props)
Create a FHIR PractitionerRole resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.relatedPerson
relatedPerson(type, props)
Create a FHIR RelatedPerson resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.schedule
schedule(type, props)
Create a FHIR Schedule resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |
builders.slot
slot(type, props)
Create a FHIR Slot resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant |
props | Properties to apply to the resource |