opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://opensrp.io
Apache License 2.0
58 stars 59 forks source link

Refactor implementation for loading data on repositories to improve performance #3634

Open ellykits opened 3 days ago

ellykits commented 3 days ago

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes https://github.com/opensrp/fhircore/issues/3608 https://github.com/opensrp/fhircore/issues/3495

Engineer Checklist

Code Reviewer Checklist

codecov[bot] commented 3 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 26.6%. Comparing base (8ee171a) to head (557e024). Report is 2 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/opensrp/fhircore/pull/3634/graphs/tree.svg?width=650&height=150&src=pr&token=IJUTHZUGGH&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp)](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) ```diff @@ Coverage Diff @@ ## main #3634 +/- ## ========================================= - Coverage 27.3% 26.6% -0.8% + Complexity 787 749 -38 ========================================= Files 282 282 Lines 14699 14021 -678 Branches 2634 2532 -102 ========================================= - Hits 4023 3733 -290 + Misses 10132 9794 -338 + Partials 544 494 -50 ``` | [Flag](https://app.codecov.io/gh/opensrp/fhircore/pull/3634/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | Coverage Δ | | |---|---|---| | [geowidget](https://app.codecov.io/gh/opensrp/fhircore/pull/3634/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | `16.0% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | Coverage Δ | | |---|---|---| | [.../engine/configuration/migration/MigrationConfig.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fconfiguration%2Fmigration%2FMigrationConfig.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvY29uZmlndXJhdGlvbi9taWdyYXRpb24vTWlncmF0aW9uQ29uZmlnLmt0) | `0.0% <ø> (ø)` | | | [...er/fhircore/engine/data/local/DefaultRepository.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fdata%2Flocal%2FDefaultRepository.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvZGF0YS9sb2NhbC9EZWZhdWx0UmVwb3NpdG9yeS5rdA==) | `61.0% <ø> (+2.4%)` | :arrow_up: | | [...e/engine/data/local/register/RegisterRepository.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fdata%2Flocal%2Fregister%2FRegisterRepository.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvZGF0YS9sb2NhbC9yZWdpc3Rlci9SZWdpc3RlclJlcG9zaXRvcnkua3Q=) | `84.0% <ø> (+12.7%)` | :arrow_up: | | [...ister/fhircore/engine/domain/model/ActionConfig.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fdomain%2Fmodel%2FActionConfig.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvZG9tYWluL21vZGVsL0FjdGlvbkNvbmZpZy5rdA==) | `79.1% <ø> (-0.5%)` | :arrow_down: | | [...core/engine/domain/model/RepositoryResourceData.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fdomain%2Fmodel%2FRepositoryResourceData.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvZG9tYWluL21vZGVsL1JlcG9zaXRvcnlSZXNvdXJjZURhdGEua3Q=) | `100.0% <ø> (ø)` | | | [...er/fhircore/engine/domain/repository/Repository.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fdomain%2Frepository%2FRepository.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvZG9tYWluL3JlcG9zaXRvcnkvUmVwb3NpdG9yeS5rdA==) | `33.3% <ø> (+6.0%)` | :arrow_up: | | [...gister/fhircore/engine/rulesengine/RulesFactory.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Frulesengine%2FRulesFactory.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvcnVsZXNlbmdpbmUvUnVsZXNGYWN0b3J5Lmt0) | `67.3% <ø> (-0.2%)` | :arrow_down: | | [...ister/fhircore/engine/rulesengine/RulesListener.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Frulesengine%2FRulesListener.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvcnVsZXNlbmdpbmUvUnVsZXNMaXN0ZW5lci5rdA==) | `84.2% <ø> (-1.3%)` | :arrow_down: | | [...rtregister/fhircore/engine/sync/SyncBroadcaster.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Fsync%2FSyncBroadcaster.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvc3luYy9TeW5jQnJvYWRjYXN0ZXIua3Q=) | `21.6% <ø> (+0.5%)` | :arrow_up: | | [...rcore/engine/util/extension/FhirEngineExtension.kt](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree&filepath=android%2Fengine%2Fsrc%2Fmain%2Fjava%2Forg%2Fsmartregister%2Ffhircore%2Fengine%2Futil%2Fextension%2FFhirEngineExtension.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp#diff-YW5kcm9pZC9lbmdpbmUvc3JjL21haW4vamF2YS9vcmcvc21hcnRyZWdpc3Rlci9maGlyY29yZS9lbmdpbmUvdXRpbC9leHRlbnNpb24vRmhpckVuZ2luZUV4dGVuc2lvbi5rdA==) | `53.8% <ø> (-5.0%)` | :arrow_down: | | ... and [16 more](https://app.codecov.io/gh/opensrp/fhircore/pull/3634?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp) | | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/opensrp/fhircore/pull/3634/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensrp)

🚨 Try these New Features: