Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Short description for case

...

Location search based on country (iso2 or Name)

In location API, tried to load 500 outlets in the country by (iso2)
URL: https://replica.psi-mis.org/locator/api/1?iso2={country ISO}&number=500
Similarly, in FHIR, we tried to load 500 locations in that country and measured the time taken to get the response back.
URL: https://fhir-dev.psi-mis.org/fhir?address-country={country_name}&_count=500

Summary of test results

DHIS2

FHIR

DHIS2 vs FHIR %

Average

0.554281

0.555023

-0.13%

Test detailed results

logged on Nov 21Dec 1/ 2022 UTC 20-7 08:45:43.333

...

40:00

Performance Testing for

Attempt

DHIS2 API

FHIR API

FHIR API (with HealthcareServices),

Improvement %

El Salvador

Attempt - 1

0.566667

0.488375

0.487989

16.03%

Attempt - 2

0.532607

0.437886

0.548295

21.63%

Attempt - 3

0.532142

0.452103

0.463129

17.7%

Kenya

Attempt - 1

0.657443

0.604362

0.625961

8.78%

Attempt - 2

0.655574

0.578361

0.574557

13.35%

Attempt - 3

0.659164

0.573111

0.663475

15.02%

Nigeria

Attempt - 1

0.526847

0.570136

0.651838

-7.59%

Attempt - 2

0.528978

0.588868

0.620271

-10.17%

Attempt - 3

0.536548

0.568277

0.70342

-5.58%

Cameroon

Attempt - 1

0.372636

0.587497

0.590178

-36.57%

Attempt - 2

0.371032

0.584348

0.595724

-36.5%

Attempt - 3

0.371502

0.558964

0.585595

-33.54%

Nepal

Attempt - 1

0.662525

0.612458

0.682753

8.17%

Attempt - 2

0.670834

0.56743

0.571592

18.22%

Attempt - 3

0.669719

0.553174

0.584597

21.07%

Overall Average

0.554281

0.555023

0.596625

-0.13%

Testing Script

Code Block
breakoutModewide
languagepy
##Case 1
case_1_results = [{"description": "Performance Testing for", "attempt": "Attempt", "dhis2": "DHIS2 API", "fhir": "FHIR API", "fhir_with_healthcareServices": "FHIR API (with HealthcareServices)
Code Block
  El Salvador
0.480019

0.502678

0.470009

Code Block
  Kenya
0.58585

0.56692

Testing script

code
,", "improvement":"Improvement %"}]
print("Case #1 - Getting 500 orgUnits/Location in the country (by ISO)")
improvements = []
dhis2_performances = []
fhir_hsc_performances = []
fhir_performances = []
for country in countries:
    for i in range(1,4):
        case_1_result = {}
        if i == 1:
            case_1_result['description'] = "{}".format(country['name'])
        case_1_result['attempt'] = "Attempt - {}".format(i)
        dhis2_url = dhis2_base_url+'iso2={}&number=500'.format(country['code'])
        result = requests.get(dhis2_url, auth=dhis2_auth)
        if result.status_code == 200:
            dhis2_performances.append(result.elapsed.total_seconds())
            case_1_result['dhis2'] = dhis2_performances[-1]

        request_url = fhir_location_url+'address-country={}&_count=500'.format(country['name'])
        fhirResult = requests.get(request_url, auth=fhir_auth)
        if fhirResult.status_code == 200:
            fhir_performances.append(fhirResult.elapsed.total_seconds())
            case_1_result['fhir'] = fhir_performances[-1]
        
        request_healthcare_url = fhir_location_url+'address-country={}&_count=500&_revinclude=HealthcareService:location'.format(country['name'])
        fhirHealthcareServicesResult = requests.get(request_healthcare_url, auth=fhir_auth)
        if fhirHealthcareServicesResult.status_code == 200:
            fhir_hsc_performances.append(fhirHealthcareServicesResult.elapsed.total_seconds())
            case_1_result['fhir_with_healthcareServices'] = fhir_hsc_performances[-1]
        
        improvements.append(((case_1_result['dhis2'] / case_1_result['fhir']) - 1)*100)
        case_1_result['improvement'] = '{}%'.format(float("{:.2f}".format(improvements[-1])))
        case_1_results.append(case_1_result)
        time.sleep(0.01)
case_1_result = {}
case_1_result['description'] = "Overall Average"
case_1_result['dhis2'] = np.average(dhis2_performances)
case_1_result['fhir'] = np.average(fhir_performances)
case_1_result['fhir_with_healthcareServices'] = np.average(fhir_hsc_performances)
case_1_result['improvement'] = '{}%'.format(float("{:.2f}".format(((case_1_result['dhis2']/case_1_result['fhir'])-1)*100)))
case_1_results.append(case_1_result)
print(tabulate(case_1_results, headers='firstrow', tablefmt='pipe'))