/
Case 2

Case 2

Searching nearest orgunits / Location based on the provided coordinates

Performance was measured based on the time taken to:
load 500 nearby outlets to the provided coordinates (for locator API)
URL: https://replica.psi-mis.org/locator/api/1?n=500&c={latitude},{longitude}&d={distance}
Similarly, in FHIR, we tried to load 500 nearby locations based on the coordinates provided
URL: https://fhir-dev.psi-mis.org/fhir?near={latitude}|{longitude}|{distance}|{unit}&_count=500

Summary of test results

 

DHIS2

FHIR

DHIS2 vs FHIR %

 

 

DHIS2

FHIR

DHIS2 vs FHIR %

 

Average

1.41292

0.583782

142.03%

 

 

Test detailed results

logged on Dec 1/ 2022 UTC-7 09:04:00

Performance Testing for

Attempt

DHIS2 API

DHIS2 Size

FHIR API

FHIR Size

Improvement %

Performance Testing for

Attempt

DHIS2 API

DHIS2 Size

FHIR API

FHIR Size

Improvement %

El Salvador

Attempt 1

1.41727

141

0.65739

500

115.59%

 

Attempt 2

1.39867

141

0.574834

500

143.32%

 

Attempt 3

1.382

141

0.568845

500

142.95%

Kenya

Attempt 1

1.43245

500

0.598346

500

139.4%

 

Attempt 2

1.43526

500

0.581445

500

146.84%

 

Attempt 3

1.49501

500

0.569503

500

162.51%

Nigeria

Attempt 1

1.51636

500

0.582592

500

160.28%

 

Attempt 2

1.48614

500

0.613181

500

142.37%

 

Attempt 3

1.63908

500

0.567279

500

188.94%

Cameroon

Attempt 1

1.69394

500

0.591673

500

186.3%

 

Attempt 2

1.47116

500

0.563599

500

161.03%

 

Attempt 3

1.49798

500

0.566068

500

164.63%

Nepal

Attempt 1

1.11843

12

0.59532

500

87.87%

 

Attempt 2

1.10475

12

0.567694

500

94.6%

 

Attempt 3

1.10523

12

0.558964

500

97.73%

Overall Average

 

1.41292

 

0.583782

 

142.03%

Testing Script

case_results = [{"description": "Performance Testing for", "attempt": "Attempt", "dhis2": "DHIS2 API", "dhis2_size": "DHIS2 Size", "fhir": "FHIR API", "fhir_size": "FHIR Size", "improvement": "Improvement %"}] print("Case #2 - Getting 500 orgUnits/Location 100km around the provided coordinates") improvements = [] dhis2_performances = [] fhir_performances = [] for country in countries: for i in range(1,4): case_result = {} if i == 1: case_result['description'] = "{}".format(country['name']) case_result['attempt'] = "Attempt {}".format(i) dhis2_url = dhis2_base_url+'n=500&c={},{}&d=1000000'.format(country['latitude'], country['longitude']) result = requests.get(dhis2_url, auth=dhis2_auth) if result.status_code == 200: data = result.json() dhis2_performances.append(result.elapsed.total_seconds()) case_result['dhis2'] = dhis2_performances[-1] case_result['dhis2_size'] = len(data['outlet']) request_url = fhir_location_url+'near={}|{}|10000|km&_count=500'.format(country['latitude'], country['longitude']) fhirResult = requests.get(request_url, auth=fhir_auth) if fhirResult.status_code == 200: fhir_data = fhirResult.json() fhir_performances.append(fhirResult.elapsed.total_seconds()) case_result['fhir'] = fhir_performances[-1] case_result['fhir_size'] = len(fhir_data['entry']) if 'entry' in fhir_data else 0 improvements.append(((case_result['dhis2']/case_result['fhir'])-1)*100) case_result['improvement'] = '{}%'.format(float("{:.2f}".format(improvements[-1]))) case_results.append(case_result) time.sleep(0.01) case_result = {} case_result['description'] = "Overall Average" case_result['dhis2'] = np.average(dhis2_performances) case_result['fhir'] = np.average(fhir_performances) case_result['improvement'] = '{}%'.format(float("{:.2f}".format(((case_result['dhis2']/case_result['fhir'])-1)*100))) case_results.append(case_result) print(tabulate(case_results, headers='firstrow', tablefmt='pipe'))

 

Related content