FHIR Chat · Making references to other resources · implementers

Stream: implementers

Topic: Making references to other resources


view this post on Zulip Andrew Broadbent (Feb 10 2017 at 14:23):

I just have a quick question for how to go about making references between resources. So as an example, I have a Questionnaire (Q) resource, and a QuestionnaireResponse (QR) which contains a reference to Q.

In my case I'm using hapi, which as far as I can tell doesn't allow you to upload resources which already have an id attached to them. My question then is, how do I make my resources portable? For example if I export Q and QR from a particular hapi instance, and reimport them into another, Q will be given a completely different id, so I'll have to edit QR to reference this new Id.

view this post on Zulip Lloyd McKenzie (Feb 10 2017 at 20:56):

If you send them both as a transaction, the expectation is the server will maintain the link. If you send them one at a time, you'll have to make the update.

view this post on Zulip Grahame Grieve (Feb 10 2017 at 22:51):

see http://build.fhir.org/managing.html

view this post on Zulip Andrew Broadbent (Feb 17 2017 at 13:12):

Thanks, is there a standardised way of doing this? The issue that I have is; the data we store is quite free form (we host a platform where people can essentially upload anything). I've managed to structure it in such a way that all data we accept fits within the resources defined by fhir, but it can come in at any time in any order.

For example; We have a Patient and an Observation resource, where the observation references the patient. They may be imported in the same batch, but they may also be imported in different batches in any order.

I'm thinking that I'll have to upload the Observation with some sort of place holder reference to a logical ID for the Patient, and then run a process which looks for unresolved references and updates them where necessary. Is there already a mechanism or a standard practice in place for doing this?

view this post on Zulip Jason Walonoski (Feb 17 2017 at 13:22):

If you look at Reference, you can use an identifier which is a logical ID. Assuming you know to give the appropriate Patient that same logical identifier (or they already have it), then you could go back and post-process them to "fix" the references to be literal/relative URLs. Nothing stops you from doing that.

view this post on Zulip Andrew Broadbent (Feb 17 2017 at 13:25):

Great thanks

view this post on Zulip Grahame Grieve (Feb 17 2017 at 17:59):

in my server, I create a dangling index entry if I have an unresolved link. Then, when I create a new resource, I look for the dangling entries and fix up the target reference if there are any

view this post on Zulip Sandeep Giri (Feb 17 2017 at 18:29):

Should one enforce format consistency when storing Reference values in their data model?

For example, Reference.reference attribute can be either an relative reference (e.g. "Patient/034AB16") or an absolute URL (e.g. " http://myfhirserver.com/Patient/034AB16"). If we allow for both representation, then let's say we store a Patient reference as "Patient/034AB16" and when an application searches for a patient reference by the absolute value "http://myfhirserver.com/Patient/034AB16", it will not find the desired result since the 2 string literal values are different.

Now, we could fix this by either converting each relative reference to full absolute reference during each match, or we can enforce a rule that says all Reference.reference values must be absolute URL's. Just wondering if anyone else has run into (or thought about) this issue from a search implementation perspective and has any insights/feedback to share. Thanks.

view this post on Zulip Grahame Grieve (Feb 17 2017 at 18:33):

search parameter type is 'reference' not 'string', so matches are based on the semantics of referencing, not string literals. your system should know what is and isn't a match

view this post on Zulip Andrew Broadbent (Feb 21 2017 at 13:42):

Is there a way to perform paging for uploading a transaction? I'm trying to take advantage of the referential integrity of transactions when POSTing new resources, however I have several GBs of interdependent resources, which is to large to fit in the body of a message.

view this post on Zulip Lloyd McKenzie (Feb 21 2017 at 17:42):

Not right now. And given that REST is supposed to be stateless, it wouldn't be an easy thing to make fit. Your best option is to define a couple of operations - one to let you upload content for a nominal "transaction" and a second to allow invocation of the transaction. (You could potentially also use FHIR messages to do the same thing, but the additional overhead would only be justified if you needed routing or something else messaging offers that operations don't.)


Last updated: Apr 12 2022 at 19:14 UTC