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 the DownloadManager interface #1266

Merged
merged 9 commits into from
Mar 29, 2022
Merged

Refactor the DownloadManager interface #1266

merged 9 commits into from
Mar 29, 2022

Conversation

jingtang10
Copy link
Collaborator

@jingtang10 jingtang10 commented Mar 29, 2022

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Description
Refactor the DownloadManager interface:

  • Renames it to DownloadWorkManager to signify that it only handles a single "download job" and needs to be reset/recreated before the next download job (to be clarified).
  • Makes the handling of the URL an internal feature of the DownloadWorkManager. In other words, the DownloadWorkManager acts as an iterator that provides the URL for the next download request.
  • Combines extractResourcesFromResponse and extractNextUrlsFromResource into a single processResponse function.
  • Extracts the createDownloadUrl function as a utility function outside of the interface because it is something that is universal to FHIR requests and not tied down to any single implementation of the `DownloadWorkManager.

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type
Code health

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

Copy link
Collaborator

@aditya-07 aditya-07 left a comment

Choose a reason for hiding this comment

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

LGTM

@omarismail94 omarismail94 enabled auto-merge (squash) March 29, 2022 18:05
@codecov
Copy link

codecov bot commented Mar 29, 2022

Codecov Report

Merging #1266 (7585131) into master (a292e50) will decrease coverage by 0.27%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master    #1266      +/-   ##
============================================
- Coverage     84.15%   83.87%   -0.28%     
  Complexity      666      666              
============================================
  Files           146      146              
  Lines         10609    10605       -4     
  Branches        807      838      +31     
============================================
- Hits           8928     8895      -33     
+ Misses         1278     1277       -1     
- Partials        403      433      +30     
Impacted Files Coverage Δ
...src/main/java/com/google/android/fhir/sync/Sync.kt 23.80% <ø> (ø)
...n/java/com/google/android/fhir/sync/SyncJobImpl.kt 53.48% <ø> (-4.66%) ⬇️
...ava/com/google/android/fhir/sync/FhirSyncWorker.kt 93.47% <100.00%> (ø)
...a/com/google/android/fhir/sync/FhirSynchronizer.kt 79.31% <100.00%> (-3.45%) ⬇️
...oogle/android/fhir/sync/download/DownloaderImpl.kt 100.00% <100.00%> (ø)
...alidation/PrimitiveTypeAnswerMinLengthValidator.kt 70.00% <0.00%> (-20.00%) ⬇️
...com/google/android/fhir/datacapture/DataCapture.kt 66.66% <0.00%> (-16.67%) ⬇️
...main/java/com/google/android/fhir/DatastoreUtil.kt 80.00% <0.00%> (-10.00%) ⬇️
...roid/fhir/datacapture/validation/RegexValidator.kt 85.71% <0.00%> (-7.15%) ⬇️
...java/com/google/android/fhir/resource/Resources.kt 53.33% <0.00%> (-6.67%) ⬇️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92cceb7...7585131. Read the comment docs.

@omarismail94 omarismail94 merged commit 0ddd8e1 into master Mar 29, 2022
@omarismail94 omarismail94 deleted the jt/downloader branch March 29, 2022 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Provide Resource Sync map based DownloadManager implementation in the ENgine
3 participants