google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
484 stars 285 forks source link

Support rxjava , kotlin flow and livedata in the database. #911

Open epicadk opened 2 years ago

epicadk commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently we don't use any of the wrappers ( i.e. rxjava, kotlin flow, livedata etc.)

Describe the solution you'd like

Add support for these because they'll make development for the consumer considerably easier, since room will automatically update the data when new data is added to the database.

Additional context

I think datastore does have something similar. Also this could be a low / medium priority since it isn't a necessity at the moment and would require significant restructuring of the api.

Would you like to work on the issue?

Maybe, after discussion with the code owners.

epicadk commented 2 years ago

I ran benchmarks and it seems that flow and live data actually perform better than the standard return type, although I did use an emulator with unlocked clocks so this may not be entirely accurate (I do not have access to a physical device at the time). Also, even if adding flows/livedata does slightly affect the performance I think the tradeoff would definitely be worth supporting these features. We could also make the features optional and support standard return types as well as flows/livedata.

cc @f-odhiambo @jingtang10

jingtang10 commented 2 years ago

@yigit @florina-muntenescu @kevinmost @stevenckngaa

Wonder if this is something that you expected - and if you have any general advice on this

yigit commented 2 years ago

I would prefer to avoid this until we have a client blocked by it.

Crafting these wrappers is not an easy API work and requires constant maintenance going forward. For cases were it is straightforward, there are compatibility artifacts that can be used by clients.