FHIR Swagger Document generator and enhancements Next Steps

@harsha89 I did a research on where we should build the swagger UI. When I’m look at the Open Web App module, it’s based on OpenMRS 1.9.7 which is not latest. FHIR module uses beta version 2.0.0 release and going to upgrade to latest. If we build a Open Web App we might need upgrade from Open Web App Module or downgrade the FHIR module. Also I looked at the resources pointed by @pascal. Having code in a different repository will make it difficult for user to try out. But it will be consistent to access the everything in one location. I think have all things self contained by integrating swagger UI to FHIR module itself for the moment and let users to try out. I think it will be one page implementation which can move to other module without a major changes.

Good analysis @rasanjana. Let’s increase threads and continue further testing. Can you check the load average as well when you running the tests?

@judy it appears to be a issue with not enough memory allocated for tomcat as above results suggest that it works fine with high load. Please have a test again and get back to us.

Let me think about this further on the approach that we need to take on building the swagger UI. Meanwhile please work on the swagger UI integration so we can simple migrate it to any alternative.

I haven’t read the previous 40 messages in this thread, but just peeking at this one:

The Open Web App module is a framework module that allows you to package up other code in an OWA. So the minimum OpenMRS version that the Open Web App module requires is irrelevant for what you’re doing.

I guess the idea here would be that in the FHIR module’s build process you could produce an OWA that includes swagger docs for the FHIR REST API. I don’t see the value of using OWA here (which is really just a lightweight packaging technology for HTML+JS+CSS), because by definition in this case you’re already deploying an OMOD (the FHIR module) so you might as well include the docs within that OMOD.

1 Like

Thank you @darius for the clarification. I thought it’s depends on the OpenMRS version. Thank you again.

Will do

Thanks for testing

Judy

Oh by the way what are your tomcat settings

Judy

Sorry for the delay @judy. I allocated 4GB for Xmx which is the maximum memory.

Hi All,

This is to give a update on current activities. I able to integrate the swagger UI to the omod and generate the swagger UI out of the FHIR API Swagger. Following are some of screenshots of them.

But there are some issues when invoking and rendering parameters which I currently working on now. Hopefully I can finish these issues with this weekend.

Thank you, Rasanjana

2 Likes

Looks good @rasanjana. @any updates on the invoking APIs? We will need to wrap up the development activities in next week and write a comprehensive documentation on this. :slight_smile:

@harsha89 I was successfully able to invoke a FHIR APIs through the console. Please find below screenshot.

This week I went through the code and verified it for the functionality. And one of my target was to write test cases. But since swagger document generation required to initialize the hapi server, it’s giving null pointer in omod test as it’s not initialize when test is running. Any suggestion to initialize it? I’m looking more onto it.

1 Like

@rasanjana what happen if we initialize same thing through the test class?

@harsha89 I tried that way but now throwing below exception. I analyzed this further and find out that now tests required spring services. Since we are writing the tests in omod, it’s not initialize the spring services I think. When I refer to api test cases I can see that they are extending from BaseModuleContextSensitiveTest. I tried to do the same from the omod but it’s not allowed. Any suggestions?

org.openmrs.api.APIException: Service not found: interface org.openmrs.api.AdministrationService

at org.openmrs.api.context.ServiceContext.getService(ServiceContext.java:683)
at org.openmrs.api.context.ServiceContext.getAdministrationService(ServiceContext.java:269)
at org.openmrs.api.context.Context.getAdministrationService(Context.java:489)
at org.openmrs.module.fhir.api.util.FHIRUtils.isCustomNarrativesEnabled(FHIRUtils.java:56)
at org.openmrs.module.fhir.omod.SwaggerDocumentGenerationTestCase.initialize(SwaggerDocumentGenerationTestCase.java:74)
at org.openmrs.module.fhir.omod.SwaggerDocumentGenerationTestCase.<init>(SwaggerDocumentGenerationTestCase.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:195)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:244)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:241)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)

@harsha89 by removing check of custom narratives I have able to get rid of this exception.

1 Like

Hi All,

Added documentation in https://wiki.openmrs.org/display/projects/FHIR+Swagger+Documentation.

@harsha89 appreciate any suggestions to improve it.

Thank you

Hi All,

I summarize my work during GSoC in https://rasanjanacreations.wordpress.com/2016/08/20/completion-last-update-of-gsoc-openmrs/. I like to thank my mentor @harsha89 for his guidance. Thank you for all community members for their valuable suggestions and help to solve numerous problems encountered during this period.

Thank you, Rasanjana

2 Likes

@rasanjana great work :slight_smile:

It’s looks good @rasanjana!