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

Prototype to create a separate sync module #429

Closed
wants to merge 1 commit into from

Conversation

jingtang10
Copy link
Collaborator

@jingtang10 jingtang10 commented Apr 5, 2021

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

Fixes #428

Description
Separate the sync code into a new module. This is done via creating clear separation of concerns in the FhirEngine API.

suspend fun syncDownload(download: suspend (suspend (ResourceType) -> String?) -> List<Resource>)
suspend fun syncUpload(upload: (suspend (List<Resource>) -> Unit)?)

Alternative(s) considered
This is an improvement on the existing approach.

Type
Choose one: Feature

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct
  • I have read How to Contribute
  • I have read the Developer's guide
  • 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 reference app(s) to verify my change fixes the issue and/or does not break the reference app(s)

Copy link
Contributor

@deepankarb deepankarb left a comment

Choose a reason for hiding this comment

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

Thanks Jing! Left a few comments.

import org.hl7.fhir.r4.model.ResourceType

@Dao
interface SyncedResourceDao {

@Insert(onConflict = OnConflictStrategy.REPLACE) suspend fun insert(entity: SyncedResourceEntity)

@Transaction
suspend fun insertAll(resources: List<SyncedResourceEntity>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use kotlin var args for API consistency?

reference/build.gradle.kts Show resolved Hide resolved
* `SyncData(ResourceType.Patient, mapOf("address-country" to "United States")`
*/
typealias ParamMap = Map<String, String>
typealias SyncData = Map<ResourceType, ParamMap>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we improve on the naming SyncData. Off the cuff it sounds like data that needs be synced whereas this is more like Sync parameters by resource. Maybe ResourceSyncParams?

@jingtang10
Copy link
Collaborator Author

closing this as this is being reworked in #482

@jingtang10 jingtang10 closed this May 18, 2021
@jingtang10 jingtang10 deleted the jt/sync-module branch April 16, 2022 12:54
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.

Seperate synchronization APIs from data access APIs
3 participants