Project: Radiology Reporting Enhancement

hi @teleivo, @judy

While working on the templates tab, i made a small change to the initial design. I changed the “Add Report Templates” link to a button that when clicked opens a modal dialog that will have options for either “importing an mrrt template file” or creating a new one using an editor. This way the user will not navigate out of the radiology dashboard just to import a template. If the import is successful, it will just be displayed in the templates tab. You can see screen shots below.

Is the above okay with you guys, or do you have another suggestion of how the “Add Report Templates” should be implemented?

I am currently working on the REST API for MrrtReportTemplate and hopefully i will be done with it before the end of today.

I think this is a great approach and idea . I like it this way

find it good too!!

the only comment: I think you should start simple by only providing a single filter (input box) in the UI of which the value will be passed in to a REST parameter. For the parameters we should support in the end you can look at MRRT Standard: Table 4.105.4.1.2-1: HTTP Query Parameters.

I suggest starting with title (leave Specialty and Organization for now). You will need a REST Resource & SearchHandler as you can see from the RAD-140 branch. Also your Service should support getMrrtReportTemplateByUuid(String) which is used by REST GET of a single template.

Resolved.

Resolved.

I am getting this error when i add my liquibase changesets,

WARN - ModuleFactory.startModuleInternal(788) |2016-06-15 01:00:09,859| Error while trying to start module: radiologyorg.openmrs.module.ModuleException: Unable to update data model using liquibase.xml. Module: Radiology at org.openmrs.module.ModuleFactory.runLiquibase(ModuleFactory.java:1034) at org.openmrs.module.ModuleFactory.startModuleInternal(ModuleFactory.java:728) at org.openmrs.api.context.Daemon$1.run(Daemon.java:74)Caused by: liquibase.exception.ValidationFailedException: Validation Failed: 1 change sets check sum liquibase.xml::radiology-30::ivange94 is now: 3:153d505e08d21352ca2a5ad8fb6fc8fd at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:141) at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:625) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:199) at org.openmrs.module.ModuleFactory.runLiquibase(ModuleFactory.java:1024) … 2 more

I started facing this error when i was resolving your comment on my pull request which demanded me to use ‘-’ in uuid strings. After changing all uuids using java.util.UUID.randomUUID(), i started facing the above error. Here is my liquibase changeset, changesets. This causes the UI to display funny(messages from messages.properties are not resolved and javascript does not seem to work). But when i remove these changesets and rebuild and redeploy the module, everything works fine.

But did you delete the rows from the database containing those old uuids and remove the changesets from the liquibasechangelog table? because modifying the changeset and simply redeploying the module wont work.

I figured that could be the problem, so i wrote an sql script to delete all rows i added to that table but i got the foreign key constraint error. So i dropped the database, did a clean install of platform, and still faced that error after uploading radiology module. So i was thinking maybe the problem is in my changeset but i couldn’t see a problem with them.

Hi @teleivo, @judy

As of now, you can import templates into the system from the UI. It still needs some work though(need to display message of upload status, i.e whether it failed or succeeded) but the main part is working. When you click on the “add templates” button and select a file to upload, my code will properly parse the html file, extract metadata and store metadata as an MrrtReportTemplate object inside the database in a table “radiology_report_template”. And the template file is copied to, ${openmrs home dire}/radiology/templates/templateFileName.html

Below is a list of things left to do for this week.

  1. Add unit tests to cover areas I’ve not covered yet.
  2. Implement REST to get template data from database. I’ve already implemented the MrrtReportTemplateResource, i just need to add the remaining bits, a doSearch and doGetAll.

I will handle all points above on sunday before i submit my weekly updates. I have a conference tomorrow where i will talk about my work on my GSoC project and it will run from 7:30am to about 7:30pm. You can view the agenda here, SMCONF Agenda. And i have from now till 00:00 to prepare my slides and tomorrow i will probably not work since i will be at the conference the whole day. I hope i can get this one day off :slight_smile:

Sure ivange

And thank you for the work you are doing

Enjoy the conference

Hi @ivange94, its great that you are talking about your work at a conference! How did it go?

For your work for this week I have a comment on 2.

Look at RadiologyOrderSearchHandler, you’ll need to implement such a handler for your templates (as already suggested in a post above, start with parameter title). I dont think we should support doSearch(), doGetAll(). With the SearchHandler you can easily implement the request parameters specified by the MRRT standard.

The conference was good but it started later than planned as a result 10 speakers including me did not get to speak :frowning:

Working on it.

sorry to hear that!

While looking at the RadiologyOrderSearchHandler, i noticed the following

final String patientUuid = context.getRequest()

.getParameter(REQUEST_PARAM_PATIENT);

final Patient patient = ((PatientResource1_9) Context.getService(RestService.class)
        .getResourceBySupportedClass(Patient.class)).getByUniqueId(patientUuid);

So i was wondering, wouldn’t the Request param in the case above be a patient name(what the user typed), how did it turn to patientUuid.

Then i looked at radiologyOrdersTab.jsp and noticed a patientField tag been used. So i guess that is what makes the request param in search handler to be a Uuid instead of the string entered by the user. So should i implement something similar for templates or is there another way i can get template inside search handler using the search string entered by user.

with REST if requesting a specific resource you go for UUIDs not the internal ids. Thats why I used patients uuid, since I only wanted a specific patients order. I had to create the custom patientField tag since the existing openmrs one gives me the id not the uuid (you got that totally right!!).

it depends on what you are searching for. in your case its title which is a string. I think you should return all templates with the exact same title or similar ones.

Yes, i got that. My question was, how do i this. Do i need a custom jsp tag like you did for RadiologyOrder or do i need to implement a method like getTemplatesByTitle() ?

for the how look at the RadiologyOrderSearchHandler you switch the parameter for title and of course need to provide a Service method for this query. You dont need a custom tag in this case since the user just inputs text which will be the request parameters value later fed to the Service method. You might need a custom tag for other parameters later down the road.

Hi @teleivo

I’ve been testing my MrrtReportTemplateResource, using this url http://localhost:8080/openmrs//ws/rest/v1/mrrtreporttemplate/bea3d308-d906-4622-9666-eb870a568c9b. I getting this output with an exception thrown, https://paste.kde.org/pvru6oodv. What could be the cause of that?

It looks like getMrrtReportTemplateByUniqueUuid() is returning null but its working fine inside my unit test cases.

@ivange94 if your unit test are real unit tests than they are only testing the method without any DB involved, I assume that part is mocked. So it could be that getMrrtReportTemplateByUniqueUuid() does not work as you want it to with the DB involved. Unless you have an integration/component test for the method where you test the method with DB. do you have an integration test as well? And just to check, are you certain that a template with this UUID is present in the DB?

I thought there is an in memory database when running unit tests? I mean, is that not why we use datasets files? Because i have an MrrtReportTemplateServiceTestDataset.xml inside the test resources folder and it works as expected.

Yes i copied the uuid from the DB.