Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 34 commits into from
Dec 4, 2024

Conversation

ellykits
Copy link
Collaborator

@ellykits ellykits commented Nov 22, 2024

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

Fixes #3608 #3495

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for bug fixes
  • I have added any strings visible on UI components to the strings.xml file
  • I have updated the CHANGELOG.md file for any notable changes to the codebase
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the project's style guide
  • I have built and run the FHIRCore app to verify my change fixes the issue and/or does not break the app
  • I have checked that this PR does NOT introduce breaking changes that require an update to Content and/or Configs? If it does add a sample here or a link to exactly what changes need to be made to the content.

Code Reviewer Checklist

  • I have verified Unit tests have been written for any new feature(s) and edge cases
  • I have verified any strings visible on UI components are in the strings.xml file
  • I have verifed the CHANGELOG.md file has any notable changes to the codebase
  • I have verified the solution has been implemented in a configurable and generic way for reuseable components
  • I have built and run the FHIRCore app to verify the change fixes the issue and/or does not break the app

@ellykits ellykits added DNM DO NOT MERGE Performance (App or Server) Work In Progress Describes an items that is not complete. Mostly used for scoping issues of discussions labels Nov 22, 2024
@ellykits ellykits self-assigned this Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 65.89595% with 177 lines in your changes missing coverage. Please review.

Project coverage is 28.1%. Comparing base (996914e) to head (4345469).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...er/fhircore/engine/data/local/DefaultRepository.kt 68.0% 91 Missing and 24 partials ⚠️
...e/engine/data/local/register/RegisterRepository.kt 56.9% 30 Missing and 4 partials ⚠️
...gister/fhircore/engine/rulesengine/RulesFactory.kt 22.7% 16 Missing and 1 partial ⚠️
...core/engine/util/extension/ApplicationExtension.kt 77.7% 3 Missing and 1 partial ⚠️
...rcore/engine/util/extension/FhirEngineExtension.kt 78.5% 1 Missing and 2 partials ⚠️
.../engine/configuration/migration/MigrationConfig.kt 0.0% 1 Missing ⚠️
...er/fhircore/engine/domain/repository/Repository.kt 0.0% 1 Missing ⚠️
...fhircore/engine/rulesengine/ConfigRulesExecutor.kt 90.9% 1 Missing ⚠️
...rtregister/fhircore/engine/sync/SyncBroadcaster.kt 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #3634     +/-   ##
=========================================
+ Coverage     27.4%   28.1%   +0.6%     
- Complexity     789     798      +9     
=========================================
  Files          282     282             
  Lines        14695   14510    -185     
  Branches      2632    2589     -43     
=========================================
+ Hits          4040    4082     +42     
+ Misses       10100    9889    -211     
+ Partials       555     539     -16     
Flag Coverage Δ
engine 64.2% <65.8%> (+0.5%) ⬆️
geowidget 16.0% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ister/fhircore/engine/domain/model/ActionConfig.kt 79.5% <100.0%> (ø)
...core/engine/domain/model/RepositoryResourceData.kt 100.0% <ø> (ø)
...ister/fhircore/engine/rulesengine/RulesExecutor.kt 85.1% <100.0%> (ø)
...ister/fhircore/engine/rulesengine/RulesListener.kt 84.2% <ø> (-1.3%) ⬇️
...tregister/fhircore/engine/task/FhirResourceUtil.kt 82.9% <100.0%> (ø)
...hircore/engine/util/extension/ResourceExtension.kt 67.8% <ø> (ø)
...g/smartregister/fhircore/quest/QuestApplication.kt 0.0% <ø> (ø)
...smartregister/fhircore/quest/data/DataMigration.kt 9.3% <ø> (+0.8%) ⬆️
...ircore/quest/data/register/RegisterPagingSource.kt 0.0% <ø> (ø)
...t/data/register/model/RegisterPagingSourceState.kt 80.0% <ø> (ø)
... and 21 more

... and 3 files with indirect coverage changes

@ellykits ellykits marked this pull request as ready for review November 27, 2024 18:13
@ellykits ellykits removed DNM DO NOT MERGE Work In Progress Describes an items that is not complete. Mostly used for scoping issues of discussions labels Nov 27, 2024
Signed-off-by: Elly Kitoto <[email protected]>
Signed-off-by: Elly Kitoto <[email protected]>
Signed-off-by: Elly Kitoto <[email protected]>
Signed-off-by: Elly Kitoto <[email protected]>
@ellykits ellykits force-pushed the register-performance-improv branch from 61ff499 to e46af39 Compare November 28, 2024 09:29
@ellykits ellykits merged commit 65b5589 into main Dec 4, 2024
5 checks passed
@ellykits ellykits deleted the register-performance-improv branch December 4, 2024 21:45
Lentumunai-Mark added a commit that referenced this pull request Dec 5, 2024
…erformance (#3634)

* Start register data refactor

Signed-off-by: Elly Kitoto <[email protected]>

* Fix loading related resources data

Signed-off-by: Elly Kitoto <[email protected]>

* Optimize import

Signed-off-by: Elly Kitoto <[email protected]>

* Refactor implementation for counting related resources

Signed-off-by: Elly Kitoto <[email protected]>

* Refactor implementation for loading profile data

Signed-off-by: Elly Kitoto <[email protected]>

* Refactor the rest of implementation using DefaultRepository

Signed-off-by: Elly Kitoto <[email protected]>

* Use coding system on REL filter query

Signed-off-by: Elly Kitoto <[email protected]>

* Fix count with REL filter applied

Signed-off-by: Elly Kitoto <[email protected]>

* Refactor retrieval of REL tag locationIds

Signed-off-by: Elly Kitoto <[email protected]>

* Revert paging3 implementation

Signed-off-by: Elly Kitoto <[email protected]>

* Set pager prefetch size to half of page size

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotless

Signed-off-by: Elly Kitoto <[email protected]>

* Refactor code

Signed-off-by: Elly Kitoto <[email protected]>

* Fix redundant count of related resources

Signed-off-by: Elly Kitoto <[email protected]>

* Refactor implementation

Signed-off-by: Elly Kitoto <[email protected]>

* Remove unnecessary coroutine context switching

Signed-off-by: Elly Kitoto <[email protected]>

* Fix failing engine tests

Signed-off-by: Elly Kitoto <[email protected]>

* Fix failing tests

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotlessApply

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotless

Signed-off-by: Elly Kitoto <[email protected]>

* Fix failing lint check

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotlessApply

Signed-off-by: Elly Kitoto <[email protected]>

* Fix failing lint check

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotlessApply

Signed-off-by: Elly Kitoto <[email protected]>

* Fix failing tests

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotlessApply

Signed-off-by: Elly Kitoto <[email protected]>

* Format code

Signed-off-by: Elly Kitoto <[email protected]>

---------

Signed-off-by: Elly Kitoto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce memory footprint on registers and profiles
1 participant