How can I POST a CSV Report to a web service after it's run?

Application Name: Platform Version Number: 1.11.6 Question: We have a customer who runs a report in the OpenMRS reporting module, downloads the report and uploads it to a third party system for review. Is there a generic way to post a CSV report after it’s run using existing OpenMRS modules? I see the work on the DHIS2 module, but that posts the data in XML format that’s specific to DHIS2 data sets.

Thanks, Craig

I don’t think this is currently possible using existing tooling unfortunately. See below.

@craigappl, I do believe this is possible (if you write code to configure it).

Relevant classes are:

  • org.openmrs.module.reporting.report.processor.ReportProcessor
  • org.openmrs.module.reporting.report.ReportProcessorConfiguration

I’ve never used this, but maybe @mseaton can point to an example from PIH code.

@craigappl, yes, @darius beat me too it. You can find a little background on report processors here, but essentially they represent code that can be configured to run automatically or on-demand after a report has finished running. Because reports are queued up and run asynchronously, and also because they can be scheduled to run based on a cron expression, it is often helpful to have an addiitional processing step that happens automatically once a report is run. There are currently a handful of built-in processors supported - one that can email out the report and one that can save the report to disk somewhere.

To add you own custom processor that would post the results of the report to a web service as a CSV, you would simply create a class that implements the ReportProcessor interface, and registers itself with Spring using the @Component annotation. Then, you’d need to ensure that this ReportProcessor is associated with any ReportDesigns that you configure for a given report.

Happy to answer any questions that arise if you go down this path.

Mike