FHIR SDC (Structured Data Capture) Extension Helpers |
---|
This is an unofficial set of helper functions to ease working with the FHIR R4 Structured Data Capture Extensions in Javascript and TypeScript.
This pacakge leverages the npm pacakge fhir-extension-helpers
for extension wrangling.
Setting a specific SDC extension value (e.g. hidden)
import structuredDataCapture from 'fhir-sdc-helpers';
var item = { type: 'string', linkId: 's', text: 'Smile' };
structuredDataCapture.setHidden(item, true);
Reading a specific extension value
import structuredDataCapture from 'fhir-sdc-helpers';
// This item would usually be read from an existing questionnaire
var item = { type: 'string', linkId: 's', text: 'Smile', extension:[{url:"http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",valueBoolean:true}] };
var hidden = structuredDataCapture.getHidden(item);
console.log(hidden); // this will be a true|false|undefined(if the extension did not exist)
Removing a specific SDC extension
import exHelpers from 'fhir-extension-helpers';
import structuredDataCapture from 'fhir-sdc-helpers';
exHelpers.clearExtension(item, structuredDataCapture.exturl_Hidden); // removes the hidden extension from the item
TBD - there's not really much here... For questions and broader discussions, use the FHIR Implementers chat on Zulip.
I'm welcoming contributors from the FHIR community!