Stream: implementers
Topic: Storing exception codes
Andrew Broadbent (Nov 20 2017 at 16:32):
Hi there,
I'm not sure which is the best stream to ask this, but I am implementing my own storage mechanism in fhir, and I'm trying to work out the best way to deal with some data my users have questioned me about.
The system I work on reads csv data and transforms it into fhir, such that each observation in the csv becomes one fhir resource. I've made up an example here which is less convoluted than the actual case I'm trying to fix:
I have a csv file provided which contains identifiers and date of birth for various patients. In the column for DOB, they occasionally have a code for missing, the problem is that they have multiple classifications for missing (e.g. certificate destroyed, Not given, Unknown). They would like to keep these orders of missing, rather than just mapping everything to null, as it's more informative to the analysts. The problem I'm having is that in this case, DOB is a date, whilst the missing values are instances of code/coding/codeableconcept (yet to decide), meaning that I can't store them at Patient.birthDate. I know I can create an extension for patient which stores this information, but because of the nature of where I read my data, any column of the csv file could contain exception codes like this, therefore any address in the fhir resource could be an exception code. This would mean that my extension would also need to contain the xpath of the property.
Is there a better approach to this? My main problem with this approach is that it's a lot of indirection when I come to export the data (the program looks in the resource for the element it wants, if it's null, it then has to look through all extensions until it finds one with a corresponding xpath), I'm pretty worried about the performance of modelling it like this, as a typical data extract for me contains in the region of millions to billions of resources.
Igor Sirkovich (Nov 20 2017 at 16:55):
@Andrew Broadbent, you might consider using a FHIR Data Absent Reason extension: http://www.hl7.org/fhir/extension-data-absent-reason.html
Andrew Broadbent (Nov 20 2017 at 17:04):
@Igor Sirkovich Is there any chance you could provide a basic example of its usage? I'm not really clear on how you relate it to the property which is missing.
Igor Sirkovich (Nov 20 2017 at 17:04):
If you are using JSON, have a look at http://www.hl7.org/fhir/json.html#primitive to see how to handle extensions on the primitive data types (e.g. date)
Igor Sirkovich (Nov 20 2017 at 17:06):
For example, if you don't know DoB, in JSON, you might have
"_birthDate": {
"extension" : [ {
"url" : "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode" : "not-asked"
}]
Igor Sirkovich (Nov 20 2017 at 17:07):
In XML, this would be
<birthDate>
<extension url="http://hl7.org/fhir/ValueSet/data-absent-reason">
<valueCode value="not-asked"/>
</extension>
</birthDate>
Igor Sirkovich (Nov 20 2017 at 17:09):
Since the binding to the Value Set (http://www.hl7.org/fhir/valueset-data-absent-reason.html) is required, but might not satisfy your requirements, you might need to define your own extension, which would be similar to this standar one, but will bind to your own terminology.
Andrew Broadbent (Nov 20 2017 at 17:10):
Oh! I did not realise that dates (and other types) could be extended themselves, ok that makes more sense now.
Andrew Broadbent (Nov 22 2017 at 13:28):
I think this is more of a hapi issue, I've posted a separate discussion in there, but it's worth a try here.
When I upload a resource that contains a birth date like @Igor Sirkovich suggested to a hapi database, it is accepted, but when I request the resource back, the birth date is missing. This is the same functionality of when I upload a property with a null value (and no extension). I'm assuming that hapi trims all properties which have a null value?
Andrew Broadbent (Nov 22 2017 at 13:29):
Not sure if this might be a question for @James Agnew
James Agnew (Nov 22 2017 at 15:33):
@Andrew Broadbent This should absolutely work.. I just had a look with the example you emailed me though and I see the same behaviour you do
One sec, let me try in a unit test
James Agnew (Nov 23 2017 at 02:09):
This has been fixed.
Andrew Broadbent (Nov 23 2017 at 14:56):
Thanks @James Agnew Can I just confirm what version it was fixed in? I'm running 2.6-snapshot of the jpa-example-server.
Andrew Broadbent (Nov 23 2017 at 15:34):
I've just pulled latest from the hapi-fhir repo. I'm running 3.0.0, after uploading the following, I get this back:
<Patient xmlns="http://hl7.org/fhir">
<extension url="https://purl.org/elab/fhir/network/StructureDefinition/1/BirthWeight">
<valueDecimal>
<extension url="http://www.hl7.org/fhir/extension-data-absent-reason.html">
<valueCoding>
<system value="http://hl7.org/fhir/ValueSet/birthweight"/>
<code value="Underweight"/>
<userSelected value="false"/>
</valueCoding>
</extension>
</valueDecimal>
</extension>
<identifier>
<system value="https://purl.org/elab/fhir/network/StructureDefinition/1/EuroPrevallStudySubjects"/>
<value value="1"/>
</identifier>
<gender value="female"/>
</Patient>
{
"resourceType": "Patient",
"id": "187",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>1</td></tr></tbody></table></div>"
},
"extension": [
{
"url": "https://purl.org/elab/fhir/network/StructureDefinition/1/BirthWeight"
}
],
"identifier": [
{
"system": "https://purl.org/elab/fhir/network/StructureDefinition/1/EuroPrevallStudySubjects",
"value": "1"
}
],
"gender": "female"
}
It still seems to be missing the actual contents of the extension in 3.0.0?
Last updated: Apr 12 2022 at 19:14 UTC