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 3 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.416

0.578393

58.8358

Test detailed results

logged on Nov 29/ 2022 UTC-7 08:52:00

Performance Testing for

Attempt

DHIS2 API

DHIS2 Size

FHIR API

FHIR Size

Improvement %

El Salvador

Attempt 1

1.36212

141

0.593179

500

56.4517

Attempt 2

1.4038

141

0.569006

500

59.4668

Attempt 3

1.4126

141

0.567176

500

59.8487

Kenya

Attempt 1

1.51748

500

0.582688

500

61.6017

Attempt 2

1.42406

500

0.575231

500

59.6061

Attempt 3

1.41624

500

0.559239

500

60.5125

Nigeria

Attempt 1

1.5021

500

0.59612

500

60.3143

Attempt 2

1.48585

500

0.56827

500

61.7545

Attempt 3

1.50549

500

0.569342

500

62.1824

Cameroon

Attempt 1

1.46494

500

0.58451

500

60.1

Attempt 2

1.51499

500

0.608725

500

59.8198

Attempt 3

1.50646

500

0.558488

500

62.9271

Nepal

Attempt 1

1.11289

12

0.579574

500

47.9217

Attempt 2

1.41752

12

0.573164

500

59.5659

Attempt 3

1.19342

12

0.591184

500

50.4632

Overall Average

1.416

0.578393

58.8358

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'] = np.average(improvements)
case_results.append(case_result)
print(tabulate(case_results, headers='firstrow', tablefmt='pipe'))

  • No labels