Soft Delete any profile


I am working with FHIR Library with Asp .Net c# for eHealth4U project with University Of Cyprus.

I can see that FHIR has DeleteAsync method, however am worndering if that method actually deletes the record or it soft deletes it. if it completely deletes it, is there any other way to soft delete records ?

Thank you

Hello. We use an attribute ‘status’ = entered-in-error as soft delete. I’m not sure that is the best solution, but we do this.

FHIR doesn’t have a DeleteAsync method, though certain reference implementations might. You’ll have to investigate what the RI method does. The FHIR ‘delete’ interaction does not distinguish whether it performs a physical or logical delete - it simply defines what the behavior of the interface is - specifically that deleted records aren’t returned when performing queries. If a server supports history for a resource, then deleting a resource instance doesn’t remove historical versions - the history can still be retrieved and the ‘deletion’ will simply be shown as one record within the overall history. In fact, it’s possible for a record to be deleted, then replaced using Update, then deleted again multiple times if a client chooses to do so.

‘entered-in-error’ isn’t really the same as ‘deleted’. ‘entered-in-error’ is specifically saying “this record should never have existed, if you acted on it, revisit your actions because they were based on faulty data”. It’s actually explicitly not deleting the record because you want it to remain visible that an error was made so users can understand the context for decisions made. As well, there are lots of reasons for deleting records (revocation of consent, de-duplication, expiry, storage management) where the ‘entered-in-error’ assertion would not be accurate.

1 Like

So we are saying that “logical” or “physical” delete is not in scope of FHIR spec, because it is a status of the record in the repository? You can’t have the status " deleted" practically on anything. When we discussed status codes, the “entered-in-error” was the most common reason why someone would want to delete the record. Does it mean that the FHIR server needs to add an additional status field to keep that “logical” delete info? For any other than in error deletions?

Duplicate - is entered in error :slight_smile:

When a ‘delete’ occurs, it is up to the server whether to treat it as a physical or logical delete. Most servers will treat it as a ‘logical’ deletion and flag the record in some way. However, that flag isn’t defined in FHIR because it is never surfaced over the FHIR interface. In a ‘history’ entry, that particular version of the resource doesn’t appear. In a GET or a search, there is no record to see.

1 Like