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

Add configuration to generate MeasureReports in the background (#2515) #2520

Merged
merged 12 commits into from
Jul 12, 2023

Conversation

ndegwamartin
Copy link
Contributor

@ndegwamartin ndegwamartin commented Jul 4, 2023

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

Fixes #2307

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

* Add configuration to generate MeasureReports in the background
* Set default report config startPeriod, remove subject from existing measureReport retrieval
* Exclude Subjects from existing measure report retrieval search

---------

Co-authored-by: Martin Ndegwa <ndegwamartin@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Merging #2520 (b723c7e) into main (d84c2c8) will decrease coverage by 0.3%.
The diff coverage is 60.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #2520     +/-   ##
=========================================
- Coverage     65.4%   65.1%   -0.3%     
- Complexity    1101    1110      +9     
=========================================
  Files          213     215      +2     
  Lines         9385    9544    +159     
  Branches      1866    1899     +33     
=========================================
+ Hits          6140    6217     +77     
- Misses        2047    2120     +73     
- Partials      1198    1207      +9     
Flag Coverage Δ
engine 72.9% <66.8%> (-0.3%) ⬇️
geowidget 62.9% <37.5%> (-0.3%) ⬇️
quest 60.1% <57.2%> (-0.3%) ⬇️

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

Impacted Files Coverage Δ
...ter/fhircore/engine/configuration/Configuration.kt 25.0% <ø> (ø)
...ngine/configuration/event/EventTriggerCondition.kt 50.0% <0.0%> (ø)
...ircore/engine/configuration/event/EventWorkflow.kt 33.3% <0.0%> (ø)
...ore/engine/configuration/view/DividerProperties.kt 0.0% <0.0%> (ø)
...ngine/configuration/view/PersonalDataProperties.kt 0.0% <0.0%> (ø)
...hircore/engine/configuration/view/RowProperties.kt 0.0% <ø> (ø)
...ine/configuration/view/ViewPropertiesSerializer.kt 23.8% <0.0%> (ø)
...data/remote/fhir/resource/FhirResourceConverter.kt 100.0% <ø> (ø)
...hircore/engine/domain/model/ActionParameterType.kt 100.0% <ø> (ø)
...hircore/engine/domain/model/FhirResourceConfigs.kt 44.4% <0.0%> (ø)
... and 157 more

... and 10 files with indirect coverage changes

@pld
Copy link
Member

pld commented Jul 5, 2023

@ndegwamartin this doesn't seem like the correct fixes ref

@roywanyaga roywanyaga added the DNM DO NOT MERGE label Jul 10, 2023
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, MeasureReportConfig> {
return try {
LoadResult.Page(data = measureReportConfiguration.reports, prevKey = null, nextKey = null)
} catch (exception: Exception) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we catch something more specific?

}
}
Timber.i("Result.success / . . . MeasureReportWorker . . ./")
} catch (e: Exception) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a more specific exception?

@pld pld assigned pld and unassigned roywanyaga Jul 11, 2023
Comment on lines +58 to +60
* This method always sets the start and end date of the month to be the first and last day of the
* current month. If you are using this worker to generate monthly reports it enqueue a new worker
* at least every 24 hours.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure this is correct, need to think about this a bit more to see if there's an edge case that misses data from the previous month when the date changes.

Copy link
Member

@pld pld Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is actually still a problem, since it’s using “today” to figure out the current month instead of the date it was enqueued. This is what I’m thinking, if it’s the last day of the month, you run the worker, and enqueue another worker for tomorrow. Then you collect more data. That new data you collected will never appear in the previous months measure report, because by the time the enqueued measure report runs it will be tomorrow, in the next month, and that run will be for the next month.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One (simple?) solution is to have today be set when the worker is enqueued, instead of when the worker is run. then when you enqueue a worker on the last day of the month, and proceed to collect some data, when that worker runs it will cover all the data for the previous month, during which it was enqueued.

This also seems to match expected behavior... better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created this issue to track this, #2567

@pld pld force-pushed the scheduled-report-config-main branch from d90a84e to 21cfb9c Compare July 11, 2023 18:23
@pld pld force-pushed the scheduled-report-config-main branch from 532b917 to 543158b Compare July 12, 2023 01:01
@pld pld force-pushed the scheduled-report-config-main branch 2 times, most recently from 14bf673 to 4c6ae86 Compare July 12, 2023 02:11
@pld pld force-pushed the scheduled-report-config-main branch from 4c6ae86 to b723c7e Compare July 12, 2023 02:19
Copy link
Member

@pld pld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow-up tasks in #2567

@pld pld merged commit 3bbbb7a into main Jul 12, 2023
@pld pld deleted the scheduled-report-config-main branch July 12, 2023 03:09
qiarie pushed a commit that referenced this pull request Jan 15, 2025
#2520)

* add configuration to generate MeasureReports in the background (#2515)

* Add configuration to generate MeasureReports in the background
* Set default report config startPeriod, remove subject from existing measureReport retrieval
* Exclude Subjects from existing measure report retrieval search

---------

Co-authored-by: Martin Ndegwa <ndegwamartin@users.noreply.github.com>

* cleanup and notes

* fix typo

* remove comment

* add a failing test to run eval pop measure

* catch exception with bad measure url

* change MeasureReportConfig to ReportConfiguration, add tests

* upgrade spotless and lint, use trailing commas per new lint recs

---------

Co-authored-by: Roy <84201465+roywanyaga@users.noreply.github.com>
Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>
Co-authored-by: Peter Lubell-Doughtie <peter@ona.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNM DO NOT MERGE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[In-App Reporting] Add configuration to enable loading of specific reports in the background
5 participants