Hapi Fhir CLI bulk import not working

455 views
Skip to first unread message

Johanna Häusler

unread,
Oct 18, 2023, 3:27:55 AM10/18/23
to HAPI FHIR
Hello,

I need to do a data migration to a hapi fhir server. The data  is provided as "ndjson" files where the resources of each resource type are collected per file.

With the hapi fhir CLI tool I am trying to do a bulk import now. The files should be structured correctly and I can also start the task, but it fails because of the references.

2 scenarios:

1) auto_create_placeholder_reference_targets: true
If this setting is enabled on my hapi server, then placeholder resources are created correctly. The problem is that when the import hits the actual resource with this id, then it fails with this error: "JobStepFailedException: HAPI-2041: HAPI-0550: HAPI-0825: The operation has failed with a client-assigned ID constraint failure. This typically means that multiple client threads are trying to create a new resource with the same client-assigned ID at the same time, and this thread was chosen to be rejected. It can also happen when a request disables the Upsert Existence Check."

2) auto_create_placeholder_reference_targets: true
If this setting is disabled on my hapi server, then no placeholder resources are created and if the reference target resource has not yet been created, the task fails with e.g. this error:
"InvalidRequestException: HAPI-1094: Resource Patient/123 not found, specified in path: Immunization.patient"

This is how I start the tool:
./hapi-fhir-cli bulk-import -v r4 --port 12345 --source-base http://myserver:12345 --source-directory somepath/Hapi/Migration --target-base http://myserver:8888/fhir

Am I doing something fundamentally wrong? Or did I misunderstand how the tool is inteded to work?
Would be glad for any advice.

Best,
Johanna

Johanna Häusler

unread,
Oct 18, 2023, 4:00:00 AM10/18/23
to HAPI FHIR
Scenario 2 is of course with the setting set to false - sorry, copy paste ^^

Patrick Werner

unread,
Oct 18, 2023, 4:31:59 AM10/18/23
to Johanna Häusler, HAPI FHIR
HI Johanna, 

I think you just have to set:
enforce_referential_integrity_on_write: false

And have the create placeholder setting on false.

Best
Patrick


-- 
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/6fe4dc58-f68d-4b35-b32a-886aeaa5a52dn%40googlegroups.com.

Johanna Häusler

unread,
Oct 18, 2023, 5:16:36 AM10/18/23
to HAPI FHIR
Many many thanks Patrick, this is working!! You saved my life :D

Best,
Johanna

Reply all
Reply to author
Forward
0 new messages