beda-software / fhir-py

FHIR Client for python
MIT License
177 stars 33 forks source link

Why the save() function will cost a lot of time for saving one Resource? #124

Closed LinkunGao closed 7 months ago

LinkunGao commented 7 months ago

For example: I try to save a Patient resource

{
  "resourceType": "Patient",
  "id": "pat3",
  "identifier": [
      {
            "use": "official",
            "system": "http://sparc.sds.dataset",
            "value": "test-1"
     }
  ],
  "name": [
    {
      "use": "official",
      "family": "test",
      "given": [
        "test"
      ]
    }
  ],
  "gender": "male",
  "birthDate": "1982-01-23",
  "deceasedDateTime": "2015-02-14T13:42:00+10:00"
}

Send this resource to FHIR server via fhirpy, It will cost almost 140s

new_patient = client.resource('Patient')

    new_patient['identifier'] = [
        {
            "use": "official",
            "system": "http://sparc.sds.dataset",
            "value": "test-1"
        }
    ]

    new_patient['name'] = [
        {
            'given': ["test"],
            'family': test,
            'use': 'official',
        }
    ]

    # format year-month-day
    new_patient['brithDate'] = "1895-10-10"
    await new_patient.save()

Send by postman POST body, it just cost 5~10s.

Or via python request , it also only take 5~10s to save.

Is there any solution for me to speed up the fhirpy save() function?