Implement basic Bulk Data Access export server
@johngrimes is already working on this.
Since Nov 3, 2025.
- Dominant language
- Java
- Stars
- 134
- Forks
- 24
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 8
Description
Implement a new Spring Boot server application within the server directory that provides FHIR bulk data export capabilities. The server will be built using HAPI FHIR and will include authorization support based on the design from the pre-version 8 Pathling server.
Project structure and dependencies
Location and build configuration
The server will live in the server directory with its own pom.xml file, independent from the root project. It will use Maven for dependency management and building, with versioning independent of the Pathling library. Initial version will be 1.0.0-SNAPSHOT.
Dependencies
library-runtimemodule from Pathling v8.0.0 (the only Pathling dependency)- HAPI FHIR framework for building the FHIR server
- Spring Boot for application infrastructure
- Dependencies required for JWT validation and OpenID Connect integration
The server will not depend on any other Pathling modules or non-public APIs. All bulk export functionality and authorization logic will be implemented within the server module. Any changes to the library API should be of general applicability to Pathling library users and not specific to the bulk export use case.
Server architecture
The server will use HAPI FHIR to create a servlet mounted using the @WebServlet annotation, inheriting some structure and functionality from the original Pathling server (v7).
Scope
In scope
- System-level export (
/$export) - NDJSON output format
_typeparameter for filtering resource types- Bulk data status request and output manifest (required fields only)
- Capability statement requirements
- Authorization (JWT bearer tokens with OpenID Connect)
_sinceparameter for filtering by last updated date_untilparameter for filtering by last updated date_elementsparameter for limiting returned fields
Out of scope
_includeAssociatedDataparameter_typeFilterparameterorganizeOutputByparameterallowPartialManifestsparameter- Binary to DocumentReference conversion
- Group-level export
- Bulk Cohort API
- Deletion bundles
_listparameter
Implementation requirements
Bulk data export operation
Kick-off request
Implement the system-level export endpoint (GET /$export) that:
- Accepts optional
_type,_since,_until, and_elementsparameters - Validates bearer token and checks for required authorities
- Initiates an asynchronous export job
- Returns HTTP 202 (Accepted) with a
Content-Locationheader pointing to the status endpoint
Status endpoint
Implement the status polling endpoint that:
- Returns HTTP 202 (Accepted) while the export is in progress, with optional
X-Progressheader - Returns HTTP 200 (OK) when complete, with a JSON manifest containing:
transactionTime: timestamp when the export was initiatedrequest: the original export request URLrequiresAccessToken: boolean indicating if access tokens are needed to download filesoutput: array of file items withtype(resource type) andurl(download location)error: array for any OperationOutcome files (may be empty if no errors occurred)
Output files
Generate NDJSON files containing the exported resources:
- One file per resource type (or split appropriately for large exports)
- Filtered according to
_type,_since,_until, and_elementsparameters - Filtered according to user’s read authorities
- Apply
_elementsparameter to limit fields in output
File downloads
Provide endpoints for downloading the generated NDJSON files referenced in the manifest. Download endpoints will be served from the same endpoint as the bulk server and proxy back to data stored by Hadoop, following the same pattern as the version 7 server.
Authorization
Token validation
The system must validate bearer tokens using the OpenID Connect framework:
- Token must be a valid JSON Web Token (JWT)
- Token must contain an audience claim matching the configured value
- Token must contain an issuer claim matching the configured value
- Issuer must provide an OpenID Connect Discovery endpoint for token validation
Authorization model
The bulk export operation will use the following authority structure:
graph TD
export[pathling:export]
pathling[pathling]
read[pathling:read]
readResource[pathling:read:ResourceType]
pathling --> export
pathling --> read
read --> readResource
style pathling fill:#e1bee7
style export fill:#bbdefb
style read fill:#fff9c4
style readResource fill:#fff9c4
pathling- grants access to all operations and resources, implies all other authoritiespathling:export- grants access to the export operationpathling:read- grants read access to all resource typespathling:read:[resource type]- grants read access to a specific resource type (e.g.,pathling:read:Patient)
To use the export operation, users must have both the pathling:export authority and at least one read authority.
Export behavior
The system should filter exported resources based on user permissions:
Default export (no resource types specified)
When a user initiates an export without specifying resource types:
- Export only resource types for which the user has read authority
- Log a warning message for any resource types that exist in the dataset but were excluded due to insufficient permissions
- Return a successful response (HTTP 200) when polling the status endpoint
Explicit resource type request
When a user requests specific resource types in their export:
- Export only the requested resource types for which the user has read authority
- Log a warning message for any requested resource types that were excluded due to insufficient permissions
- Return a successful response (HTTP 200) when polling the status endpoint
Logging format
When resource types are excluded due to authorization, log a warning message that clearly indicates:
- Which resource type was excluded
- The reason for exclusion (insufficient permissions)
This approach maintains consistency across both scenarios while providing visibility through server logs about what was filtered.
Implementation notes
- Authorization implementation will be based on the design from the pre-version 8 server and may reuse some of the old code
- Configuration should support specifying the expected audience and issuer values
- Configuration should support the OpenID Connect Discovery endpoint URL
- Token validation should use standard JWT libraries
- Consider whether authority checking logic can be modularized for potential future operations
- Use HAPI FHIR’s resource provider and operation patterns
- Follow Spring Boot conventions for configuration and dependency injection
- Structure the code to support adding additional bulk data features in the future
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.