So model driven code creation is the way to go. As part of the FHIR release there are a set of technical artifacts for implementers which offer a massive leg up for those that wish to stick to completely model driven code generation. Have a look at ecoredefinitions.xml it can be used as the basis for getting this done - I am told this is an internal source, however, it has one of the big benefits of having all of the datatypes and resources specified.
Basically, to achieve my ends, I have tackled this generation in three parts (as defined by FHIR spec)
- Primitives : basic datatypes that map to XSD types in a nice way (and a mapping to C# types)
- Complex/Other Types : constructed types based on primitives for common
- Resources : the clinical/administrative data groups
So after some playing about I have my very rudimentary serialisable classes for dotNet 2.0 build in C#. Of course the first resource to put something into is 'Patient' and of course for this project it has to be Mr. Burns. XML and JSON formats below.
Next.....maybe see which resources are appropriate for my GP system mapping... and how well I can map the content....
Test Patient #1 XML <Patient xmlns="http://hl7.org/fhir"> <text> <status value="generated" /> <div xmlns="http://www.w3.org/1999/xhtml"><p>Burns, George M, 117y</p></div> </text> <active value="true" /> <details> <name> <use value="official" /> <family value="Burns" /> <given value="George" /> </name> <gender> <system value="http://hl7.org/fhir/sid/v2-0001" /> <code value="M" /> </gender> <birthDate value="1896-01-20" /> <deceased value="false" /> </details> <provider> <type value="Organization" /> <url value="../organisation/@1" /> </provider> </Patient>
Test Patient #1 JSON
{
"Patient": {
"text": {
"status": {
"value": "generated"
},
"div": {
"value": "<div><p>Burns, George M, 117y</p></div>"
}
},
"active": {
"value": true
},
"details": {
"name": [
{
"use": {
"value": "official"
},
"family": [
{
"value": "Burns"
}
],
"given": [
{
"value": "George"
}
]
}
],
"gender": {
"system": {
"value": "http://hl7.org/fhir/sid/v2-0001"
},
"code": {
"value": "M"
}
},
"birthDate": {
"value": "1896-01-20"
},
"deceased": {
"value": false
}
},
"provider": {
"type": {
"value": "Organization"
},
"url": {
"value": "../organisation/@1"
}
}
}
}
No comments:
Post a Comment