Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 4 Next »

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.42669

0.578819

59.4293

Test detailed results

logged on Nov 29/ 2022 UTC-7 09:16:00

Performance Testing for

Attempt

DHIS2 API

DHIS2 Size

FHIR API

FHIR Size

Improvement %

El Salvador

Attempt 1

1.37355

141

0.598687

500

56.4133

Attempt 2

1.3631

141

0.569395

500

58.228

Attempt 3

1.46057

141

0.595058

500

59.2586

Kenya

Attempt 1

1.43973

500

0.593388

500

58.7847

Attempt 2

1.43513

500

0.582957

500

59.3796

Attempt 3

1.48656

500

0.557877

500

62.4718

Nigeria

Attempt 1

1.50456

500

0.583583

500

61.2125

Attempt 2

1.50682

500

0.566507

500

62.4039

Attempt 3

1.47951

500

0.572773

500

61.2864

Cameroon

Attempt 1

1.49727

500

0.579295

500

61.31

Attempt 2

1.57967

500

0.584989

500

62.9676

Attempt 3

1.47999

500

0.569686

500

61.5074

Nepal

Attempt 1

1.57151

12

0.587268

500

62.6305

Attempt 2

1.11562

12

0.565472

500

49.3134

Attempt 3

1.10675

12

0.575349

500

48.0143

Overall Average

1.42669

0.578819

59.4293

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'])/case_result['dhis2'])*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'] = ((case_result['dhis2'] - case_result['fhir'])/case_result['dhis2'])*100
case_results.append(case_result)
print(tabulate(case_results, headers='firstrow', tablefmt='pipe'))

  • No labels