Bulk Import on JPA-Starter

292 views
Skip to first unread message

Robert Barrett

unread,
Jul 21, 2022, 10:26:54 AM7/21/22
to HAPI FHIR
Hey all,

I'm using the JPA-Starter server on version 6.0.1, loaded with data from Synthea. I have been experimenting with bulk import/export operations, and have a few questions. Apologies in advance if I'm missing something obvious, I'm still rather new to FHIR! 

Problem Overview:
  1. Most importantly, the $import consistently throws an error that the server doesn't know how to handle the operation with null parameters. From reading online, it seems that a Parameters resource configured with respect to this page on SmileCDR. I'll include more details below. There are two questions on this:
    • Is the JPA starter server updated to permit bulk import/export operations? It appears so from the recent version release notes, but neither hapi.fhir.org nor the local server I created recognize this operation.
    • I have tried a workaround of parsing through the ndjson files and importing resources individually, however, I run into an issue with resources references other resources that don't exist. Importing them in an more preferred order doesn't seem to work, as somewhere down the line there's always a reference to something not yet imported. Is there a workaround or better approach to this, if $import is not available?
  2. The bulk export works, however when calling against the Patient/ resources, I am only retrieving Patients - never the associated resources. My scripts for executing the export operation work fine on other endpoints, and can retrieve ndjson files without issue. The local server seems to be the problem, which I suspect is rooted in my Synthea data.

What I've Tried/Done:
Note that I'm using PHP to initiate the request for testing, and to effectively act as a client for downstream request/responses. $import alone is explored here, because $export seems to work fine against other endpoints.

Here is the error returned from the local server on request:
  "issue": [ {
    "severity": "error",
    "code": "not-supported",
    "diagnostics": "Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[$import] with parameters [[]]"
  } ]

And what I have tried:
  1. Built resource parameter into request body, like so (the encoded json was verified through an online resource):
            $body = array(
                    "resourceType" => "Parameters",
                    "parameter" => array(
                            array(
                                    "name" => "inputFormat",
                                    "valueCode" => "application/fhir+ndjson"
                            ),
                            array(
                                    "name" => "inputSource",
                                    "valueUrl" => "http://example.com/fhir/"
                            ),
                            array(
                                    "name" => "storageDetail",
                                    "part" => array(
                                            array(
                                                    "name" => "type",
                                                    "valueCode" => "https"
                                            )
                                    )
                            ),
                            array(
                                    "name" => "input",
                                    "part" => array(
                                            array(
                                                    "name" => "type",
                                                    "valueCode" => $resource_type,
                                            ),
                                            array(
                                                    "name" => "url",
                                                    "valueUrl" = "https://example.com/observations.ndjson"
                                            )
                                    )
                            )
                    )
            );
  2. The headers include the following:
                    array(
                                    "Content-type: application/json",
                                    "Accept: fhir+json",
                                    "Prefer: respond-async"
                    )
  3. I've updated application.yaml to the following changes from default:
    enable_index_missing_fields: true
    binary_storage_enabled: true
    bulk_export_enabled: true

Any help or advice is greatly appreciated!

Robert Barrett

unread,
Jul 25, 2022, 5:42:07 PM7/25/22
to HAPI FHIR
Update - the export issue is resolved. It was a problem with data generation. The import issue remains, so any advice would be greatly appreciated!

Robert Barrett

unread,
Jul 28, 2022, 11:17:24 AM7/28/22
to HAPI FHIR
Another update - from researching more it's my understanding that while it appears the current JPA-Starter Server runs on HAPI FHIR 6.0.1, it's actually running on 5.5.1 (which doesn't include the bulk import operation). If this is correct, is there a plan for when the starter project will include this functionality or be aligned with HAPI FHIR v6? I've seen some other questions posted surrounding the Starter project lacking import functionality - so it maybe be useful to clear others' questions up! 

If it's possible to merge some of this functionality into the Starter project, I would love to hear how, otherwise it seems my best course is to start moving to the HAPI FHIR main project and implement the JPA base server. 

Reply all
Reply to author
Forward
0 new messages