Extension( ethnic-category) in Patient Resource Json Example [CC profile]

Hi All,

I am trying to read ethnic-category from extension from the patient fhir message (json) using HAPI Fhir STU3 library. I am unable to get the code from it. Following is the extension sample,
“extension”:[
{
“url”:“http://fhir.nhs.net/ValueSet/ethnic-category-1”,
“valueCodeableConcept”:{
“coding”:[
{
“system”:“http://fhir.nhs.net/ValueSet/ethnic-category-1”,
“code”:“A”,
“display”:“British, Mixed British”
}
],
“text”:“British, Mixed British”
}
},
{
“url”:“careManager”,
“valueReference”:{
“reference”:“Practitioner/54w5wwwfasdfd”,
“display”:“careManager”
}
}
],
is it valid content if so please share how can I get the code ‘A’ from this ?
I tried upto the followign
patient.getExtensionsByUrl(“http://fhir.nhs.net/ValueSet/ethnic-category-1”).get(0).getValue()

thanks in advance

Your code is nearly there.

for (Extension extension : 
 patient.getExtensionsByUrl(“http://fhir.nhs.net/ValueSet/ethnic-category-1”)) 
 {
     if (extension.getValue() instanceof CodeableConcept) {
               CodeableConcept concept = (CodeableConcept) extension.getValue();
               // etc
           }
  }

From a UK perspective the extension is wrong but not necessarily invalid though. You can chose to accept it but I’d recommend getting it corrected.

{
"extension": [
    {
        // This is the correct Url
        "url": "https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-EthnicCategory-1",  
        "valueCodeableConcept": {
            "coding": [
                {
                    // The system was a ValueSet, it should be a CodeSystem
                    "system": "https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-EthnicCategory-1",
                    "code": "A",
                    "display": "British, Mixed British"
                }
            ],
            "text": "British, Mixed British"
        }
    }
]

}

Thank you, where this url and system url (https://fhir.hl7.org.uk/STU3/CodeSystem/CareConnect-EthnicCategory-1) from? when I checked the Care Connect Profile the url has valueSet instead of CodeSystem ? please clarify ?

https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-EthnicCategory-1

thanks

Thats a common mistake. This is saying use a code which is defined in this ValueSet

When you look at the ValueSet, the CodeSystem is listed at the bottom.

I think the way the profile has been created is confusing, it’s possibly been done that way because that is how it was done in DSTU2.

After some comments.

Based on the above, I believing the current spec led to the issue and was wondering if standard FHIR implementation guide would have been better. E.g.

https://project-wildfyre.github.io/UK-STU3/CareConnect-EthnicCategory-1.html

This has several issues at the mo (I’m experimenting)