Skip to content

Commit

Permalink
Merge branch 'master' into quirks-patches
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin authored Sep 20, 2023
2 parents 8de5078 + 8737783 commit b9ded79
Show file tree
Hide file tree
Showing 40 changed files with 1,168 additions and 932 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds
**Screenshots (if applicable)**

**Checklist**
- [ ] I have read and acknowledged the [Code of conduct](https://github.com/google/android-fhir/blob/master/docs/CODE_OF_CONDUCT.md).
- [ ] I have read and acknowledged the [Code of conduct](https://github.com/google/android-fhir/blob/master/CODE_OF_CONDUCT.md).
- [ ] I have read the [Contributing](https://github.com/google/android-fhir/wiki/Contributing) page.
- [ ] I have signed the Google [Individual CLA](https://cla.developers.google.com/about/google-individual), or I am covered by my company's [Corporate CLA](https://cla.developers.google.com/about/google-corporate ).
- [ ] I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
package com.google.android.fhir.demo.data

import com.google.android.fhir.demo.DemoDataStore
import com.google.android.fhir.sync.DownloadRequest
import com.google.android.fhir.sync.DownloadWorkManager
import com.google.android.fhir.sync.SyncDataParams
import com.google.android.fhir.sync.download.DownloadRequest
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Date
Expand Down Expand Up @@ -98,14 +98,15 @@ class TimestampBasedDownloadWorkManagerImpl(private val dataStore: DemoDataStore
}

private suspend fun extractAndSaveLastUpdateTimestampToFetchFutureUpdates(
resources: List<Resource>
resources: List<Resource>,
) {
resources
.groupBy { it.resourceType }
.entries.map { map ->
.entries
.map { map ->
dataStore.saveLastUpdatedTimestamp(
map.key,
map.value.maxOfOrNull { it.meta.lastUpdated }?.toTimeZoneString() ?: ""
map.value.maxOfOrNull { it.meta.lastUpdated }?.toTimeZoneString() ?: "",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import com.google.android.fhir.FhirEngineConfiguration
import com.google.android.fhir.FhirEngineProvider
import com.google.android.fhir.ServerConfiguration
import com.google.android.fhir.sync.AcceptRemoteConflictResolver
import com.google.android.fhir.sync.DownloadRequest
import com.google.android.fhir.sync.DownloadWorkManager
import com.google.android.fhir.sync.FhirSyncWorker
import com.google.android.fhir.sync.download.DownloadRequest
import com.google.common.truth.Truth.assertThat
import java.math.BigDecimal
import java.util.LinkedList
Expand Down Expand Up @@ -77,13 +77,15 @@ class FhirSyncWorkerBenchmark {

class BenchmarkTestOneTimeSyncWorker(
private val appContext: Context,
workerParams: WorkerParameters
workerParams: WorkerParameters,
) : FhirSyncWorker(appContext, workerParams) {

override fun getFhirEngine(): FhirEngine {
return FhirEngineProvider.getInstance(appContext)
}

override fun getDownloadWorkManager(): DownloadWorkManager = BenchmarkTestDownloadManagerImpl()

override fun getConflictResolver() = AcceptRemoteConflictResolver
}

Expand All @@ -92,6 +94,7 @@ class FhirSyncWorkerBenchmark {
private val urls = LinkedList(queries)

override suspend fun getNextRequest() = urls.poll()?.let { DownloadRequest.of(it) }

override suspend fun getSummaryRequestUrls(): Map<ResourceType, String> {
return emptyMap()
}
Expand Down Expand Up @@ -142,7 +145,7 @@ class FhirSyncWorkerBenchmark {
private fun setupMockServerDispatcher(
numberPatients: Int,
numberObservations: Int,
numberEncounters: Int
numberEncounters: Int,
) {
mockWebServer.dispatcher =
object : Dispatcher() {
Expand Down Expand Up @@ -209,14 +212,17 @@ class FhirSyncWorkerBenchmark {
return Patient().apply {
id = patientId
gender =
if (patientId.last().isDigit()) Enumerations.AdministrativeGender.FEMALE
else Enumerations.AdministrativeGender.MALE
if (patientId.last().isDigit()) {
Enumerations.AdministrativeGender.FEMALE
} else {
Enumerations.AdministrativeGender.MALE
}
name =
listOf(
HumanName().apply {
given = listOf(StringType("Test patient Name $patientId"))
family = "Patient Family"
}
},
)
address =
listOf(
Expand All @@ -227,7 +233,7 @@ class FhirSyncWorkerBenchmark {
state = "Vic"
postalCode = "postalCode"
line = listOf(StringType("534 Erewhon St"))
}
},
)
contact =
listOf(
Expand All @@ -242,11 +248,14 @@ class FhirSyncWorkerBenchmark {
family = "Patient Family"
}
gender =
if (patientId.last().isDigit()) Enumerations.AdministrativeGender.MALE
else Enumerations.AdministrativeGender.FEMALE
}
if (patientId.last().isDigit()) {
Enumerations.AdministrativeGender.MALE
} else {
Enumerations.AdministrativeGender.FEMALE
}
},
)
}
},
)
telecom =
listOf(
Expand All @@ -259,7 +268,7 @@ class FhirSyncWorkerBenchmark {
system = ContactPoint.ContactPointSystem.PHONE
value = "(03) 3410 5613"
use = ContactPoint.ContactPointUse.WORK
}
},
)
}
}
Expand Down Expand Up @@ -298,17 +307,17 @@ class FhirSyncWorkerBenchmark {
code = "kPa"
system = "http://unitsofmeasure.org"
}
}
},
)
interpretation =
listOf(
CodeableConcept(
Coding(
"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"H",
"high"
)
)
"high",
),
),
)
}
}
Expand All @@ -328,7 +337,7 @@ class FhirSyncWorkerBenchmark {
CodeableConcept().apply {
coding =
listOf(Coding("http://snomed.info/sct", "183807002", "Inpatient stay for nine days"))
}
},
)
subject = Reference("Patient/$patientId")
episodeOfCare = listOf(Reference("Episode/${UUID.randomUUID()}"))
Expand All @@ -345,12 +354,12 @@ class FhirSyncWorkerBenchmark {
Coding(
"http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"PART",
"Participant"
)
"Participant",
),
)
}
},
)
}
},
)
diagnosis =
listOf(
Expand All @@ -363,8 +372,8 @@ class FhirSyncWorkerBenchmark {
Coding(
"http://terminology.hl7.org/CodeSystem/diagnosis-role",
"AD",
"Admission diagnosis"
)
"Admission diagnosis",
),
)
}
},
Expand All @@ -377,11 +386,11 @@ class FhirSyncWorkerBenchmark {
Coding(
"http://terminology.hl7.org/CodeSystem/diagnosis-role",
"DD",
"Discharge diagnosis"
)
"Discharge diagnosis",
),
)
}
}
},
)
}
}
Expand All @@ -397,8 +406,8 @@ class FhirSyncWorkerBenchmark {
FhirEngineProvider.init(
FhirEngineConfiguration(
serverConfiguration = ServerConfiguration("http://127.0.0.1:$mockServerPort/fhir/"),
testMode = true
)
testMode = true,
),
)
mockWebServer.start(mockServerPort)
}
Expand Down
4 changes: 2 additions & 2 deletions engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ tasks.dokkaHtml.configure {
sourceLink {
localDirectory.set(file("src/main/java"))
remoteUrl.set(
URL("https://github.com/google/android-fhir/tree/master/engine/src/main/java")
URL("https://github.com/google/android-fhir/tree/master/engine/src/main/java"),
)
remoteLineSuffix.set("#L")
}
externalDocumentationLink {
url.set(URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/"))
packageListUrl.set(
URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/element-list")
URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/element-list"),
)
}
}
Expand Down
Loading

0 comments on commit b9ded79

Please sign in to comment.