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

Overload FhirEngine.get() to Allow Fetching Multiple Resources by their IDs #2743

Draft
wants to merge 237 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
237 commits
Select commit Hold shift + click to select a range
7aa06df
OpenSRP Sonatype Publishing Set Up
ndegwamartin Feb 24, 2023
7544694
Merge branch 'master' into main-release
ndegwamartin Feb 24, 2023
10e46a0
SDK Release: Engine, SDC
ndegwamartin Feb 24, 2023
fb3b13b
SDK Release: Barcode
ndegwamartin Mar 1, 2023
167e896
SDK Release: Engine
ndegwamartin Mar 3, 2023
0ca0813
Merge branch 'master' into main-release
allan-on Mar 3, 2023
abd41d0
SDK Release: Engine
allan-on Mar 3, 2023
4422497
Merge branch 'master' into main-release
ndegwamartin Mar 21, 2023
32952bb
Reinstate Sonatype support
ndegwamartin Mar 21, 2023
8274e48
SDK Release: SDC, Engine, Workflow
ndegwamartin Mar 21, 2023
4a68b78
Merge branch 'master' of github.com:opensrp/android-fhir into master-…
allan-on Apr 14, 2023
d59c542
SDK Release: Engine
allan-on Apr 14, 2023
3c2bc65
SDK Release: SDC
allan-on Apr 17, 2023
84b229f
Merge branch 'master' of github.com:opensrp/android-fhir into master-…
allan-on Apr 26, 2023
9a5c079
SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger
allan-on Apr 26, 2023
de945a5
SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger
ndegwamartin May 11, 2023
ec81cbf
Merge branch 'master' into master-release
ndegwamartin May 23, 2023
ffa535a
SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger
ndegwamartin May 23, 2023
fc9a379
Merge branch 'master' into master-release
ndegwamartin Jun 15, 2023
6968bf1
SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger
ndegwamartin Jun 15, 2023
6102e52
Merge branch 'master' into master-release
ndegwamartin Jun 23, 2023
e87bf59
SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Know…
ndegwamartin Jun 23, 2023
efee30b
Merge branch 'master' into master-release
ndegwamartin Jun 26, 2023
92b1938
SDK Release: Engine, SDC, Workflow, Contrib:Barcode, Common, Knowledger
ndegwamartin Jun 26, 2023
1327fec
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Aug 22, 2023
7a45e18
New API to support saving local only resources
ndegwamartin Aug 23, 2023
0cae350
API access for data in the LocalChangeEntity table
ndegwamartin Aug 23, 2023
bb1f2eb
Add a SyncJobStatus result callback amid Sync retries
ndegwamartin Aug 23, 2023
a6b0ec2
Engine, SDC, Workflow, Common, Knowledge
ndegwamartin Aug 22, 2023
bf060ad
Spotless formatting
ndegwamartin Aug 23, 2023
75f243d
Engine, SDC, Workflow, Common, Knowledge
ndegwamartin Aug 28, 2023
57b4773
Merge branch 'master' into master-release
ndegwamartin Sep 7, 2023
d7036a9
Engine, SDC, Workflow, Common, Knowledge
ndegwamartin Sep 7, 2023
49ca6fa
Merge branch 'master' into quirks-patches
ndegwamartin Sep 13, 2023
714290d
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Sep 13, 2023
edb2842
Engine, SDC, Workflow, Common, Knowledge
ndegwamartin Sep 13, 2023
95633d2
Refactor SquashedLocalChanges to LocalChanges
ndegwamartin Sep 14, 2023
8de5078
Merge branch 'master' into quirks-patches
f-odhiambo Sep 14, 2023
e31fc6f
New API to support saving local only resources
ndegwamartin Aug 23, 2023
efd3444
Add API to support saving local only resources
ndegwamartin Sep 16, 2023
f43abf5
Merge branch 'master' into local-only-resources
ndegwamartin Sep 16, 2023
6a1ccc3
Merge branch 'master' into master-release
ndegwamartin Sep 18, 2023
283ad6e
Engine, SDC, Workflow, Knowledge
ndegwamartin Sep 18, 2023
b9ded79
Merge branch 'master' into quirks-patches
ndegwamartin Sep 20, 2023
1721a4a
Revert "New API to support saving local only resources"
ndegwamartin Sep 20, 2023
52ff928
Merge branch 'master' into master-release
ndegwamartin Sep 21, 2023
3a33df4
Merge branch 'master' into local-only-resources
ndegwamartin Sep 21, 2023
110c322
Merge branch 'master' into quirks-patches
ndegwamartin Sep 21, 2023
658f9c4
Engine, SDC
ndegwamartin Sep 21, 2023
78d5bb5
Refactor create local only changes API
ndegwamartin Sep 21, 2023
d8401b9
Merge branch 'master' into local-only-resources
ndegwamartin Sep 21, 2023
563c233
Rename test cases
ndegwamartin Sep 21, 2023
7d7d440
Revert return type for Test Utilites create method signature
ndegwamartin Sep 21, 2023
0fc5d21
Merge branch 'master' into local-only-resources
ndegwamartin Oct 2, 2023
6d7f341
Merge branch 'master' into master-release
ndegwamartin Oct 13, 2023
fcb6691
Merge branch 'master' into local-only-resources
ndegwamartin Oct 13, 2023
e325ba4
Merge branch 'master' into quirks-patches
ndegwamartin Oct 13, 2023
c9ca366
Disable eTAGs for Uploads
ndegwamartin Oct 13, 2023
ac92d70
Engine, SDC, Workflow, Common, Knowledge
ndegwamartin Oct 13, 2023
136833a
Apply Spotless
ndegwamartin Oct 13, 2023
c7d2465
Merge branch 'master' into local-only-resources
ndegwamartin Oct 17, 2023
824e171
Merge branch 'master' into local-only-resources
ndegwamartin Oct 24, 2023
b695b46
Merge branch 'master' into local-only-resources
ndegwamartin Oct 30, 2023
ea0ebef
Merge branch 'master' into quirks-patches
ndegwamartin Oct 30, 2023
944868f
Merge branch 'master' into master-release
ndegwamartin Oct 30, 2023
111c662
Engine, SDC, Workflow, Common, Knowledge
ndegwamartin Oct 30, 2023
afbfd9a
Fix build for Insert Local Only
ndegwamartin Oct 30, 2023
9615372
Merge branch 'master' into local-only-resources
f-odhiambo Nov 7, 2023
a25182b
Merge branch 'master' into master-release
Rkareko Nov 24, 2023
5276c82
Engine, SDC, Workflow, Common, Knowledge
Rkareko Nov 24, 2023
de504eb
Merge branch 'master' into quirks-patches
Rkareko Nov 24, 2023
000fa42
Merge branch 'master' into local-only-resources
Rkareko Nov 24, 2023
7386fd4
Merge branch 'master' of github.com:opensrp/android-fhir into master-…
Rkareko Dec 19, 2023
d03017a
Engine, SDC, Workflow, Common, Knowledge
Rkareko Dec 19, 2023
8c43299
Merge master into quirks-patches
Rkareko Dec 20, 2023
6ebc36d
Disable eTAGs for Uploads
Rkareko Dec 20, 2023
2a437d0
Merge branch 'master' of github.com:opensrp/android-fhir into master-…
Rkareko Jan 9, 2024
dfe6232
Engine, SDC, Workflow, Common, Knowledge, Datacapture, Contrib, Catalog
Rkareko Jan 9, 2024
6893a6a
Merge branch 'master' of github.com:opensrp/android-fhir into master-…
Rkareko Jan 10, 2024
219cd36
Engine, Workflow
Rkareko Jan 10, 2024
d881d97
Merge branch 'master' into master-release
ndegwamartin Jan 22, 2024
64ffbae
SDC, Engine, Workflow
ndegwamartin Jan 22, 2024
79b9ca7
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Jan 24, 2024
e049913
SDC : Minor Data capture version update
ndegwamartin Jan 24, 2024
4279623
Merge branch 'google:master' into master-release
ndegwamartin Jan 31, 2024
675602b
Merge branch 'master' into local-only-resources
ndegwamartin Feb 7, 2024
320ee39
Merge branch 'master' into quirks-patches
ndegwamartin Feb 7, 2024
465c684
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Feb 7, 2024
4f0fea0
Release Engine, SDC
ndegwamartin Feb 7, 2024
65a342d
Merge branch 'master' into quirks-patches
ndegwamartin Feb 9, 2024
7534916
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Feb 9, 2024
3e4ccf8
Release SDC, Workflow
ndegwamartin Feb 9, 2024
e6439e3
Update Clinical Reasoning version to PRE9
ndegwamartin Feb 9, 2024
7097dfb
Expose overloaded API for evaluateMeasure
ndegwamartin Feb 9, 2024
c5cb3c7
Release SDC, Workflow, Location Widget
ndegwamartin Feb 12, 2024
4dbbca5
Merge branch 'master' into master-release
ndegwamartin Mar 19, 2024
1942489
Merge branch 'master' into quirks-patches
ndegwamartin Mar 19, 2024
afb0f8c
Merge branch 'master' into local-only-resources
ndegwamartin Mar 19, 2024
207190c
SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common,…
ndegwamartin Mar 19, 2024
d373dd1
Merge branch 'google:master' into master-release
ndegwamartin Mar 22, 2024
91795e8
SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common,…
ndegwamartin Mar 22, 2024
c3d476f
Merge branch 'master' into quirks-patches
ndegwamartin Mar 22, 2024
a3932bc
Merge branch 'master' into quirks-patches
ndegwamartin Mar 27, 2024
05e9ed6
Merge branch 'master' into local-only-resources
ndegwamartin Mar 27, 2024
32a567e
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Mar 27, 2024
f7a23c9
SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Commo…
ndegwamartin Mar 27, 2024
c74d722
Merge branch 'google:master' into master-release
ndegwamartin Apr 19, 2024
ae42ddb
Merge branch 'master' into local-only-resources
ndegwamartin Apr 19, 2024
6dee127
Merge branch 'master' into quirks-patches
ndegwamartin Apr 19, 2024
5643dd0
SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common,…
ndegwamartin Apr 19, 2024
eb73046
SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Com…
ndegwamartin Apr 23, 2024
e4ce820
SDK Release: Engine, SDC, Workflow, Barcode, Location Widget, Common,…
ndegwamartin Apr 29, 2024
38dc9d2
Merge branch 'master' into master-release
ndegwamartin May 8, 2024
6c07210
SDK Release
ndegwamartin May 8, 2024
e9ce8c2
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin May 14, 2024
51dc8ec
Update Workflow Knowledge dependency
ndegwamartin May 14, 2024
ee02125
SDK Release
ndegwamartin May 14, 2024
35794b5
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Jun 4, 2024
1531f9b
SDK Release
ndegwamartin Jun 4, 2024
23d4f53
Merge branch 'master' into master-release
ndegwamartin Jun 10, 2024
748664e
SDK Release
ndegwamartin Jun 10, 2024
7a756c6
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Jun 11, 2024
865fdae
SDK Release
ndegwamartin Jun 11, 2024
45d48aa
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Jun 21, 2024
7a75afb
Merge branch 'master' into quirks-patches
ndegwamartin Jun 21, 2024
54f2d14
Merge branch 'master' into local-only-resources
ndegwamartin Jun 21, 2024
c78f967
SDK Release
ndegwamartin Jun 21, 2024
3f726f5
Merge branch 'master' into master-release
ndegwamartin Jul 9, 2024
3ef1357
SDK Release
ndegwamartin Jul 9, 2024
6a669eb
Merge branch 'master' into quirks-patches
ndegwamartin Jul 9, 2024
edf4ce8
Merge branch 'master' into local-only-resources
ndegwamartin Jul 9, 2024
5ac8323
Refactor QuestionnaireNavigationViewUIState
FikriMilano Jul 27, 2024
0ae5301
Async getQuestionnairePages and Add progress bar to the 'Next' button
FikriMilano Jul 27, 2024
e05493e
spotless
FikriMilano Jul 27, 2024
6361100
Apply image using setImageBitmap
FikriMilano Jul 29, 2024
e3a55b6
Merge branch 'master' into 2639-async-process-for-get-questionnaire-p…
FikriMilano Jul 29, 2024
d89a932
Merge branch 'master' of github.com:google/android-fhir into 2649-ima…
FikriMilano Jul 30, 2024
fccf015
spotless
FikriMilano Jul 30, 2024
cea5a07
Merge branch 'master' into 2639-async-process-for-get-questionnaire-p…
FikriMilano Jul 30, 2024
18d0100
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Jul 30, 2024
20912f5
SDK Release
ndegwamartin Jul 30, 2024
4eb2ca2
Merge branch 'master' into quirks-patches
ndegwamartin Jul 30, 2024
ff31ccd
Merge branch 'master' into local-only-resources
ndegwamartin Jul 30, 2024
34121d6
Add missing import
ndegwamartin Jul 31, 2024
db8ffbc
Allow style overriding for progress bar
FikriMilano Aug 2, 2024
64deedb
spotless
FikriMilano Aug 2, 2024
4af8cc9
Merge branch '2639-async-process-for-get-questionnaire-pages' of gith…
FikriMilano Aug 2, 2024
bbb7051
Add missing response items to repeated group child items
FikriMilano Aug 16, 2024
db494e6
Merge remote-tracking branch 'origin/2655-add-missing-item-for-repeat…
ndegwamartin Aug 19, 2024
df94004
Add lookup item control type
FikriMilano Aug 26, 2024
3e8fdb5
Sync HAPI FHIR Exceptions Logging for the FHIR SDK
ndegwamartin Sep 4, 2024
7e6fb31
Merge branch 'master' into master-release
ndegwamartin Sep 4, 2024
9d2f6d1
SDK Release - Engine, SDC, Knowledge, Workflow
ndegwamartin Sep 4, 2024
494a7c6
Merge branch 'master' into local-only-resources
ndegwamartin Sep 4, 2024
6a5286a
Merge branch 'master' into 2649-image-view-flicker
ndegwamartin Sep 4, 2024
3fc4608
Remove duplicate FHIR Engine API Impl
ndegwamartin Sep 4, 2024
60d20e1
Merge branch 'master' into master-release
ndegwamartin Sep 10, 2024
66b0963
x
ndegwamartin Sep 10, 2024
4992100
Rename install API to index for file in knowledge manager (#2634)
jingtang10 Aug 2, 2024
ae0e4ce
Update CODEOWNERS to use group instead of individuals (#2659)
ktarasenko Aug 20, 2024
7522e98
Clean up UI navigation item (#2658)
jingtang10 Aug 21, 2024
cd6268e
Add missing response items to repeated group child items (#2657)
FikriMilano Aug 22, 2024
e0cebb2
Add flyover text as secondary dialog title (#2648)
FikriMilano Aug 22, 2024
4f3bad5
Small changes for more code readability (#2656)
MJ1998 Aug 26, 2024
9a923af
Add missing use of viewItem.questionText (#2665)
FikriMilano Aug 27, 2024
a0dab66
Load resources with url and optional version (#2666)
jingtang10 Aug 28, 2024
2036be9
Fix keyboard hiding bug (#2652)
FikriMilano Sep 3, 2024
8d64417
Add condition to not populate string value if it's empty (#2521)
FikriMilano Sep 4, 2024
52c257e
Bump up knowledge manager version to beta01 (#2667)
jingtang10 Sep 4, 2024
c1e6a95
Per question custom style (#2636)
santosh-pingle Sep 4, 2024
5787c7f
Remove eTag param override
ndegwamartin Sep 4, 2024
d871fa3
Parallelize DB resource deserialization to Optimize Database API
ndegwamartin Sep 4, 2024
5720eb2
Revert "Expose overloaded API for evaluateMeasure"
ndegwamartin Sep 6, 2024
60e7d6d
Merge branch 'master' into quirks-patches
ndegwamartin Sep 10, 2024
6bd2d48
Merge branch 'master' into local-only-resources
ndegwamartin Sep 10, 2024
e1cf4c5
SDK Release - Engine, SDC, Knowledge, Workflow
ndegwamartin Sep 10, 2024
5bc45d1
Expose overloaded FHIR Operator API for evaluateMeasure
ndegwamartin Sep 10, 2024
9b4c893
Reset FhirOperator.kt
ndegwamartin Sep 13, 2024
545aa69
Disable eTag for bundle uploads
ndegwamartin Sep 13, 2024
ffb393f
Refactor gradle configs, use same maven publication release
ndegwamartin Sep 18, 2024
45b96ff
Fix error validation highlighting not working when submit button is c…
Rkareko Sep 30, 2024
fad0ede
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Oct 2, 2024
10e24ef
SDK Release - Engine, SDC, Knowledge, Workflow
ndegwamartin Oct 2, 2024
0d17139
Use toSpanned
FikriMilano Oct 7, 2024
440d74c
Fix test
FikriMilano Oct 8, 2024
c6715e6
Add empty questionnaire response items for repeat groups without answers
Rkareko Oct 10, 2024
8eb6781
Remove toString
FikriMilano Oct 14, 2024
eb24a9a
Merge branch 'master' into 2688-html-answer-option
jingtang10 Oct 14, 2024
c021771
Add toSpanned for review mode
FikriMilano Oct 14, 2024
3181613
Add toSpanned for dialog
FikriMilano Oct 30, 2024
7300429
Revert "Remove toString"
FikriMilano Oct 30, 2024
7384cea
Merge branch 'master' of github.com:google/android-fhir into 2688-htm…
FikriMilano Oct 30, 2024
d43a0e8
Trigger CI
FikriMilano Oct 31, 2024
855b580
Use dialog extension instead of dialog item-control
FikriMilano Oct 31, 2024
2a95708
Update comment
FikriMilano Oct 31, 2024
bd47870
spotless
FikriMilano Oct 31, 2024
3e733d7
Revert lookup item control
FikriMilano Oct 31, 2024
f7b4791
Merge branch 'master' of github.com:google/android-fhir into 2662-add…
FikriMilano Oct 31, 2024
14dc23d
Merge branch 'master' into 2688-html-answer-option
FikriMilano Oct 31, 2024
e60758b
Merge branch 'master' into quirks-patches
ndegwamartin Nov 4, 2024
eb2890c
Merge branch 'master' into overload-workflow-method
ndegwamartin Nov 4, 2024
410fa5c
Merge branch 'master' into local-only-resources
ndegwamartin Nov 4, 2024
8b53cd2
Merge branch 'master' into 2649-image-view-flicker
ndegwamartin Nov 4, 2024
2355d0d
Merge branch 'master' into master-release
ndegwamartin Nov 4, 2024
0abb05d
SDK Release - Engine, SDC, Workflow
ndegwamartin Nov 4, 2024
715502b
Merge remote-tracking branch 'origin/quirks-patches' into release-04.…
ndegwamartin Nov 4, 2024
f86079c
Merge branch 'overload-workflow-method' into release-04.11.2024
ndegwamartin Nov 4, 2024
a3f242b
Merge remote-tracking branch 'origin/overload-workflow-method' into r…
ndegwamartin Nov 4, 2024
ea1768c
Merge remote-tracking branch 'origin/local-only-resources' into relea…
ndegwamartin Nov 4, 2024
3837219
Merge remote-tracking branch 'origin/2649-image-view-flicker' into re…
ndegwamartin Nov 4, 2024
b2f59d1
Merge remote-tracking branch 'origin/2662-add-dialog-control-type' in…
ndegwamartin Nov 4, 2024
cb3bdf9
Merge remote-tracking branch 'origin/2688-html-answer-option' into re…
ndegwamartin Nov 4, 2024
68445e0
Merge branch 'master' of github.com:google/android-fhir into 2639-asy…
FikriMilano Nov 5, 2024
dc6e601
Merge remote-tracking branch 'origin/2639-async-process-for-get-quest…
ndegwamartin Nov 5, 2024
fbb0b0a
SDK Release - Engine, SDC, Workflow
ndegwamartin Nov 5, 2024
9dd1aaf
Merge branch 'master-release' into release-04.11.2024
ndegwamartin Nov 5, 2024
ffed82a
Move the parallelized mapping outside db transaction
LZRS Nov 8, 2024
1b27ad7
Merge branch 'master' into master-release
ndegwamartin Nov 12, 2024
c1abadb
SDK Release - SDC
ndegwamartin Nov 12, 2024
391fe0a
Merge branch 'master-release' into release-12.11.2024
ndegwamartin Nov 12, 2024
98e4c49
Merge remote-tracking branch 'origin/pmap-refactor' into release-12.1…
ndegwamartin Nov 12, 2024
cd4606b
SDK Release - SDC, Engine
ndegwamartin Nov 12, 2024
3b6195a
Merge branch 'master-release' into release-12.11.2024
ndegwamartin Nov 12, 2024
d48d338
Merge remote-tracking branch 'origin/master' into release-12.11.2024.rc2
ndegwamartin Nov 18, 2024
6033cd2
RC 2 release
ndegwamartin Nov 21, 2024
89417fd
Overload FhirEngine.get()
qiarie Nov 27, 2024
68afe18
Replace get() with variable arguments
qiarie Nov 28, 2024
04974a0
Merge remote-tracking branch 'origin/master' into master-release
ndegwamartin Nov 28, 2024
200428a
SDK Release - SDC, Engine
ndegwamartin Nov 28, 2024
29dd821
Merge branch 'master-release' into release-28.11.2024
ndegwamartin Nov 28, 2024
c9ad228
Retain fetch single resource
qiarie Nov 29, 2024
0b89a59
Merge remote-tracking branch 'origin/release-28.11.2024' into 2721-by…
qiarie Nov 29, 2024
7e75f92
Merge remote-tracking branch 'origin/master' into 2721-bypass-tokenin…
qiarie Dec 17, 2024
83cb936
Refactor FhirEngine.get to FhirEngine.getResources
qiarie Jan 13, 2025
a2adcd4
Run spotlessApply
qiarie Jan 13, 2025
e9721d7
Revert merge
qiarie Jan 13, 2025
d1b6875
Revert updates from fork
qiarie Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion catalog/src/main/assets/component_modal.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"text": "Check box"
}
},
{
{
"url": "https://github.com/google/android-fhir/StructureDefinition/dialog"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -5206,6 +5206,28 @@ class DatabaseImplTest {
assertThat(searchResults.size).isEqualTo(980)
}

@Test
fun getResources_shouldReturnListOfResources() = runBlocking {
val patients = ArrayList<Patient>()
patients.add(TEST_PATIENT_1)
patients.add(TEST_PATIENT_2)
database.insert(*patients.toTypedArray())
assertThat(
database.selectResources(ResourceType.Patient, TEST_PATIENT_1_ID, TEST_PATIENT_2_ID).size,
)
.isEqualTo(2)
}

@Test
fun getResources_shouldThrowResourceNotFoundExceptionIfAllResourcesNotFound() = runBlocking {
val resourceNotFoundException =
assertThrows(ResourceNotFoundException::class.java) {
runBlocking { database.selectResources(ResourceType.Patient, "id1", "id2") }
}
assertThat(resourceNotFoundException.message)
.isEqualTo("Resources not found with type Patient and ids id1,id2!")
}

private companion object {
const val mockEpochTimeStamp = 1628516301000
const val TEST_PATIENT_1_ID = "test_patient_1"
Expand Down
27 changes: 26 additions & 1 deletion engine/src/main/java/com/google/android/fhir/FhirEngine.kt
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add some tests

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,7 @@ import com.google.android.fhir.sync.upload.SyncUploadProgress
import com.google.android.fhir.sync.upload.UploadRequestResult
import com.google.android.fhir.sync.upload.UploadStrategy
import java.time.OffsetDateTime
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import org.hl7.fhir.r4.model.Resource
import org.hl7.fhir.r4.model.ResourceType
Expand Down Expand Up @@ -83,6 +84,17 @@ interface FhirEngine {
@Throws(ResourceNotFoundException::class)
suspend fun get(type: ResourceType, id: String): Resource

/**
* Loads multiple FHIR resources given [ResourceType] and logical IDs.
*
* @param type The type of the resource to load.
* @param ids The logical IDs of the resources.
* @return The list of requested FHIR resources.
* @throws ResourceNotFoundException if the resources are not found.
*/
@Throws(ResourceNotFoundException::class)
suspend fun getResources(type: ResourceType, vararg ids: String): List<Resource>

/**
* Updates one or more FHIR [Resource]s in the local storage.
*
Expand Down Expand Up @@ -227,6 +239,19 @@ suspend inline fun <reified R : Resource> FhirEngine.get(id: String): R {
return get(getResourceType(R::class.java), id) as R
}

/**
* Retrieves FHIR resources of type [R] with the given [ids] from the local storage.
*
* @param R The type of the FHIR resource to retrieve.
* @param ids The logical IDs of the resources to retrieve.
* @return The list of requested FHIR resources.
* @throws ResourceNotFoundException if the resource is not found.
*/
@Throws(ResourceNotFoundException::class)
suspend inline fun <reified R : Resource> FhirEngine.getResources(vararg ids: String): List<R> {
return getResources(getResourceType(R::class.java), *ids).pmap(Dispatchers.Default) { it as R }
}

/**
* Deletes a FHIR resource of type [R] with the given [id] from the local storage.
*
Expand Down
11 changes: 10 additions & 1 deletion engine/src/main/java/com/google/android/fhir/db/Database.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -84,6 +84,15 @@ internal interface Database {
@Throws(ResourceNotFoundException::class)
suspend fun select(type: ResourceType, id: String): Resource

/**
* Selects the FHIR resources of type `clazz` with `ids`.
*
* @param <R> The resource type
* @throws ResourceNotFoundException if the resources are not found in the database
*/
@Throws(ResourceNotFoundException::class)
suspend fun selectResources(type: ResourceType, vararg ids: String): List<Resource>

/**
* Selects the saved `ResourceEntity` of type `clazz` with `id`.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 Google LLC
* Copyright 2021-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,6 +41,13 @@ class ResourceNotFoundException : Exception {
this.id = id
}

constructor(
type: String,
vararg ids: String,
) : super("Resources not found with type $type and ids ${ids.joinToString(",")}!") {
this.type = type
}

constructor(
uuid: UUID,
) : super("Resource not found with UUID $uuid!") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -199,6 +199,15 @@ internal class DatabaseImpl(
?: throw ResourceNotFoundException(type.name, id)
}

override suspend fun selectResources(type: ResourceType, vararg ids: String): List<Resource> {
val resources =
resourceDao.getResources(resourceIds = ids, resourceType = type)?.takeIf { it.isNotEmpty() }
?: throw ResourceNotFoundException(type.name, *ids)
return resources.pmap(Dispatchers.Default) {
FhirContext.forR4Cached().newJsonParser().parseResource(it) as Resource
}
}

override suspend fun insertSyncedResources(resources: List<Resource>) {
db.withTransaction { insertRemote(*resources.toTypedArray()) }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -202,6 +202,17 @@ internal abstract class ResourceDao {
)
abstract suspend fun getResource(resourceId: String, resourceType: ResourceType): String?

@Query(
"""
SELECT serializedResource
FROM ResourceEntity
WHERE resourceId IN (:resourceIds) AND resourceType = :resourceType""",
)
abstract suspend fun getResources(
vararg resourceIds: String,
resourceType: ResourceType,
): List<String>?

@Query(
"""
SELECT *
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,6 +52,9 @@ internal class FhirEngineImpl(private val database: Database, private val contex
override suspend fun get(type: ResourceType, id: String) =
withContext(Dispatchers.IO) { database.select(type, id) }

override suspend fun getResources(type: ResourceType, vararg ids: String) =
withContext(Dispatchers.IO) { database.selectResources(type, *ids) }

override suspend fun update(vararg resource: Resource) =
withContext(Dispatchers.IO) { database.update(*resource) }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -151,6 +151,10 @@ internal object TestFhirEngineImpl : FhirEngine {
return Patient()
}

override suspend fun getResources(type: ResourceType, vararg ids: String): List<Resource> {
return ids.map { Patient() }
}

override suspend fun delete(type: ResourceType, id: String) {}

override suspend fun <R : Resource> search(search: Search): List<SearchResult<R>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 Google LLC
* Copyright 2023-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,13 @@ import androidx.test.core.app.ApplicationProvider
import ca.uhn.fhir.context.FhirContext
import ca.uhn.fhir.rest.gclient.TokenClientParam
import ca.uhn.fhir.rest.param.ParamPrefixEnum
import com.google.android.fhir.FhirEngine
import com.google.android.fhir.FhirServices.Companion.builder
import com.google.android.fhir.LocalChange
import com.google.android.fhir.LocalChange.Type
import com.google.android.fhir.db.ResourceNotFoundException
import com.google.android.fhir.get
import com.google.android.fhir.getResources
import com.google.android.fhir.lastUpdated
import com.google.android.fhir.logicalId
import com.google.android.fhir.search.LOCAL_LAST_UPDATED_PARAM
Expand Down Expand Up @@ -68,6 +70,8 @@ import org.junit.Assert.assertThrows
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.`when`
import org.mockito.kotlin.mock
import org.robolectric.RobolectricTestRunner

/** Unit tests for [FhirEngineImpl]. */
Expand All @@ -94,6 +98,31 @@ class FhirEngineImplTest {
assertResourceEquals(TEST_PATIENT_2, fhirEngine.get<Patient>(TEST_PATIENT_2_ID))
}

@Test
fun create_isLocalOnlyTrue_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking {
val totalLocalChangesPatient2 =
fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size
fhirEngine.create(TEST_PATIENT_2, isLocalOnly = true)
assertResourceEquals(TEST_PATIENT_2, fhirEngine.get<Patient>(TEST_PATIENT_2_ID))
assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size)
.isEqualTo(totalLocalChangesPatient2)
}

@Test
fun createAll_isLocalOnlyTrue_shouldCreateResourceWithoutFlaggingLocalChange() = runBlocking {
val totalLocalChangesPatient1 =
fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size
val totalLocalChangesPatient2 =
fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size
fhirEngine.create(TEST_PATIENT_1, TEST_PATIENT_2, isLocalOnly = true)
assertResourceEquals(TEST_PATIENT_1, fhirEngine.get<Patient>(TEST_PATIENT_1_ID))
assertResourceEquals(TEST_PATIENT_2, fhirEngine.get<Patient>(TEST_PATIENT_2_ID))
assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_1_ID).size)
.isEqualTo(totalLocalChangesPatient1)
assertThat(fhirEngine.getLocalChanges(ResourceType.Patient, TEST_PATIENT_2_ID).size)
.isEqualTo(totalLocalChangesPatient2)
}

@Test
fun create_resourceWithoutId_shouldCreateResourceWithAssignedId() = runBlocking {
val patient =
Expand Down Expand Up @@ -897,6 +926,49 @@ class FhirEngineImplTest {
}
}

@Test
fun `get returns a single resource`() = runTest {
val fhirEngine = mock<FhirEngine>()
val expectedPatient = Patient().apply { id = TEST_PATIENT_1_ID }

`when`(fhirEngine.get(ResourceType.Patient, TEST_PATIENT_1_ID)).thenReturn(expectedPatient)

assertThat(fhirEngine.get<Patient>(TEST_PATIENT_1_ID)).isEqualTo(expectedPatient)
}

@Test
fun `get throws ResourceNotFoundException when resource is not found`() = runTest {
val resourceNotFoundException =
assertThrows(ResourceNotFoundException::class.java) {
runBlocking { fhirEngine.get<Patient>("id1") }
}
assertThat(resourceNotFoundException.message)
.isEqualTo("Resource not found with type Patient and id id1!")
}

@Test
fun `getResources returns a list of resources`() = runTest {
val patientIds = arrayOf(TEST_PATIENT_1_ID, TEST_PATIENT_2_ID)
val expectedPatients = listOf(Patient(), Patient())
val fhirEngine = mock<FhirEngine>()

`when`(fhirEngine.getResources(ResourceType.Patient, *patientIds)).thenReturn(expectedPatients)

val resources = fhirEngine.getResources<Patient>(*patientIds)
assertThat(resources).isEqualTo(expectedPatients)
}

@Test
fun `getResources throws ResourceNotFoundException when no resources with ids are found`() =
runTest {
val resourceNotFoundException =
assertThrows(ResourceNotFoundException::class.java) {
runBlocking { fhirEngine.getResources<Patient>("id1", "id2") }
}
assertThat(resourceNotFoundException.message)
.isEqualTo("Resources not found with type Patient and ids id1,id2!")
}

companion object {
private const val TEST_PATIENT_1_ID = "test_patient_1"
private var TEST_PATIENT_1 =
Expand Down
Loading