Chained/nested include

Is it possible to do include for referenced resources in referenced resources?
Ex: I need to find Procedure, include Procedure.encounter and then include Procedure.encounter.location
Thanks.

Yes. You would need to use the :iterate qualifier. Your search would look like this:

Procedure?_include=Procedure:encounter&_include:iterate=Encounter:location

1 Like

Hi, lloyd!
I am doing the implementation of include search and have a question about chained include search.
My querstion is, does the order of include search matter?
E.g. I want to retrieve the referenced labor value of the patients, who has previous illness 386661006, though the Encounter. The query like following.
Condition?code=386661006&_include=Condition:subject&_revinclude:iterate=Encounter:subject&_revinclude:iterate=DiagnosticReport:encounter&_include:iterate=DiagnosticReport:result
Does the query make sense?
If the order of search parameters does not matter, are the multiple iterations allowed?
Thx!

Order of parameters doesn’t matter. (Some systems aren’t able to keep track of the order). Iteration keeps happening until running the iterate doesn’t add any new includes. (Or the server decides that it’s iterated enough.)

1 Like