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

GenericPatientIdExtractor: solve without using FhirPath #455

Open
ohr opened this issue Jul 23, 2024 · 1 comment
Open

GenericPatientIdExtractor: solve without using FhirPath #455

ohr opened this issue Jul 23, 2024 · 1 comment
Labels
Milestone

Comments

@ohr
Copy link
Member

ohr commented Jul 23, 2024

GenericPatientIdExtractor uses FhirPatient to extract the Patient reference of a resource. This unfortunately leads to calling parts of HAPI FHIR that may require to include structure libraries (stu3, r4b etc.) that are not used at all. Still it can cause exceptions like:

Caused by: java.lang.ClassNotFoundException: org.hl7.fhir.r4b.model.Resource
	at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
	at java.lang.Class.forName0(Native Method) ~[?:?]
	at java.lang.Class.forName(Class.java:375) ~[?:?]
	at ca.uhn.fhir.util.ReflectionUtil.typeExists(ReflectionUtil.java:287) ~[hapi-fhir-base-6.10.2.jar:?]
	at ca.uhn.fhir.context.FhirContext.getValidationSupport(FhirContext.java:716) ~[hapi-fhir-base-6.10.2.jar:?]
	at org.hl7.fhir.r4.hapi.fluentpath.FhirPathR4.<init>(FhirPathR4.java:30) ~[hapi-fhir-structures-r4-6.10.2.jar:?]
	at org.hl7.fhir.r4.hapi.ctx.FhirR4.createFhirPathExecutor(FhirR4.java:45) ~[hapi-fhir-structures-r4-6.10.2.jar:?]
	at ca.uhn.fhir.context.FhirContext.newFhirPath(FhirContext.java:859) ~[hapi-fhir-base-6.10.2.jar:?]
	at org.openehealth.ipf.commons.ihe.fhir.audit.GenericPatientIdExtractor.lambda$patientReferenceFromResource$2(GenericPatientIdExtractor.java:59) ~[ipf-commons-ihe-fhir-core-4.8.0.jar:4.8.0]
@ohr ohr added the change label Jul 23, 2024
@ohr ohr added this to the IPF 5.0 milestone Jul 23, 2024
@Thopap
Copy link
Member

Thopap commented Aug 26, 2024

Intesting how this stacktrace could occure?
https://github.com/hapifhir/hapi-fhir/blob/882e7a33ef27996f33bd719130464b0b6e99ec9c/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ReflectionUtil.java#L287 seems to catch the ClassNotFoundException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants