Commit f6e18eba authored by Sebastian Mate's avatar Sebastian Mate
Browse files

Add support for "bodySite" field in "Procedure" ressource

Update docu
parent b815200d
i2b2-FHIR-Trigger - Load incoming FHIR data into i2b2 schema via database triggers
\ No newline at end of file
i2b2-FHIR-Trigger - Load incoming FHIR data into i2b2 schema via database triggers
When executing this SQL code on an i2b2 database schema a "FHIR" table is created, which can be used to import FHIR data. Simply write the FHIR JSON to the "FHIR" table.
## Implementation Status
The SQL Trigger is aware of or processes the following FHIR resource types and assumes that these follow the MII (German Medical Informatic Initiative) modeling:
* Bundle: Is split into the distinct resource types below:
* Patient
* Encounter
* Condition
* Observation
* Immunization
* Consent
* Procedure
* Medication
* MedicationStatement
* ServiceRequest: is ignored, as it's not contributing useful data to be queried by i2b2.
* DiagnosticReport is ignored, as it's not contributing useful data to be queried by i2b2.
## Implementation Details
In general, `code.coding.code` and `code.coding.system` are used to generate the i2b2 concept code.
###Condition
Timestamps are derived from:
* `performedDateTime`
The following fields are used to generate i2b2 modifiers:
* `verificationStatus.coding.system` and `verificationStatus.coding.code`
* `extension.valueCodeableConcept.coding.system` and `extension.valueCodeableConcept.coding.code`
It does not process the fields:
* `clinicalStatus`
* `category`
* `stage`
###Observation
Timestamps are derived from:
* `performedDateTime`
* `effectiveDateTime`
Numeric values are derived from:
* `valueQuantity.value`
* `valueQuantity.unit`
The following fields are used to generate i2b2 modifiers:
* `valueCodeableConcept.coding.system` and `valueCodeableConcept.coding.code`
It does not yet process the fields:
* `category`
###Procedure
Timestamps are derived from:
* `performedDateTime`
The following fields are used to generate i2b2 modifiers:
* `bodySite.coding.system` and `bodySite.coding.code`
It does not yet process the fields:
* `category`
* `status`
......@@ -21,6 +21,7 @@
-- - For start_date and end_date, instead of now(), use '-infinity'::timestamptz if no timestamp could be determined
-- - Reimplementation of "Observation" resource processing to make it compatible with GECCO modeling
-- - Reimplementation of "Procedure" resource processing to make it compatible with GECCO modeling
-- 2021-02-01: - Add support for "bodySite" field in "Procedure" ressource
-- ============= Create Basic Tables =============
......@@ -578,7 +579,10 @@ begin
'FHIR', -- provider_id
case when fhir_data.performedDateTime is not null then fhir_data.performedDateTime
else '-infinity'::timestamptz end, -- start_date
'@', -- modifier_cd
case when fhir_data.bodySite_coding_system is not null
then i2b2miracum.get_system_abbrv(fhir_data.bodySite_coding_system) || ':' || fhir_data.bodySite_coding_code
else '@'
end, -- modifier_cd
nextval('instance_num_seq'), -- instance_num
'@', -- valtype_cd
null, -- tval_char
......@@ -604,13 +608,18 @@ begin
(fhir2->>'id')::text as ID,
performedDateTime,
code_coding_code,
code_coding_system
code_coding_system,
bodySite_coding_code,
bodySite_coding_system
from FhirTempTable
left join (select (fhir2->>'performedDateTime')::timestamp as performedDateTime
from FhirTempTable) as sq1 on true
left join (select jsonb_array_elements(fhir->'code'->'coding')->>'code' as code_coding_code,
jsonb_array_elements(fhir->'code'->'coding')->>'system' as code_coding_system
from FhirTempTable) as sq2 on true
left join (select jsonb_array_elements(jsonb_array_elements(fhir->'bodySite')->'coding')->>'code' as bodySite_coding_code,
jsonb_array_elements(jsonb_array_elements(fhir->'bodySite')->'coding')->>'system' as bodySite_coding_system
from FhirTempTable) as sq3 on true
) fhir_data;
end if;
--
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment