Patient de-identification Process API - Implementation Template

(0 reviews)

Developer guide

This document provides information generated from the DataWeave scripts included in the project, such as function definitions, variable definitions, and data mapping tables.

ModuleDescription
createDeIdentifiedResourcesThis module defines functions that are used to generate De-Identified resources based on original resource, rules, and De-Identified Resource IDs. This module require changes if any new fields need to be included in a specific resource.
fhirToolsThis module defines a number of common functions that are used to generate De-Identified values for the fields of a resource based on original value and Rule. Introducing new rules may require modifications to the functions.
export-config-request-to-db-mappingCreate an Export Configuration
export-config-get-response-mappingReturns Transaction Details along with Export Configuration details for a specific Export Configuration

createDeIdentifiedResources

This module defines functions that are used to generate De-Identified resources
based on original resource, rules, and De-Identified Resource IDs.
This module require changes if any new fields need to be included in a specific
resource.

Source: ./src/main/resources/dwl/createDeIdentifiedResources.dwl

Variables

var observationResourceType

Variable to hold the Resource Types that has Observation, used for filtering references

var patientResourceType

Variable to hold the Resource Types that has Patient, used for filtering references

var supportedResourceTypes

Variable to hold the supported Resource Types, used for filtering references

Functions

fun getPatientBirthDate (item, format)

This function takes a patient object that need to be De-Identified and validates the age to produced a De-Identified date of birth.

param item Patient object that need to be De-Identified.
param format date format to be used to produce De-Identified date of birth.
return datetime which is the De-Identified date of birth of the patient.

fun getDeIdentifiedContainedResources (containedArray, muleIds, rules, resourceTypes, zipCodeToPopulation)

This function takes an array of resources to De-Identify and returns an array of De-Identified resources based on rules,supported resource types and De-Identified resource ids. This function is mainly used to De-Identify the resources in the 'contained' field of the top level resource.

param containedArray an array of resources that are to be De-Identified from the contained field.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
param rules an array of rules to apply to De-Identify the resource.
param resourceTypeArray an array of resource types that are to be retained if reference exists.
return resource Array with De-Identified objects.

fun createDeIdentifiedPatient (data, muleIds, rules, zipCodeToPopulation, metaTag)

This function takes a Patient Resource Object to De-Identify and returns the De-Identified resources based on rules and De-Identified resource ids provided. Only a specific set of fields are retained in the De-Identified object.

param data Patient resource object that is to be De-Identified.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
param rules an array of rules to apply to De-Identify the resource.
param zipCodeToPopulation an array of Zip Codes and population to De-Identify Zip Codes based on rules.
param metaTag a tag applied to search De-Identified resources based on export configuration id.

Field NameType(s)MinMaxDefault retain in the outputUser determinedOptions presented to userComments
Patient.idid01YESNOThe application will generate a unique ID for each FHIR resource instance and substitute the source system resource identifier with it. Both the source system and the application-generated resource instance identifiers will be stored in a data store
Patient.implicitRulesuri01NONOIf implicitRules are detected; the application will not process the record and log that it was not processed
Patient.containedResource0*YESNORetained if the reference to the contained resource is retained
Patient.modifierExtensionExtension0*NONOIf modifierExtensions are detected; the application will not process the record and log that it was not processed
Patient.activeboolean01YESNOActual value will be returned
Patient.gendercode01YESNOActual value will be returned
Patient.birthDatedate01NOYESKeep the birthdate in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
4. YYYY-MM-DD
If the patient age is 89 or older then default to 90 years and set the year accordingly
Patient.deceased[x]boolean dateTime01NOYESKeep the deceased date in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
4. YYYY-MM-DD
5. YYYY-MM-DDThh:mm:ss+zz:zz
Patient.addressAddress0*NOYESKeep the address or geographic identifiers in output?
1. Do not retain
2. Truncate to the first 3 characters of zip code
3. Truncate to the first 5 characters of zip code
4. Do not truncate
If postal code is not found or population is less than 20K include default capability to modify output to 000 or 00000 or 00000-0000
Patient.maritalStatusCodeableConcept01NOYESKeep the marital status in output?
1. Do not retain
2. Yes
Patient.multipleBirth[x]boolean integer01NOYESKeep multiple birth information in output?
1. Do not retain
2. Convert to boolean if numeric
3. Yes
Patient.communication.languageCodeableConcept11NOYESKeep patient language in output?
1. Do not retain
2. Yes

fun createDeIdentifiedCondition (data, muleIds, rules, zipCodeToPopulation, metaTag)

This function takes a Condition Resource Object to De-Identify and returns the De-Identified resources based on rules and De-Identified resource ids provided. Only a specific set of fields are retained in the De-Identified object.

param data Condition resource object that is to be De-Identified.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
param rules an array of rules to apply to De-Identify the resource.
param zipCodeToPopulation an array of Zip Codes and population to De-Identify Zip Codes based on rules.
param metaTag a tag applied to search De-Identified resources based on export configuration id.
return Condition resource object with De-Identified fields based on rules.

Field NameType(s)MinMaxDefault retain in the outputUser determinedOptions presented to userComments
Condition.idid01YESNOThe application will generate a unique ID for each FHIR resource instance and substitute the source system resource identifier with it. Both the source system and the application-generated resource instance identifiers will be stored in a data store
Condition.implicitRulesuri01NONOIf Application detects implicitRules; it will not process the record and log that it was not processed
Condition.containedResource0*YESNORetained if the reference to the contained resource is retained
Condition.modifierExtensionExtension0*NONOIf modifierExtensions are detected; the application will not process the record and log that it was not processed
Condition.clinicalStatusCodeableConcept11YESNOCodeableConcept.text is removed
Condition.verificationStatusCodeableConcept01YESNOCodeableConcept.text is removed
Condition.categoryCodeableConcept0*YESNOCodeableConcept.text is removed
Condition.severityCodeableConcept01YESNOCodeableConcept.text is removed
Condition.codeCodeableConcept01NOYESFilter by condition codes
1. Include all conditions
2. Filter by selected codes
CodeableConcept.text is removed; If the condition code filter yields no results then do not process the condition resource instance itself. Assumptions: If the source record does not include system and code then filter the condition resource instance.
Condition.bodySiteCodeableConcept0*YESNOCodeableConcept.text is removed
Condition.bodyStructureReference(BodyStructure)01NOYESKeep the Body Structure details in output?
1. Do not retain
2. Retain
Condition.subjectReference(Patient or Group)11YESNOOnly need to support Patient and not Group
Condition.onset[x]dateTime01NOYESKeep the condition onset date in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
4. YYYY-MM-DD
5. YYYY-MM-DDThh:mm:ss+zz:zz
Condition.onset[x]Age01YESNOActual value will be returned
Condition.onset[x]Period01NOYESKeep the condition onset period in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
Condition.onset[x]Range01NOYESKeep the condition onset range in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
Condition.abatement[x]dateTime01NOYESKeep the condition abatement date in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
4. YYYY-MM-DD
5. YYYY-MM-DDThh:mm:ss+zz:zz
Condition.abatement[x]Age01YESNOActual value will be returned
Condition.abatement[x]Period01NOYESKeep the condition abatement period in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
Condition.abatement[x]Range01NOYESKeep the condition abatement range in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
Condition.recordedDatedateTime01NOYESKeep the condition recorded date in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
4. YYYY-MM-DD
5. YYYY-MM-DDThh:mm:ss+zz:zz
Condition.stageBackboneElement0*YESNOActual value will be returned
Condition.stage.summaryCodeableConcept01YESNOCodeableConcept.text is removed
Condition.stage.typeCodeableConcept01YESNOCodeableConcept.text is removed

fun createDeIdentifiedObservation (data, muleIds, rules, zipCodeToPopulation, metaTag)

This function takes a Observation Resource Object to De-Identify and returns the De-Identified resources based on rules and De-Identified resource ids provided. Only a specific set of fields are retained in the De-Identified object.

param data Observation resource object that is to be De-Identified.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
param rules an array of rules to apply to De-Identify the resource.
param zipCodeToPopulation an array of Zip Codes and population to De-Identify Zip Codes based on rules.
param metaTag a tag applied to search De-Identified resources based on export configuration id.
return Observation resource object with De-Identified fields based on rules.

Field NameType(s)MinMaxDefault retain in the outputUser determinedOptions presented to userComments
Observation.idid01YESNOThe application will generate a unique ID for each FHIR resource instance and substitute the source system resource identifier with it. Both the source system and the application-generated resource instance identifiers will be stored in a data store
Observation.implicitRulesuri01NOYESIf implicitRules are detected; the application will not process the record and log that it was not processed
Observation.containedResource0*YESNORetained if the reference to the contained resource is retained
Observation.modifierExtensionExtension0*NOYESIf modifierExtensions are detected; the application will not process the record and log that it was not processed
Observation.statuscode11YESNOActual value will be returned
Observation.categoryCodeableConcept0*YESNOCodeableConcept.text is removed
Observation.codeCodeableConcept11YESNOCodeableConcept.text is removed
Observation.subjectReference(Patient or Group or Device or Location or Organization or Procedure or Practitioner or Medication or Substance or BiologicallyDerivedProduct or NutritionProduct)01YESNORetains the value when the Reference is a Patient
Observation.focusReference(Any)0*YESNORetains if Reference is to a supported resource (Patient or Condition or BodyStructure)
Observation.effective[x]dateTime01NOYESKeep the observation effective date in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
4. YYYY-MM-DD
5. YYYY-MM-DDThh:mm:ss+zz:zz
Observation.effective[x]Period01NOYESKeep the observation effective period in output? Options:
1. Do not retain
2. YYYY
3. YYYY-MM
Observation.effective[x]instant01NOYESKeep the observation effective instant in output? Options:
1. Do not retain
2. Retain
Observation.issuedinstant01NOYESKeep the observation issued instant in output? Options:
1. Do not retain
2. Retain
Observation.value[x]Quantity
CodeableConcept
string
boolean
integer
Range
Ratio
SampledData
time
dateTime
Period
Attachment
Reference(MolecularSequence)
01YESNOActual value will be returned
Observation.dataAbsentReasonCodeableConcept01YESNOCodeableConcept.text is removed
Observation.interpretationCodeableConcept0*YESNOCodeableConcept.text is removed
Observation.bodySiteCodeableConcept01YESNOCodeableConcept.text is removed
Observation.bodyStructureReference(BodyStructure)01YESNOActual value will be returned
Observation.methodCodeableConcept01YESNOCodeableConcept.text is removed
Observation.referenceRangeBackboneElement0*YESNOActual value will be returned
Observation.referenceRange.lowQuantity {SimpleQuantity}01YESNOActual value will be returned
Observation.referenceRange.highQuantity {SimpleQuantity}01YESNOActual value will be returned
Observation.referenceRange.normalValueCodeableConcept01YESNOCodeableConcept.text is removed
Observation.referenceRange.typeCodeableConcept01YESNOCodeableConcept.text is removed
Observation.referenceRange.appliesToCodeableConcept0*YESNOCodeableConcept.text is removed
Observation.referenceRange.ageRange01YESNOActual value will be returned
Observation.hasMemberReference(Observation or QuestionnaireResponse or MolecularSequence)0*YESNORetains if a Reference is to a supported resource (currently just Observation)
Observation.derivedFromReference(DocumentReference or ImagingStudy or ImagingSelection or QuestionnaireResponse or Observation or MolecularSequence or GenomicStudy)0*YESNORetains if a Reference is to a supported resource (currently just Observation)
Observation.componentBackboneElement0*YESNOActual value will be returned
Observation.component.codeCodeableConcept11YESNOCodeableConcept.text is removed

fun getBodyStructure (bodyStructure, muleIds, rules, metaTag)

This function takes a BodyStructure Resource Object to De-Identify and returns the De-Identified resources based on rules and De-Identified resource ids provided. Fields in Body Structure vary from FHIR R4 and R5 versions and both scenarios are handled. Only a specific set of fields are retained in the De-Identified object.

param bodyStructure BodyStructure resource object that is to be De-Identified.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
param rules an array of rules to apply to De-Identify the resource.
param zipCodeToPopulation an array of Zip Codes and population to De-Identify Zip Codes based on rules.
param metaTag a tag applied to search De-Identified resources based on export configuration id.
return BodyStructure resource object with De-Identified fields based on rules.

Field NameType(s)MinMaxDefault retain in the outputUser determinedOptions presented to userComments
BodyStructure.idid01YESNOThe application will generate a unique ID for each FHIR resource instance and substitute the source system resource identifier with it. Both the source system and the application-generated resource instance identifiers will be stored in a data store
BodyStructure.implicitRulesuri01NONOIf implicitRules are detected; the application will not process the record and log that it was not processed
BodyStructure.modifierExtensionExtension0*NONOIf modifierExtensions are detected; the application will not process the record and log that it was not processed
BodyStructure.activeboolean01YESNOActual value will be returned
BodyStructure.includedStructureBackboneElement1*YESNOActual value will be returned
BodyStructure.includedStructure.structureCodeableConcept11YESNOActual value will be returned
BodyStructure.includedStructure.lateralityCodeableConcept01YESNOActual value will be returned
BodyStructure.patientReference(Patient)11YESNOActual value will be returned

fun getIncludedStructure (includedStructure)

This function takes a includedStructure field of BodyStructure Resource Object to De-Identify and returns the De-Identified structure and laterality fields.

param includedStructure includedStructure object of BodyStructure resource object that is to be De-Identified.
return includedStructure resource object with De-Identified fields.

(back to top)

fhirTools

This module defines a number of common functions that are used to generate
De-Identified values for the fields of a resource based on original value and Rule.
Introducing new rules may require modifications to the functions.

Source: ./src/main/resources/dwl/fhirTools.dwl

Functions

fun getRuleValue (rules, name)

This function takes an array of rules and name of the rule to filter the value to apply.

param rules an array of rules defined as a name and value object.
param name filters the value based on the matched name from the rules.
return The value of the corresponding rule that matched the name.

fun getDeIdentifiedCodeableConcept (data)

This function takes an array or object of CodeadbaleConcept and returns a De-Identified CodeadbaleConcept.

param data an array or object of CodeadbaleConcept to De-Identify.
return CodeadbaleConcept array or object that has been De-Identified.

fun getDeIdentifiedCodeableConceptFiltered (data, format)

This function takes an array of CodeadbaleConcept along with a string of of filters (system|code) csv to and returns a filtered De-Identified CodeadbaleConcept that matches the filters.

param data an array or object of CodeadbaleConcept to De-Identify.
param format string data in format of (system|code) csv to match and retain.
return CodeadbaleConcept array that has been De-Identified.

fun getDeIdentifiedDateTime (dateTime, format)

This function takes date and time along with a string to format as De-Identified date and time.

param dateTime Date and Time to De-Identify.
param format string format of date and time to retain.
return dateTime De-Identified date and time based on format.

fun getDeIdentifiedPostalCode (postalCode, format, zipCodeToPopulation)

This function takes postal code along with a string to format as De-Identified postal code.

param postalCode postal code to De-Identify.
param format string format of postal code to retain.
param zipCodeToPopulation an array of Zip Codes and population to De-Identify Zip Codes based on rules.
return postalCode De-Identified postal code based on format.

fun getDeIdentifiedMaritalStatus (maritalStatus, format)

This function takes marital status along with a string to format as De-Identified marital status.

param maritalStatus marital status to De-Identify.
param format string format of date and time to retain.
return maritalStatus De-Identified marital status on format.

fun getDeIdentifiedBoolean (bool, format)

This function takes a boolean along with a string to format as De-Identified boolean status.

param bool boolean to De-Identify.
param format string format of date and time to retain.
return boolean De-Identified boolean on format.

fun filterNoImplictRulesandModifiedExtension (data)

This function takes an array of resources and ignores any resource that has implicitRules or modifiedExtension fields. It returns an array of filtered resources.

param data an array of resources.
return data an array of filtered resources.

fun getDeIdentifiedReferencesArray (referencesArray, resourceTypeArray, muleIds)

This function takes an array of references that needs to be De-Identified along with an array of resource types to retain and an object that holds resource IDs that are De-Identified. The De-Identified ids are used for mapping references. If there is no De-Identified id for a given resource, the reference is null and will be excluded from the list.

param referencesArray an array of references that are to be De-Identified.
param resourceTypeArray an array of resource types that are to be retained if reference exists.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
return references array that is De-Identified.

fun getDeIdentifiedReferenceObject (referenceObj, resourceTypeArray, muleIds)

This function takes a reference object that needs to be De-Identified along with an array of resource types to retain and an object that holds resource IDs that are De-Identified. The De-Identified ids are used for mapping references. If there is no De-Identified id for a given resource, the reference is not returned.

param referencesArray an array of references that are to be De-Identified.
param resourceTypeArray an array of resource types that are to be retained if reference exists.
param muleIds an object that has IDs of resources as a key and De-Identified IDs as value.
return references object that is De-Identified.

(back to top)

export-config-request-to-db-mapping

Create an Export Configuration

Source: ./src/main/resources/dwl/export-config-request-to-db-mapping.dwl

Mapping Tables

Create an Export Configuration. Mapping from API Field to DB field to create an Export Configuration

API FieldDB Field NameDescription
nameNAMEName of the Export Configuration
descriptionDESCRIPTIONDescription about Export Configuration
resourcesRESOURCESResources that need to be exported from EHR.
fhirGroupIdFHIR_GROUP_IDGroup Id of EHR Bulk Export
earliestRecordDateEARLIEST_RECORD_DATEData to be retrieved from EHR Bulk export APIS using sinceDate
frequencyFREQUENCYFrequency when the Job should run based on Export Configuration
dayOfWeekDAY_OF_WEEKDay of the week when the Job should run based on Export Configuration
weekOfMonthWEEK_OF_MONTHWeek of the month when the Job should run based on Export Configuration
statusSTATUSStatus of the Job based on the Export Configuration.
rulesRULESJSON Array that hold the ruleName and rule Values for Export Configuration
isDeletedIS_DELETEDSoft deletion of Export Configuration

(back to top)

export-config-get-response-mapping

Returns Transaction Details along with Export Configuration details for a specific Export Configuration

Source: ./src/main/resources/dwl/export-config-get-response-mapping.dwl

Mapping Tables

Returns Transaction Details along with Export Configuration details for a specific Export Configuration

API FieldDB Field NameDescription
idIDUnique Auto Generated Id of the Export Configuration
nameNAMEName of the Export Configuration
descriptionDESCRIPTIONDescription about Export Configuration
resourcesRESOURCESResources that need to be exported from EHR.
fhirGroupIdFHIR_GROUP_IDGroup Id of EHR Bulk Export
earliestRecordDateEARLIEST_RECORD_DATEData to be retrieved from EHR Bulk export APIS using sinceDate
lastRunEndTimeLAST_RUNLast Successful Job Run based on Export Configuration
frequencyFREQUENCYFrequency when the Job should run based on Export Configuration
dayOfWeekDAY_OF_WEEKDay of the week when the Job should run based on Export Configuration
weekOfMonthWEEK_OF_MONTHWeek of the month when the Job should run based on Export Configuration
statusSTATUSStatus of the Job based on the Export Configuration.
rulesRULESJSON Array that hold the ruleName and rule Values for Export Configuration
isDeletedIS_DELETEDSoft deletion of Export Configuration
createdDateTimeCREATED_DATEDate when the Export Configuration has been created
runHistoryJOB_ENDOnly last 10 records with status as completed will be returned
initialSucessfulRunTimeJOB_ENDMapped with first record that has completed status for the Export Configuration Id

(back to top)


Reviews

TypeTemplate
OrganizationMulesoft Inc.
Published by
MuleSoft Solutions
Published onMay 30, 2024
Asset overview

Asset versions for 1.0.x

Asset versions
VersionActions
1.0.0