hl7-fhirgoogle-healthcare-api

How to use a numeric id in Google Healthcare api FHIR


I need to change uuid to numeric id, but I can't find how to make this.

Someone can help me, please?


Solution

  • You can create resources with any ID you want (that is allowed by the FHIR spec) if you set enabledUpdateCreate to true in your FHIR store config.

    This determines if the client can use an Update operation to create a new resource with a client-specified ID.

    For example

    curl -X PATCH \
        -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
        -H "Content-Type: application/json; charset=utf-8" \
        --data '{
          "enableUpdateCreate": true
        }' "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID?updateMask=enableUpdateCreate"
    

    Then you can create a new Patient with ID 1 like this

    curl -X PUT \
         -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
         -H "Content-Type: application/fhir+json; charset=utf-8" \
         --data '{
             "resourceType": "Patient",
             "id": "1"
         }' \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/1"