Hi Mike, I understand now how this serialisation is working.
Back to my first question, does the reporting module support saving the fully-encapsulated way ? Should Indicators Over Time and Data Set Viewer work? Thanks again, Peter On 08/22/2011 05:59 PM, Michael Seaton wrote: > Hi Peter, > > If you serialize a "parent" object that contains unsaved "child" objects > - for example, a ReportDefinition that contains an unsaved > DataSetDefinition property - then the DataSetDefinition is saved in a > fully-encapsulated way within the ReportDefinition, and is not > accessible outside of it at all. > > If you first save your DataSetDefinition via the > DataSetDefinitionService, then add this DataSetDefinition to your > ReportDefinition, and then save your ReportDefinition, the > ReportDefinition will contain a reference to the previously saved > DataSetDefinition - it will not store the entire contents of this > DataSetDefinition separately. This will allow you to use the > DataSetDefinition independently of the ReportDefinition. And any > changes to the DataSetDefinition will be picked up when you evaluate the > ReportDefinition. This is the way things behave when you use the UI of > the reporting module, since each step is done discreetly. > > So, there aren't really different ways of persisting a ReportDefinition > - you always use the ReportDefinitionService to do this. But a > DataSetDefinition can be persisted within a ReportDefinition when the > ReportDefinition is saved (as it simply becomes an embedded property of > the ReportDefinition), or it can be saved on it's own via the > DataSetDefinitionService. > > The same pattern applies for any such Definitions that contain other > Definitions - eg. a DataSetDefinition that contains Indicators, and > Indicator that contains CohortDefinitions, etc... > > Hope this is clear, > Mike > > > On 08/22/2011 06:59 AM, Peter Eichenauer wrote: >> Hi Mike, >> >> the indicators have parameters (startDate, endDate, location). Probably >> they aren't displayed on the Indicators Over Time page because I am not >> saving them independently of the ReportDefinition. >> >> Using your wording the different ways I was talking about: >> 1) "saving a ReportDefinition using ReportDefinitionService" >> 2) "saving independently of the ReportDefinition" >> >> If I understand right, if you save an indicator independently of the >> ReportDefinition you will have the serialized indicator definition twice >> in the database. >> For example (column serialized_data): >> <indicator id="327"> >> <parameterizable >> class="org.openmrs.module.reporting.indicator.CohortIndicator" id="328" >> retired="false"> >> <name>HIVPatientsOnIndinavirDrugIndicator</name> >> <parameters reference="4"/> >> <type>FRACTION</type> >> <cohortDefinition id="329"> >> <parameterizable >> class="org.openmrs.module.reporting.cohort.definition.CompositionCohortDefinition" >> id="330" retired="false"> >> <name>HIVPatientsOnIndinavirDrug</name> >> <parameters reference="23"/> >> <log class="org.apache.commons.logging.impl.SLF4JLocationAwareLog" >> reference="26"/> >> <searches id="331"> >> <entry> >> <string>patientsInHIVProgram</string> >> <org.openmrs.module.reporting.evaluation.parameter.Mapped reference="28"/> >> </entry> >> <entry> >> <string>patientsOnIndinavirDrug</string> >> <org.openmrs.module.reporting.evaluation.parameter.Mapped id="332"> >> <parameterizable >> class="org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition" >> id="333" retired="false"> >> <name>patientsOnIndinavirDrug</name> >> <parameters id="334"/> >> <query>select distinct o.patient_id from orders o,concept c where >> o.concept_id=c.concept_id and >> c.uuid='3cd3ef46-26fe-102b-80cb-0017a47871b2' and >> o.discontinued=0 and o.voided=0</query> >> </parameterizable> >> <parameterMappings id="335"/> >> </org.openmrs.module.reporting.evaluation.parameter.Mapped> >> </entry> >> </searches> >> <compositionString>patientsInHIVProgram AND >> patientsOnIndinavirDrug</compositionString> >> </parameterizable> >> <parameterMappings reference="37"/> >> </cohortDefinition> >> <denominator reference="38"/> >> </parameterizable> >> <parameterMappings reference="39"/> >> </indicator> >> >> Do you recommend to save indicators always independently? >> Is the report definition in the database updated if you modify an >> indicator in the UI which was saved independently? >> >> Thanks, >> Peter >> >> On 08/20/2011 04:16 AM, Michael Seaton wrote: >>> Hi Peter, >>> >>> I'm not totally understanding your questions I'm afraid. A couple of >>> comments: >>> >>> * I can't remember if this is the case or not, but it's possible that >>> the Indicators Over Time page only displays Indicators that have certain >>> parameters (eg. startDate, endDate, location) >>> >>> * I'm pretty sure the current version of the DataSetViewer only allows >>> you to choose DataSetDefinitions which have no parameters (clearly this >>> needs work) >>> >>> * If you are programmatically creating ReportDefinitions, you will only >>> see the underlying DataSetDefinitions in the UI if you are explicitly >>> saving these independently of the ReportDefinition. Similarly, you will >>> also see underlying Indicators in the UI if you are explicitly saving >>> these independently of the DataSetDefinition. >>> >>> For your last point about report definitions being loaded and saved in >>> different ways...what do you mean here? Can you lay out the different >>> ways that you are seeing and where? >>> >>> Thanks, >>> Mike >>> >>> >>> >>> >>> On 08/17/2011 08:08 AM, Peter Eichenauer wrote: >>>> Hi, >>>> >>>> I am saving a report definition programmatically using >>>> ReportDefinitionService. In UI the report runs fine but I can't use >>>> "Indicators Over Time" and "Data Set Viewer". I would expect that >>>> indicators and DataSet appear on these pages, but they don't. >>>> >>>> It seems report definitions are loaded and saved in different ways in >>>> the reporting module. Which way is recommended? >>>> >>>> Thanks, >>>> Peter _________________________________________ 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]

