FHIR Chat · Encountered unknown element 'subject' Error · implementers

Stream: implementers

Topic: Encountered unknown element 'subject' Error


view this post on Zulip Tani Thomas (Aug 20 2021 at 05:07):

Hi,
Using C#.Net HL 7 library, created a Condition FHIR Resource and trying to link to its Patient Resource using condition.subject property. But keep getting below error:
Operation was unsuccessful because of a client error (BadRequest). OperationOutcome: Overall result: FAILURE (1 errors and 0 warnings)

[ERROR] (no details)(further diagnostics: Body parsing failed: Type checking the data: Encountered unknown element 'subject' at location 'Resource.subject[0]' while parsing).
Any idea?

Thanks

view this post on Zulip Lloyd McKenzie (Aug 20 2021 at 05:27):

@Ward Weistra

view this post on Zulip Daniel Venton (Aug 20 2021 at 12:05):

What is the content of the resource you are trying up push. It sounds like it's not formatted correctly.

view this post on Zulip Michele Mottini (Aug 20 2021 at 12:53):

There are different libraries for different FHIR versions, are you using the right one? Because Condition.subject was called Condition.patient in DSTU2

view this post on Zulip Tani Thomas (Aug 21 2021 at 01:52):

Daniel Venton said:

What is the content of the resource you are trying up push. It sounds like it's not formatted correctly.

var condition = new Hl7.Fhir.Model.Condition();
condition.Subject = new ResourceReference("Patient/" + myPatient.Id);

where myPatient is a Patient Reosurce created.

The error is thrown on
var conditions = new SearchParams();
conditions.Add("identifier", "http://ns.electronichealth.net.au/id/hi/ihi/1.0|" + pat.Admission_Id);
Hl7.Fhir.Model.Condition ReturnedCondition = client.Create<Hl7.Fhir.Model.Condition>(condition, conditions);

view this post on Zulip Tani Thomas (Aug 21 2021 at 01:52):

Michele Mottini said:

There are different libraries for different FHIR versions, are you using the right one? Because Condition.subject was called Condition.patient in DSTU2

Library i am using is HL7.Fhir.R4

view this post on Zulip Michele Mottini (Aug 21 2021 at 03:16):

...and which FHIR version does the server you are POSTing to uses?

view this post on Zulip Daniel Venton (Aug 23 2021 at 12:55):

The failure isn't on the push of the resource, it's on the query for the resource? I still want to see the resource in it's serialized form.

view this post on Zulip Tani Thomas (Aug 27 2021 at 03:50):

(deleted)

view this post on Zulip Tani Thomas (Aug 27 2021 at 03:51):

Michele Mottini said:

...and which FHIR version does the server you are POSTing to uses?

FHIR R4 1.0.2

view this post on Zulip Tani Thomas (Aug 27 2021 at 03:51):

Daniel Venton said:

The failure isn't on the push of the resource, it's on the query for the resource? I still want to see the resource in it's serialized form.

{
"resourceType": "Patient",
"extension": [
{
"valueString": "Alfred"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/birthPlace",
"valueAddress": {
"country": "Australia"
}
},
{
"url": "http://hl7.org.au/fhir/StructureDefinition/indigenous-status",
"valueCode": "4"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/condition-outcome",
"valueString": ""
}
],
"identifier": [
{
"system": "http://ns.electronichealth.net.au/id/hi/ihi/1.0",
"value": "19999"
},
{
"system": "http://ns.electronichealth.net.au/id/medicare-number",
"value": ""
},
{
"system": "http://hl7.org.au/fhir/StructureDefinition/au-dvanumber",
"value": ""
}
],
"active": true,
"name": [
{
"family": "test1",
"given": [
"test1",
""
]
}
],
"telecom": [
{
"system": "phone",
"value": "04423509665",
"use": "home"
},
{
"system": "phone",
"value": "",
"use": "mobile"
},
{
"system": "phone",
"value": "",
"use": "work"
},
{
"system": "email",
"value": ""
}
],
"gender": "male",
"birthDate": "1963-08-02",
"address": [
{
"type": "physical",
"line": [
"24 Pletuyty River Drive",
"GREENSBOROUGH"
],
"city": "",
"state": "",
"postalCode": "3088",
"country": ""
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"given": [
""
]
},
"telecom": [
{
"system": "phone",
"value": "",
"use": "home"
},
{
"system": "phone",
"value": "",
"use": "mobile"
},
{
"system": "phone",
"value": "",
"use": "work"
},
{
"system": "email"
}
],
"address": {
"type": "physical",
"line": [
"",
""
],
"city": "",
"state": "",
"postalCode": ""
}
}
],
"communication": [
{
"language": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/languages",
"code": "en"
}
]
}
}
],
"generalPractitioner": [
{
"reference": "Practitioner/647"
}
],
"managingOrganization": {
"reference": "Organization/11"
}
}

view this post on Zulip Michele Mottini (Aug 27 2021 at 13:30):

FHIR version 1.02 is DSTU2, not R4 - that would explain the error (the server expects Condition.patient, your client is sending Condition.subject)


Last updated: Apr 12 2022 at 19:14 UTC