hapifhir / org.hl7.fhir.core

Apache License 2.0
153 stars 155 forks source link

org.hl7.fhir.r4.model.codesystems package missing in R5 #1496

Open Athou opened 9 months ago

Athou commented 9 months ago

Hello!

We're currently exposing FHIR R4 resources using the FHIR facade model described here https://hapifhir.io/hapi-fhir/docs/server_plain/server_types.html#plain-server-facade

Our code makes use of the classes in the org.hl7.fhir.r4.model.codesystems package. We're using the enums to create CodeableConcepts in order to avoid hardcoding system ids, display texts and values e.g.

Condition condition = new Condition();
ConditionClinical status = Items.isActive(item) ? ConditionClinical.ACTIVE : ConditionClinical.INACTIVE;
condition.setClinicalStatus(new CodeableConcept(new Coding(status.getSystem(), status.toCode(), status.getDisplay())));

We're currently in the process of migrating to R5 but it seems the package org.hl7.fhir.r5.model.codesystems does not exist with R5. Do those enums still exist somewhere else? If they don't, what is the recommended way of creating CodeableConcepts?

Thanks!

grahamegrieve commented 9 months ago

Interesting. I did not generate the r5 code systems because no one ever reported any issues with the r4 code systems, and I figured no one was using them.

Athou commented 9 months ago

😄

Would you be willing to generate the code systems for r5?

Would it even be possible to add a toCoding() method on those enums that would simply call the Coding(String theSystem, String theCode, String theDisplay) constructor, in order to ease creation of CodeableConcepts? It would look something like this:

condition.setClinicalStatus(new CodeableConcept(ConditionClinical.ACTIVE.toCoding()));
alaingodet commented 9 months ago

Sorry to jump in this post but I think it would be useful to keep these enums based on the code systems, as suggested by Athou. If there was no issue with them it's probably because it was working just fine.

cmark commented 4 months ago

I just bumped into this issue when generating subsumption outcomes in an R5 $subsumes endpoint 😅 and the four possible outcome literals are non-existent in the R5 package (nor in the R4B). I think these CodeSystem definitions need their own R4B and R5 representations just to be consistent with the other package or some other alternative will be needed so that when someone is using a newer FHIR version they have the enumerations at his/her disposal. I assume when R6 gets released as the new Normative release, these enumerations will be in that package.

My workaround for now is to use the R4 lib which is okay but requires another maven dependency just for a few enum classes.

grahamegrieve commented 1 month ago

I'm certainly not adverse to bringing them back, but the code generator for them has been lost, and I can't justify the time to recreate it. But I'll happily accept a PR for the gnenerator or the generator+generated code