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
465 stars 246 forks source link

Kotlin Multiplatform Mobile compatible #1497

Open JonasDaWi opened 1 year ago

JonasDaWi commented 1 year ago

It would be nice to make the engine run on kotlin only, so that one can use this lib in a KMM project. Currently, this project does not work with KMM, because this project is dependent on Android (lib) dependencies. Therefore, all dependencies that run on Android only need to be replaced by libs that are kotlin only.

jingtang10 commented 1 year ago

@yigit can you comment on this please?

yigit commented 1 year ago

I think this would be great. I even remember discussing this in the early days of the project.

The problem is, as noted here, dependencies.

We depend on external libraries for FHIR implementation and without them moving to KMP, it will be very hard to move to KMP; unless we want to start implementing them ourselves.

Might be a good target for v2 but right now, it seems too much work and I believe it wouldn't make the priority list for Android-FHIR.

jingtang10 commented 4 months ago

as per yigit's comment, i don't think this is feasible at the moment without a way to migrate the java dependencies. will need to revisit in the future.

vitorpamplona commented 1 week ago

I looked at this last year for a KMP project I was working on. We decided to code a MiniFhir implementation ourselves instead. It wasn't that hard to recode the parts we wanted.

We would have to migrate:

And their dependencies on Jackson and Stax / XML Parsing as well as the Java Code generation to Kotlin code generation tools. The web of dependencies is no joke, but I truly believe most of the dependencies' features are not used by most apps.

Besides the multiplatform support, there are potential performance and usability improvements when migrating/re-building the FHIR Building blocks used by the SDK.