Stream: cql
Topic: Fun with traversal of resources
Richard Stanley (Jan 06 2022 at 04:59):
Hi folks. I'm trying to get to the contract under which an Encounter occurred. The path is Encounter -> Account -> Coverage -> Contract. Is this possible in CQL? This is for attributing an Encounter to a funder. Alternately, a simpler path is Encounter -> serviceProvider (org). But, I want to understand if the more complex approach is feasible.
Paul Denning (Jan 06 2022 at 16:18):
Something like
define function "EncounterAccount"(Enc Encounter ):
Enc.account EA
return singleton from ([Account] A where A.id = "GetId"(EA.reference))
define function "GetId"(uri String ):
Last(Split(uri, '/'))
define function "AccountCoverage"(Acct Account ):
Acct.coverage AC
return singleton from ([Coverage] CV where CV.id = "GetId"(AC.reference))
define function "CoverageContract"(Cov Coverage ):
Cov.contract CK
return singleton from ([Contract] K where K.id = "GetId"(CK.reference))
Last updated: Apr 12 2022 at 19:14 UTC