Finding all references

Hi community,

I’m implementing a business case, where a patient resource should be deleted.

My question: Is there a way to obtain a list of all resources having a reference to this patient ?
I don’t want to turn off referential integrity, but neither I can’t query each single resource type that can have a reference to a patient. (60, 70?)

Yes, there is a cascading delete option, but to be honest, cascading delete is something that gives me always a queasy feeling.

Also, I could run a transaction and check the outcome, but that doesn’t help me in identifying the references.

Thanks in advance
Christian

+1 to the quesy feeling. But deletion generally gives me that feeling - I recommend against ever actually deleting. (which raises a different question: should there be a cascading de-activation?)

I don’t think we have a way to list all resources referencing the patient… I think it’s a good question to ask on chat.fhir.org, so see https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Everything.20about.20.20a.20patient

But have you looked at $everything?

1 Like

I’m for “cascading de-activation” rather than cascading delete

Thanks. I tried $everything, but its incredibly slow. Well, I thing deactivating is the preferred way.