extract

suspend fun extract(questionnaire: Questionnaire, questionnaireResponse: QuestionnaireResponse, structureMapExtractionContext: StructureMapExtractionContext? = null, profileLoader: ProfileLoader? = null): Bundle

Extract FHIR resources from a questionnaire and questionnaireResponse.

This method will perform StructureMap-based extraction if the Questionnaire specified by questionnaire includes a targetStructureMap extension. In this case structureMapExtractionContext is required; extraction will fail and an empty Bundle is returned if structureMapExtractionContext is not provided.

Otherwise, this method will perform Definition-based extraction .

Return

Bundle containing the extracted Resources or empty Bundle if the extraction fails. An exception might also be thrown in a few cases

Parameters

questionnaire

A Questionnaire with data extraction extensions.

questionnaireResponse
structureMapExtractionContext

The IWorkerContext may be used along with StructureMapUtilities to parse the script and convert it into StructureMap.

Throws

when Resource getting extracted does conform different profile than standard FHIR profile and argument loadProfile callback Implementation is not provided to load different profile