Does any other mentor have a different approach than this cc @ibacher @suthagar23
Updated Objectives for Coding Phase-2:
- Add support for custom narratives.
- Support relative paths prefixed with
openmrs:
for location of narratives and properties file. For example, the relative pathopenmrs:configuration/Patient.html
would point to the location<OPENMRS_APPLICATION_DATA_DIRECTORY>/configuration/Patient.html
.
Approach to be followed:
Support for custom narratives could be provided by giving the implementer an option to specify a properties file containing the location of narrative templates which he/she wants to override. The FHIR Module would give a higher priority to these overrides to serve the intended purpose. In order to support relative paths prefixed with openmrs:
, we would need to implement our own narrative generator with the required changes in order to support openmrs:
prefixed relative paths.
Please find the link for draft PR for FM2-252 below. It contains a basic working version of the modified narrative generator. If this looks fine, I’ll be working on simplification of the implementation.
Hi there!
Since we are autowiring messageSource
in our message resolver, on running tests, messageSource
remains null
. For that, we might use @Mock
annotation for the messageSource
but then the messages won’t be populated in the narrative templates. So what could be done for that? Any suggestions?
Also, if I try to do something like this:
OpenMRSMessageResolver resolver = new OpenMRSMessageResolver(null);
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(resolver.getClass());
OpenMRSMessageResolver app = context.getBean(resolver.getClass());
log.info(app.getMessageSource().getMessage("fhir2.title", new Object[] {}, Locale.getDefault()));
I get the following error, even if the property exists in the messages.properties
file:
org.springframework.context.NoSuchMessageException: No message found under code 'fhir2.title' for locale 'en_GB'.
So where did I go wrong here?
Are you picking from message_en_GB.properties ?
No, I had placed the property in messages.properties
. Isn’t it the default fallback for EN
locale?
Just create a ReloadableResourceBundleMessageSource
:
private ReloadableResourceBundleMessageSource messageSource;
...
@Before
public void setupMessageSource() {
messageSource = new ReloadableResourceBundleMessageSource();
// this is effectively what OpenMRS uses
messageSource.addBasenames("classpath:messages")
}
Then just add this messageSource
where it’s needed.
Oh okay! Thanks!
Please take a look at the draft PR (link below) for FM2-280. Does it look fine?
For now I’ve just made changes to AllergyIntolerance
template. I’ll make changes to the rest too if the approach looks fine.
hello @iamsr
am experiencing a failure in org.openmrs.module.fhir2.narrative.NarrativeGeneratorTest.
during maven build
Thanks
Hi @gcliff! Thanks for raising this up.
I guess the error is occurring due to the newline issue in Windows (something similar to FM2-243).
I’ve raised a PR for the same issue. Could you please verify if the build succeeds on Windows?
Thanks @ibacher for that quick solution
@iamsr works fine now ,
Hi! Please take a look at the following PRs.
Hello everyone!
I’m super happy to share that all the main project objectives for this project have got completed. I would like to thank my wonderful mentors @ibacher, @herbert24 and @suthagar23 who always supported me throughout the project. I would also thank the entire OpenMRS community which was so supportive and was always there for help.
Here are the links to the final report and the demonstration video:
Congrats @iamsr
Thanks @tendomart!