Case 6
Finding Specific orgUnits / Location by Service
Searching orgunits / locations by following services
IUCD
Implant
STI
Sterilization
MA
MVA
Surgical Abortion
In FHIR, we are saving services under HealthcareService resource. And for this search we are performing reverse chaining from Location to HealthcareServices so it's more costly that any of the previous test.
More info on Reverse chaining here.
Summary of test results
| DHIS2 | FHIR | DHIS2 vs FHIR % |
|
---|---|---|---|---|
Average | 0.276735 | 0.313903 | -11.84% |
|
Test detailed results
logged on Dec 1/ 2022 UTC-7 09:23:00
Performance Testing for finding | Attempt | DHIS2 API (s) | FHIR API (s) | Improvement (%) |
---|---|---|---|---|
IUCD | Attempt - 1 | 0.272391 | 0.348378 | -21.81% |
| Attempt - 2 | 0.267497 | 0.359816 | -25.66% |
| Attempt - 3 | 0.262858 | 0.355213 | -26.0% |
Implant | Attempt - 1 | 0.281353 | 0.343937 | -18.2% |
| Attempt - 2 | 0.261588 | 0.351585 | -25.6% |
| Attempt - 3 | 0.270991 | 0.381919 | -29.04% |
STI | Attempt - 1 | 0.280658 | 0.366811 | -23.49% |
| Attempt - 2 | 0.288505 | 0.349213 | -17.38% |
| Attempt - 3 | 0.279506 | 0.362959 | -22.99% |
Sterillization | Attempt - 1 | 0.283504 | 0.288332 | -1.67% |
| Attempt - 2 | 0.28656 | 0.269992 | 6.14% |
| Attempt - 3 | 0.264257 | 0.286922 | -7.9% |
MA | Attempt - 1 | 0.273142 | 0.28648 | -4.66% |
| Attempt - 2 | 0.284315 | 0.291914 | -2.6% |
| Attempt - 3 | 0.274036 | 0.291651 | -6.04% |
MVA | Attempt - 1 | 0.275338 | 0.273843 | 0.55% |
| Attempt - 2 | 0.280349 | 0.264875 | 5.84% |
| Attempt - 3 | 0.28664 | 0.278723 | 2.84% |
Surgical Abortion | Attempt - 1 | 0.278647 | 0.279009 | -0.13% |
| Attempt - 2 | 0.280105 | 0.275763 | 1.57% |
| Attempt - 3 | 0.279203 | 0.284635 | -1.91% |
Overall Average |
| 0.276735 | 0.313903 | -11.84% |
Testing Script
results6 = [{"description": "Performance Testing for finding", "attempt": "Attempt", "dhis2": "DHIS2 API (s)", "fhir": "FHIR API (s)", "improvement": "Improvement (%)"}]
print("Case #6 - Measuring time taken to find outlet / location providing services")
services= ["IUCD", "Implant", "STI", "Sterillization", "MA", "MVA", "Surgical Abortion"]
improvements = []
dhis2_performances = []
fhir_performances = []
for service in services:
for i in range(1,4):
result6 = {}
if i == 1:
result6['description'] = "{}".format(service)
result6['attempt'] = "Attempt - {}".format(i)
dhis2_url = dhis2_base_url+'service={}'.format(service)
result = requests.get(dhis2_url, auth=dhis2_auth)
if result.status_code == 200:
dhis2_performances.append(result.elapsed.total_seconds())
result6['dhis2'] = dhis2_performances[-1]
request_url = fhir_location_url+'_has:HealthcareService:location:name={}'.format(service)
fhirResult = requests.get(request_url, auth=fhir_auth)
if fhirResult.status_code == 200:
fhir_performances.append(fhirResult.elapsed.total_seconds())
result6['fhir'] = fhir_performances[-1]
improvements.append(((dhis2_performances[-1]/fhir_performances[-1])-1)*100)
result6['improvement'] = '{}%'.format(float("{:.2f}".format(improvements[-1])))
results6.append(result6)
time.sleep(0.01)
result6 = {}
result6['description'] = "Overall Average"
result6['dhis2'] = Average(dhis2_performances)
result6['fhir'] = Average(fhir_performances)
result6['improvement'] = '{}%'.format(float("{:.2f}".format(((result6['dhis2']/result6['fhir'])-1)*100)))
results6.append(result6)
print(tabulate(results6, headers='firstrow', tablefmt='pipe'))