fhir-4@0.1.9
- addToBundle(resources, [name])
- create(resource)
- delete(reference)
- read(reference)
- search(resourceType, options)
- update(reference, resource)
- uploadBundle(bundle)
This adaptor exports the following namespaced functions:
- builders.account(type, props)
- builders.activityDefinition(type, props)
- builders.administrableProductDefinition(type, props)
- builders.adverseEvent(type, props)
- builders.allergyIntolerance(type, props)
- builders.appointment(type, props)
- builders.appointmentResponse(type, props)
- builders.biologicallyDerivedProduct(type, props)
- builders.bodyStructure(type, props)
- builders.carePlan(type, props)
- builders.careTeam(type, props)
- builders.chargeItem(type, props)
- builders.chargeItemDefinition(type, props)
- builders.citation(type, props)
- builders.claim(type, props)
- builders.claimResponse(type, props)
- builders.clinicalImpression(type, props)
- builders.clinicalUseDefinition(type, props)
- builders.communication(type, props)
- builders.communicationRequest(type, props)
- builders.contract(type, props)
- builders.coverage(type, props)
- builders.coverageEligibilityRequest(type, props)
- builders.coverageEligibilityResponse(type, props)
- builders.detectedIssue(type, props)
- builders.device(type, props)
- builders.deviceDefinition(type, props)
- builders.deviceMetric(type, props)
- builders.deviceRequest(type, props)
- builders.deviceUseStatement(type, props)
- builders.diagnosticReport(type, props)
- builders.domainResource(type, props)
- builders.encounter(type, props)
- builders.enrollmentRequest(type, props)
- builders.enrollmentResponse(type, props)
- builders.episodeOfCare(type, props)
- builders.eventDefinition(type, props)
- builders.evidence(type, props)
- builders.evidenceReport(type, props)
- builders.evidenceVariable(type, props)
- builders.explanationOfBenefit(type, props)
- builders.familyMemberHistory(type, props)
- builders.flag(type, props)
- builders.goal(type, props)
- builders.group(type, props)
- builders.guidanceResponse(type, props)
- builders.healthcareService(type, props)
- builders.imagingStudy(type, props)
- builders.immunization(type, props)
- builders.immunizationEvaluation(type, props)
- builders.immunizationRecommendation(type, props)
- builders.ingredient(type, props)
- builders.insurancePlan(type, props)
- builders.invoice(type, props)
- builders.library(type, props)
- builders.list(type, props)
- builders.location(type, props)
- builders.manufacturedItemDefinition(type, props)
- builders.measure(type, props)
- builders.measureReport(type, props)
- builders.media(type, props)
- builders.medication(type, props)
- builders.medicationAdministration(type, props)
- builders.medicationDispense(type, props)
- builders.medicationKnowledge(type, props)
- builders.medicationRequest(type, props)
- builders.medicationStatement(type, props)
- builders.medicinalProductDefinition(type, props)
- builders.molecularSequence(type, props)
- builders.nutritionOrder(type, props)
- builders.nutritionProduct(type, props)
- builders.observation(type, props)
- builders.observationDefinition(type, props)
- builders.organization(type, props)
- builders.organizationAffiliation(type, props)
- builders.packagedProductDefinition(type, props)
- builders.patient(type, props)
- builders.paymentNotice(type, props)
- builders.paymentReconciliation(type, props)
- builders.person(type, props)
- builders.planDefinition(type, props)
- builders.practitioner(type, props)
- builders.practitionerRole(type, props)
- builders.procedure(type, props)
- builders.questionnaire(type, props)
- builders.questionnaireResponse(type, props)
- builders.regulatedAuthorization(type, props)
- builders.relatedPerson(type, props)
- builders.requestGroup(type, props)
- builders.researchDefinition(type, props)
- builders.researchElementDefinition(type, props)
- builders.researchStudy(type, props)
- builders.researchSubject(type, props)
- builders.riskAssessment(type, props)
- builders.schedule(type, props)
- builders.serviceRequest(type, props)
- builders.slot(type, props)
- builders.specimen(type, props)
- builders.specimenDefinition(type, props)
- builders.substance(type, props)
- builders.substanceDefinition(type, props)
- builders.supplyDelivery(type, props)
- builders.supplyRequest(type, props)
- builders.task(type, props)
- builders.testReport(type, props)
- builders.verificationResult(type, props)
- builders.visionPrescription(type, props)
- datatypes.addExtension(resource, url, value)
- datatypes.cc()
- datatypes.coding(code, system)
- datatypes.composite(object, key, value)
- datatypes.concept(value, extra)
- datatypes.ext()
- datatypes.extension(url, value, props)
- datatypes.findExtension(obj, targetUrl, [path])
- datatypes.id()
- datatypes.identifier(id, ext, [system])
- datatypes.ref()
- datatypes.reference(ref)
- datatypes.setSystemMap()
Functions
addToBundle
addToBundle(resources, [name]) ⇒
Add a resource to a bundle on state, using the name
as the key (or bundle
by default).
The resource will be upserted (via PUT).
A new bundle will be generated if one does not already exist.
Returns: Operation
Param | Type | Description |
---|---|---|
resources | object/array | A resource or array of resources to add to the bundle |
[name] | string | A name (key) for this bundle on state (defaults to bundle ) |
This operation writes the following keys to state:
State Key | Description |
---|---|
bundle | the updated bundle |
Example: Add a new patient resource to the default bundle
addToBundle(b.patient($.patientDetails))
create
create(resource) ⇒
Create a new resource. The resource does not need to include an id. The created resource will be returned to state.data.
Returns: Operation
Param | Type | Description |
---|---|---|
resource | object | The resource to create. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the newly created resource. |
response | the HTTP response returned by the server. |
Example: Create a Patient with a builder function
create(b.patient({
name: { family: "Messi", given: "Lionel", use: "official" },
}))
delete
delete(reference) ⇒
Delete a single FHIR resource.
Returns: Operation
Param | Type | Description |
---|---|---|
reference | string | The type and ID of the resource to delete, eg, Patient/123 |
This operation writes the following keys to state:
State Key | Description |
---|---|
response | the HTTP response returned by the server. |
Example: Delete a single Patient resource
delete('Patient/12345')
read
read(reference) ⇒
Fetch a single FHIR resource.
Returns: Operation
Param | Type | Description |
---|---|---|
reference | string | The type and ID of the resource to read, eg, Patient/123 |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the newly updated resource, as returned by the server |
response | the HTTP response returned by the server. |
Example: Read a single Patient resource
read('Patient/12345')
search
search(resourceType, options) ⇒
Search for matching FHIR resources. Exclude _ from search parameters, and pass query terms on options.query.
Returns: Operation
Param | Type | Description |
---|---|---|
resourceType | string | The type of the resource to search for. |
options | object | Parameters, query and filter. |
[options.*] | object | Pass supported query parameters without underscore. See FHIR Search Summary. |
[options.query] | object | query terms to search for. These are appended to the query URL veratim.. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the newly updated resource, as returned by the server |
response | the HTTP response returned by the server. |
Example: Search with parameter and query term
search('Patient', {
lastUpdated: $.cursor,
count: 10,
query: { given: 'messi' },
})
Example: Search for patients with a given name containing "eve"
search('Patient', {
query: { 'given:contains': 'eve' },
})
update
update(reference, resource) ⇒
Update a resource. If the resource does not already exist, it will be created and state.response.statusCode
will be 201.
Otherwise, the existing resource will be replaced.
To partially update a resource, use patch()
.
Returns: Operation
Param | Type | Description |
---|---|---|
reference | string | The type and ID of the resource to update, eg, Patient/123 |
resource | object | The new version of this resource. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the newly updated resource, as returned by the server |
response | the HTTP response returned by the server. |
Example: Update a Patient with a builder function
update('Patient/123', b.patient({
id: 'Patient/123',
name: { family: "Messi", given: "Lionel", use: "official" },
}))
uploadBundle
uploadBundle(bundle) ⇒
Upload a bundle from state (created by addToBundle) as a transaction.
Returns: Operation
Param | Type | Description |
---|---|---|
bundle | string/object | A bundle object or name of a bundle on state |
Example: Upload the default bundle
uploadBundle()
Example: Create and a bundle with a custom name
addToBundle($.patients, 'patientsBundle')
uploadBundle('patientsBundle')
Example: Upload a bundle from state
uploadBundle($.patientsBundle)
builders
These functions belong to the builders namespace.
builders.account
account(type, props)
Create a FHIR Account resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant. Optional. |
props | object | Properties to apply to the resource (includes common and custom properties). |
[props.identifier] | Identifier | Account number |
[props.status] | string | active |
[props.type] | CodeableConcept | E.g. patient, expense, depreciation |
[props.name] | string | Human-readable label |
[props.subject] | Reference | The entity that caused the expenses |
[props.servicePeriod] | Period | Transaction window |
[props.coverage] | BackboneElement | The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account |
[props.owner] | Reference | Entity managing the Account |
[props.description] | string | Explanation of purpose/use |
[props.guarantor] | BackboneElement | The parties ultimately responsible for balancing the Account |
[props.partOf] | Reference | Reference to a parent Account |
builders.activityDefinition
activityDefinition(type, props)
Create a FHIR ActivityDefinition resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant. Optional. |
props | object | Properties to apply to the resource (includes common and custom properties). |
[props.url] | string | Canonical identifier for this activity definition, represented as a URI (globally unique) |
[props.identifier] | Identifier | Additional identifier for the activity definition |
[props.version] | string | Business version of the activity definition |
[props.name] | string | Name for this activity definition (computer friendly) |
[props.title] | string | Name for this activity definition (human friendly) |
[props.subtitle] | string | Subordinate title of the activity definition |
[props.status] | string | draft |
[props.experimental] | boolean | For testing purposes, not real usage |
[props.subject] | CodeableConcept | Reference | canonical | Type of individual the activity definition is intended for |
[props.date] | dateTime | Date last changed |
[props.publisher] | string | Name of the publisher (organization or individual) |
[props.contact] | ContactDetail | Contact details for the publisher |
[props.description] | markdown | Natural language description of the activity definition |
[props.useContext] | UsageContext | The context that the content is intended to support |
[props.jurisdiction] | CodeableConcept | Intended jurisdiction for activity definition (if applicable) |
[props.purpose] | markdown | Why this activity definition is defined |
[props.usage] | string | Describes the clinical usage of the activity definition |
[props.copyright] | markdown | Use and/or publishing restrictions |
[props.approvalDate] | date | When the activity definition was approved by publisher |
[props.lastReviewDate] | date | When the activity definition was last reviewed |
[props.effectivePeriod] | Period | When the activity definition is expected to be used |
[props.topic] | CodeableConcept | E.g. Education, Treatment, Assessment, etc. |
[props.author] | ContactDetail | Who authored the content |
[props.editor] | ContactDetail | Who edited the content |
[props.reviewer] | ContactDetail | Who reviewed the content |
[props.endorser] | ContactDetail | Who endorsed the content |
[props.relatedArtifact] | RelatedArtifact | Additional documentation, citations, etc. |
[props.library] | canonical | Logic used by the activity definition |
[props.kind] | string | Kind of resource |
[props.profile] | canonical | What profile the resource needs to conform to |
[props.code] | CodeableConcept | Detail type of activity |
[props.intent] | string | proposal |
[props.priority] | string | routine |
[props.doNotPerform] | boolean | True if the activity should not be performed |
[props.timing] | Timing | dateTime | Age | Period | Range | Duration | When activity is to occur |
[props.location] | Reference | Where it should happen |
[props.participant] | BackboneElement | Who should participate in the action |
[props.product] | Reference | CodeableConcept | What's administered/supplied |
[props.quantity] | Quantity | How much is administered/consumed/supplied |
[props.dosage] | Dosage | Detailed dosage instructions |
[props.bodySite] | CodeableConcept | What part of body to perform on |
[props.specimenRequirement] | Reference | What specimens are required to perform this action |
[props.observationRequirement] | Reference | What observations are required to perform this action |
[props.observationResultRequirement] | Reference | What observations must be produced by this action |
[props.transform] | canonical | Transform to apply the template |
[props.dynamicValue] | BackboneElement | Dynamic aspects of the definition |
builders.administrableProductDefinition
administrableProductDefinition(type, props)
Create a FHIR AdministrableProductDefinition resource.
Param | Type | Description |
---|---|---|
type | string | The profile id for the resource variant. Optional. |
props | object | Properties to apply to the resource (includes common and custom properties). |
[props.identifier] | Identifier | An identifier for the administrable product |
[props.status] | string | draft |
[props.formOf] | Reference | References a product from which one or more of the constituent parts of that product can be prepared and used as described by this administrable product |
[props.administrableDoseForm] | CodeableConcept | The dose form of the final product after necessary reconstitution or processing |
[props.unitOfPresentation] | CodeableConcept | The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' |
[props.producedFrom] | Reference | Indicates the specific manufactured items that are part of the 'formOf' product that are used in the preparation of this specific administrable form |
[props.ingredient] | CodeableConcept | The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton, or using by incoming references from the Ingredient resource |
[props.device] | Reference | A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product |
[props.property] | BackboneElement | Characteristics e.g. a product's onset of action |
[props.routeOfAdministration] | BackboneElement | The path by which the product is taken into or makes contact with the body |