You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using this very helpful utility and have run into issues with polymorphic elements. Please let us know if there is something we are not understanding about how this works or whether this is an issue with the code base.
Regards,
Janet
These examples are for the FHIR v4 MedicationStatement resource, which contains Medication[x] polymorphic element.
The two issues are:
(1) FhirbaseJsonWriter fails to write Medication[x] when it is CodeableConcept.
The json is:
{
"resourceType": "MedicationStatement",
"id": "example005",
"status": "entered-in-error",
"medicationCodeableConcept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "27658006",
"display": "Amoxicillin (product)"
}
]
},
"subject": {
"reference": "Patient/4d5ed44d-ba1d-41b2-866e-5a9662278ae6",
"display": "Donald Duck"
}
}
The error is:
Newtonsoft.Json.JsonWriterException: Token PropertyName in state Array would result in an invalid JSON object. Path 'medication.codeableconcept.coding'.
at Newtonsoft.Json.JsonWriter.AutoComplete(JsonToken tokenBeingWritten)
The failure also occurs just after writing system while the code is attempting to (prematurely) "WriteEndObject:, but it also occurs without system and display (with just one contained field, the "code"). So there seems to be two issues: (a) the _isPolymorphic is causing the WriteEndObject to fire too soon instead of reading all contained fields, and (b) the WriteEndObject is confused (?) about the value to write for the Array state.
(2) FhirbaseJsonReader fails to read Medication[x] when it is a Resource.
The json is:
{
"resourceType": "MedicationStatement",
"id": "example005",
"status": "entered-in-error",
"medicationCodeableConcept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "27658006",
"display": "Amoxicillin (product)"
}
]
},
"subject": {
"reference": "Patient/4d5ed44d-ba1d-41b2-866e-5a9662278ae6",
"display": "Donald Duck"
}
}
The error is thrown by: result.Add(_parser.Parse<T>(reader));
The error is: System.ArgumentException: Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject.
Lastly, since we cannot read Medication as CodeableConcept we do not know if the Read would fail, but we suspect it would.
The text was updated successfully, but these errors were encountered:
Happy new year :-)
We are using this very helpful utility and have run into issues with polymorphic elements. Please let us know if there is something we are not understanding about how this works or whether this is an issue with the code base.
Regards,
Janet
These examples are for the FHIR v4 MedicationStatement resource, which contains Medication[x] polymorphic element.
The two issues are:
(1) FhirbaseJsonWriter fails to write Medication[x] when it is CodeableConcept.
(2) FhirbaseJsonReader fails to read Medication[x] when it is a Resource.
Lastly, since we cannot read Medication as CodeableConcept we do not know if the Read would fail, but we suspect it would.
The text was updated successfully, but these errors were encountered: