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 % | ||
---|---|---|---|---|
Average | 1.93245 | 0.555544 | 99.9437 |
Test detailed results
logged on Nov 22/ 2022 UTC-7 21:23:00
Performance Testing for | Attempt | DHIS2 API | FHIR API | Improvement ( % ) |
---|---|---|---|---|
El Salvador | Attempt 1 | 1.40366 | 0.595705 | 235.63 |
Attempt 2 | 1.36264 | 0.548285 | 248.527 | |
Attempt 3 | 1.38555 | 0.58621 | 236.356 | |
Kenya | Attempt 1 | 1.45908 | 0.592059 | 246.441 |
Attempt 2 | 1.42916 | 0.571586 | 250.034 | |
Attempt 3 | 1.42113 | 0.602623 | 235.824 | |
Nigeria | Attempt 1 | 1.47467 | 0.596982 | 247.022 |
Attempt 2 | 1.51453 | 0.564565 | 268.266 | |
Attempt 3 | 1.50846 | 0.564294 | 267.318 | |
Cameroon | Attempt 1 | 1.50968 | 0.580445 | 260.091 |
Attempt 2 | 1.66286 | 0.563667 | 295.008 | |
Attempt 3 | 1.72107 | 0.591113 | 291.158 | |
Nepal | Attempt 1 | 1.34875 | 0.600613 | 224.562 |
Attempt 2 | 1.0993 | 0.558992 | 196.658 | |
Attempt 3 | 1.36921 | 0.569797 | 240.298 | |
Overall Average | 1.44465 | 0.579129 | 249.546 |
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((dhis2_performances[-1]/fhir_performances[-1])*100) case_result['improvement'] = 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'] = np.average(improvements) case_results.append(case_result) print(tabulate(case_results, headers='firstrow', tablefmt='html'))