Comments (12)
If you put multiple resources within the tag, the server will create a resource, but only the first contained resource will be saved.
from spark.
Could you also give me an example for this? It is not clear in what tag can one add multiple resources. I have tried it with a couple of tags and parsing throws an exception.
from spark.
It's been too long ago, I don't understand this bug-report myself anymore, but it seems Mirjam still does ;-)
from spark.
The issue is with contained resources. Try posting:
<Patient xmlns="http://hl7.org/fhir">
<contained>
<Organization>
<id value="myManagingOrganization"/>
<name value="Just testing this"/>
</Organization>
<Organization>
<id value="myManagingOrganization2"/>
<name value="Just testing this 2"/>
</Organization>
</contained>
<name>
<use value="usual" />
<given value="Jim" />
</name>
<managingOrganization>
<reference value="#myManagingOrganization" />
</managingOrganization>
</Patient>
The contained tag is invalid since it can only contain 1 resource, but spark accepts it and stores the first organization.
from spark.
- From what I understand you can have multiple contained resources in a contained tag (https://www.hl7.org/fhir/references.html). The json representation from the example seems to expect an arrray :
contained: [ { "resourceType" : "Organization", "id" : "org1", .. whatever information is available ... } ]
or is this example wrong?
Is there some documentation where this is explicitly explained?
- Also from this constraint "A contained resource SHALL only be included in a resource if something in that resource (potentially another contained resource) has a reference to it" I understand that there can be multiple contained resources, but that could also be done using multiple contained tags. So what do you understand from this?
- At the same time the example from @mbaltus should still be invalid because one of the organization is not used anywhere in the resource. Should Spark check that?
from spark.
Yes, it is possible to have multiple contained resources, but they should be in their own <contained>
tag, just like if you have more than 1 Patient.name you get multiple <name>
tags. So my post should have resulted in an error. Also, Spark should not have just thrown away the second resource in contained if my construction was valid, because I've tested with a reference to the second one (and no reference to the first) and it still got deleted.
So I still think my posted resource is invalid, and Spark should reject it.
I think if a contained resource was not referenced, Spark should also reject it and send back an OperationOutcome, since SHALL implies this is an error.
from spark.
Thank you. That clears things out.
from spark.
Yes, the fact that Json has an array notation ([]) and you cannot repeat properties in Json makes all the difference here...
from spark.
So, this seems indeed to be a FHIR .NET Api bug (at least the part about accepting more resources in a contained tag).
After debugging this, the problem appears to be in the XmlDomFhirReader.GetMembers() method. Here for parsing an XElement we just take the value = (XElement)elem.FirstNode;
and ignore any other nodes. We should probably check here the Elements()
collection and throw an exception if there are multiple elements in it. I will add a bug for this.
Related to the second problem that we don't check if the actual contained resource is used anywhere in the resource, this would imply a validation step after the resource is constructed. Should this happen in Spark? or it would be better to make sure all parsed resources are correct? I think this should be part of implementing the rest of the validation support in Spark (that is currently missing - see Spark.Service.Validate). Maybe after implementation this could also be exported as a separate library.
What do you tink?
from spark.
We are experiencing the same issue currently. So just to clarify, should we be saving our contained resources using the following format? Will this deserialise correctly?
<Patient xmlns="http://hl7.org/fhir"> <contained> <Organization> <id value="myManagingOrganization"/> <name value="Just testing this"/> </Organization> </contained> <contained> <Organization> <id value="myManagingOrganization2"/> <name value="Just testing this 2"/> </Organization> </contained> <name> <use value="usual" /> <given value="Jim" /> </name> <managingOrganization> <reference value="#myManagingOrganization" /> </managingOrganization> </Patient>
from spark.
Yes, this should be handled correctly. If Spark doesn't please leave a new comment here.
from spark.
- If PermissiveParsing is set to false it will fail and return an OperationOutcome.
- If PermissiveParsing is set to true one of the resources will be removed from the contained section.
from spark.
Related Issues (20)
- FILE UPLOAD ISSUE HOT 8
- Provenance searches return 0 results when using FHIR R4 'patient' parameter HOT 2
- Searching HOT 1
- Snapshot is not working HOT 2
- How to implement extensions HOT 3
- Query the token type through the not modifier. HOT 1
- Invalid implementation of GT,GTE,LT,LTE search parameters HOT 2
- Regarding the storage of query parameter Code<T>. HOT 2
- Prefix codes eq, ne, gt, lt, ge, le are not working in chained search.
- Searching Patient by Identifier using only System returns InternalServerError HOT 1
- Bundle response links are broken if ILocalhost.DefaultBase ends with / HOT 1
- Present decimal values as integer for Json output HOT 2
- Performance degradation in FHIR server for high patient registration volume HOT 1
- Bad Request error on PATCH operation for replace operation
- MongoIdGenerator is unsafe when mixed with upsert
- https://spark.incendi.no/ is down HOT 1
- Search via POST using multiple comparison operators fails
- VersionId parsing from headers in Spark.Web does not support the Weak ETags specified in FHIR API HOT 2
- Transaction entries using ifMatches constraint are ignored resulting in potential data loss
- Unable to find example Database on windows HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spark.