Hi Gretchen,Sorry for not responding earlier - as Darius mentioned, I was in transit back from Rwanda. From the information you provided below, the approach I would probably take is as follows:
* Create a new reporting.pentaho module that depends on the reporting module and which includes the pentaho libraries in the lib folder * Create an implementation of your TableModel interface which wraps a DataSet <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/dataset/DataSet.java> * Create an implementation of your DataFactory interface which is configured with:
* A CohortDefinition to define the rows * A DataSetDefinition to define the columns* The CohortDefinition and DataSetDefinition each may define parameters they take in, which you will need to account for * Initially, probably just hard code an example and see what you can get working * Later on, provide a UI that allows the user to select the CohortDefinition and DataSetDefinition, configure the parameters, and get a result * In your module you can create whatever utility methods, webservices, etc that you need in order to access your implemented interfaces and call the various reporting services.
Using the API, I would:* Use the CohortDefinitionService <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/cohort/definition/service/CohortDefinitionService.java> to get the list of possible CohortDefinitions to choose from, to get an individual CohortDefinition, or to evaluate a one * Use the DataSetDefinitionService <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/dataset/definition/service/DataSetDefinitionService.java> to get the list of possible DataSetDefinitions to choose from, to get an individual DataSetDefinition, or to evaluate one
If you have a means in Pentaho for defining something that can return multiple TableModels, this is what our ReportDefinition <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/report/definition/ReportDefinition.java> does. It takes in a CohortDefinition <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/cohort/definition/CohortDefinition.java> and a List of DataSetDefinitions <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/dataset/definition/DataSetDefinition.java>, and produces a ReportData <http://svn.openmrs.org/openmrs-modules/reporting/trunk/src/org/openmrs/module/reporting/report/ReportData.java>, which is essentially a List of DataSets (your TableModel).
Happy to discuss further by phone, Skype, email, etc. Mike On 10/21/2011 08:35 AM, Gretchen Moran wrote:
Darius,This is unfortunate. So, if my starting point is to expose these services, is there some guidance Mike or you could give me on where to begin? Do you have a pattern for REST services that you would like followed? I definitely would like to discuss when you all slow down and have a chance to assist. In the meantime, I’ll plug around the wiki and reporting code and see what I see JGretchen Moran Enterprise Architect and Technical Account Manager Pentaho Corporation <http://www.pentaho.com/> *The Commercial Open Source Alternative for Business Intelligence* 5950 Hazeltine National Drive, Suite 340 • Orlando, FL 32822, USA +1 407 812-OPEN (6736) • 407 517-6206 • 321 848-8207Get your free download today at http://www.pentaho.com <http://www.pentaho.com/download>.*From:*Darius Jazayeri [mailto:[email protected]] *Sent:* Wednesday, October 19, 2011 4:09 PM *To:* Gretchen Moran *Cc:* [email protected] *Subject:* Re: Spiking on the Pentaho Report Designer OpenMRS datasourceWe don't yet have REST web services for this, but that seems like the way to go.That could be added directly in the reporting module, allowing you to use the pentaho designer with OpenMRS as long as you know the url/port.We would probably also want to create a small "reporting.pentaho" module that would allow you to run those reports from within the OpenMRS UI.-DariusOn Wed, Oct 19, 2011 at 10:56 AM, Gretchen Moran <[email protected] <mailto:[email protected]>> wrote:Hi guys,In the interest of attracting others who might be interested, I’ve replied to the list to continue our conversation. Your comments below Darius make perfect sense and I think represent a feasible and constructive target. If Mike could work with me to speed up finding the best way to query the OpenMRS system for the functions you mention, I would be very grateful.To give you all a primer on what is available on the Pentaho Reporting SDK side –There are two very small but key interfaces that we will need to implement to get a Pentaho report to consume a cohort/dataset combination: the DataFactory interface, which handles interacting with the source of the data, and the TableModel interface, which is the interface that the engine expects an implementation of after having queried the DataFactory for data.The DataFactory interface methods all account for parameterization; as such, as long as our DataFactory implementation processes the parameters that are handed to it, the engine (and the Report Designer tool) already recognize and allow parameter definition and pass them along to the engine that would process the query (which in our case is OpenMRS, which layer I’m not certain yet).Interestingly enough, for a spike or POC, we may not need to implement our own DataFactory, as the Report Designer already exposes a DataFactory that is a Java RMI DataFactory. Simply put, you can reference any Java method that returns a TableModel and use the DataFactory as is, which already has the UI bits in place in the Report Designer. This isn’t an end product, but can quickly allow us to test feasibility of the feature set. There is another, newer DataFactory called the Sequence DataFactory that exposes similar functionality that I will look into.The Pentaho Reporting SDK also has some lower level DataFactories that we may want to consider extending. There is a HQL DataFactory and an SQL DataFactory. I mention these because I am not certain at what level or with what protocol I should be talking to OpenMRS.So that leads to my questions:Is there a service (http, REST, WSDL, other) that will allow me to retrieve the results of the functions that Darius lists below?If not, what is your recommended approach for communicating between a client tool and the OpenMRS system? HQL? Straight JDBC?A few hints (as Darius offered J) as to where to begin to interrogate the code would be greatly appreciated!Thanks so much for your time, Gretchen*From:*Darius Jazayeri [mailto:[email protected] <mailto:[email protected]>]*Sent:* Tuesday, October 18, 2011 6:43 PM *To:* Gretchen Moran *Cc:* Michael Seaton *Subject:* Re: Welcome back! UpdateOkay, we can definitely have a brief framing discussion if that would help.My quick thought is that we want to expose some things from the reporting module. In the report tool you would pick1. a cohort definition 2. a data set definitionAnd in pentaho you'd then get a data set with (usually) the cohort definition as the rows and the data set definition as the columns.(For each of those choices you'd need to provide values for any parameters, and ideally also being able to link them to parameters in the pentaho report.)Mike can point you to the right Java snippets for all these if that would help..."list all cohort definitions" "get the parameters for one particular cohort definition" "list all data set definitions" "get the parameters for one particular dataset definition" "evaluate a cohort definition" "evaluate a dataset definition against a cohort" -Darius ------------------------------------------------------------------------Click here to unsubscribe <mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list
_________________________________________ To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [email protected] with "SIGNOFF openmrs-devel-l" in the body (not the subject) of your e-mail. [mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]
<<image/gif>>

