An Azure offering that provides a suite of purpose-built technologies for protected health information in the cloud.
Hello Niloufar,
To resolve the ResourceVersionConflictException and successfully maintain your history while importing, you need to configure your $import request to handle non-sequential versions.
The configuration properties you found during your research (initialImportMode = false, update_with_history_rewrite_enabled = true, preserve_existing_ids = true) are not valid properties for the Azure Health Data Services $import JSON payload.
Instead, you should rely on IncrementalLoad and the allowNegativeVersions flag directly in your HTTP request body.
According to the official Microsoft documentation on FHIR Import:
Incremental mode: "Enables ingestion of multiple versions of FHIR resources in single batch while maintaining resource history and original
lastUpdatedvalues... Allows you to load resources in a nonsequential order of versions."
allowNegativeVersions: "Allows FHIR server assigning negative versions for resource records with explicit
lastUpdatedvalue and no version specified when input doesn't fit in contiguous space of positive versions existing in the store."
Here is the correct configuration for your API request payload:
POST https://<<FHIR service base URL>>/$import
Prefer: respond-async
Content-Type: application/fhir+json
{
"inputFormat": "application/fhir+ndjson",
"mode": "IncrementalLoad",
"allowNegativeVersions": true,
"input": [
{
"type": "Observation",
"url": "https://<your-storage-account>.blob.core.windows.net/<container>/Observation.ndjson"
}
]
}
Handling Live Stream Conflicts: A ResourceVersionConflictException is a standard concurrency control exception. Because you have a live Kafka stream pushing updates to the same database simultaneously, if the live stream and the bulk import attempt to modify the exact same resource ID at the exact same time, the server will block one to prevent data corruption.
If this continues to cause batch failures even with IncrementalLoad, you may need to temporarily pause the Kafka stream for the specific legacy Observation resources being backfilled or segregate the legacy IDs from the live IDs until the import completes.
Note: This response is drafted with the help of AI systems.