Written by

UKK Köln
Question Dmitrii Baranov · Feb 23, 2023

Easiest way to clean up a FHIR database?

Hi, what is the easiest way to clear all the tables which store FHIR data? The most straitforward approach is to get a list of tables using the information_schema.tables view, then execute dynamic SQL with the "delete from" clause, but perhaps some helper class has already been written for this purpose?

Product version: IRIS 2022.3

Comments

Patrick Jamieson · Feb 23, 2023

Great question. We routinely need to do this in our internal testing. To clean out your repo, use the following commands at the IRIS terminal:

Set strategy = ##class(HS.FHIRServer.API.InteractionsStrategy).GetStrategyForEndpoint(appKey)
Set options("deleteDataOnly") = 1
Do strategy.Delete(.options)

The FHIR Server config page should have your app key.

Good luck.

0
Dmitrii Baranov  Feb 23, 2023 to Patrick Jamieson

Great answer! And yes, I badly need that for testing!

0
Benny Shtemer  Mar 12, 2024 to Patrick Jamieson

is it possible to delete all resources of a specific type?

0
Evgeny Shvarov · Aug 15, 2023

If this is for testing I'd suggest to use iris docker container with FHIR db inside. So just container relaunch will do the thing.

0
Sylvain Guilbaud  Aug 16, 2023 to Evgeny Shvarov

The use of docker obviously simplifies the solution to the problem and completely meets the need.
However, sometimes our customers don't use docker, even in their dev/test or staging environments.

0