Hi all, this is the public thread for the project “Add support for FHIR Narratives”. FHIR Narratives basically are human readable representations of FHIR resources. This project mainly involves the following:
Developing a framework to make handling of template definitions easier for the implementer, and also to support localisation of the generated narratives.
Implementation of search feature for FHIR resources using _text parameter.
Hi, I was trying to use the Default Narrative Generator of HAPI library, for which I had to create an object of FhirContext.
But, the line FhirContext ctx = FhirContext.forDstu2(); gave me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at ca.uhn.fhir.context.FhirContext.<clinit>(FhirContext.java:80)
at org.openmrs.module.fhir2.FhirNarrativesGen.main(FhirNarrativesGen.java:21)
I tried adding a dependency for org.slf4j in pom.xml but that didn’t work out. What else should I be doing to get rid of this error?
For reference, the declaration of the method forDstu2() goes as follows:
public static FhirContext forDstu2() {
return new FhirContext(FhirVersionEnum.DSTU2);
}
I guess making FhirNarrative an implementation of INarrativeGenerator could make it work, and then calling a method of this class in the main method could give me the output.
What’s your say on this? Am I going the right way?
Not using Mockito, and instead declaring an object directly, and adding few dependencies worked out! Now the test passes . Dunno why it wasn’t working with Mockito.
@iamsr First, there’s a separate NarrativeGenerator sub-library of the HAPI FHIR API, which I would recommend using over re-inventing the wheel. To do this, add the resource to the pom.xml:
Also, we shouldn’t refer to specific versions inside submodule POMs where this can be avoided. Instead, the dependency and it’s specific version should go in the root fhir2 POM. In the dependencyManagement section. This helps assure that all parts of the module are using consistent versions.
In this case, you just need to add something like this to the dependency management section after the hapi-fhir-structures-r4 part:
@ibacher@herbert24@suthagar23 My development goal for Coding Phase-1 is basically the creation and setting up of Default Narratives for the following resources:
AllergyIntolerance
Condition
DiagnosticReport
Encounter
Location
MedicationRequest
Medication
Observation
Patient
Person
Practitioner
RelatedPerson
ServiceRequest
Task
Could you all please review it once, so that I could proceed with creating JIRA tickets for the same.