Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 126 Next »

Building Reports Inside OpenMRS (For Implementers)

You can create three different types of reports: a Period Indicator Report, a Row-Per-Patient Report, or a Custom Report (Advanced).

All reports contain a Report Definition which is linked to one or more DataSet Definitions. In the first two options, the link between the Report Definition and the appropriate DataSet Definition is set automatically. However, to create a Custom Report (Advanced), you must manually link the Report Definition and DataSet Definition. For more information, see Types of Reports.

The two tutorials that follow demonstrate how to build a Period Indicator Report and a Simple Row-Per-Patient Report. The first example shows a report where the link between the Report and DataSet Definitions is automatic, whereas the second shows a manual setting of the link.

Building Row-Per-Domain Reports

Building a Simple Row-Per-Patient Step-By-Step

This step-by-step tutorial will guide the user in the creation of a Simple Row-Per-Patient Report (See  Row-Per-Domain Object Report Definition for details). It will also show how to create the DataSet Definition for the Report Definition.

This Simple Row-Per-Patient Report will output a list of patients from Boston and output their birthdate and gender.

Step 1. Build DataSet Definition

Step 2. Build Report

Step 3. Add DataSet to Report
 
 

Step 1. Build DataSet Definition

1

Click 'Administration' from the main toolbar.


2

Under 'Manage Report Definitions', click 'Data Set Definitions'.


3

Click the plus sign next to Simple Patient DataSet to add a new Simple Row Per Patient DataSet.


4

Basics: Under 'Name', input the title of your DataSet, so that you can find it later. You can type a more detailed description under 'Description.'


5

Properties: There are four different categories of patient properties you can display in your report: person/patient properties, person attribute types, identifier types, and program workflow states. Under each, you can input Fixed Value properties, or parameters, which will allow the dataset to be reused. For example, if you input one column as a parameter, you can pass in at runtime what you want this column to contain under the appropriate category.

In this example, we will display a list of patients in Boston and output their birthdate and gender. All of these are patient/person attributes, so we add 2 inputs here. You can add more than one property by clicking the plus button next to the property textbox.


You are now ready to build the Report Definition. 

Step 2. Build Report Definition

1

Click 'Report Definitions' from the toolbar above.


2

Click 'Custom Report (Advanced)'.


3

Enter the name of your report under 'Name.' You can enter a more detailed description in the 'Description' textbox. Then click 'Submit.'



You are now ready to add the DataSet you created in Step 1 to your new Report Definition.

Step 3.  Add DataSet Definition to Report Definition

1

In the Report Editor, click the plus sign under Dataset Definitions to add a new dataset.


2

In the 'Key', enter an appropriate label for your DataSet. A label will appear as , for example, the sheet name for your report in an Excel file. Here, we enter 'RPP DataSet Key'. Under 'DataSetDefinition,' select the name of the dataset you created in Step 1 (Simple Row Per Patient DataSet). Then click submit.


3

In this stage, you may add parameters to the Report, such as Start Date, EndDate, and Location. Our report will list patients from a specific location, which we want to be able to change every time the program is run. We add a parameter 'Location' to enable this. Click the plus sign next to 'Add' under Parameters. Under 'New Parameter', because it is a single value, choose 'Single' under type, and choose 'Location' from the adjacent drop-down. Type a name under Name and an appropriate label, which will be displayed when the report is run, for your new parameter. Then click submit.


 

Your Simple Row-Per-Patient report is now complete. See “Running Reports” for information on how to run it. Following these steps, your report should look like the example to the right.



Building Indicator Reports

Period Indicator Report Step-By-Step

This step-by-step tutorial will guide the user in making indicator reports, using a period indicator report as an example.

See Indicator Report Definition for details.
  

Create a report that only includes patients in the Heart Failure Program. The first question will be:

* Percentage of men whose main job is farming

Step 1. Build Cohorts

Step 2. Build Indicators

Step 3. Build Dimension

Step 4. Create Report

Step 1. Build Cohorts

1

Click 'Administration' from the main toolbar.

 

2

Under 'Manage Report Definitions,' select 'Cohort Queries'.


3

Our first cohort will contain all male patients. Select 'Gender Query' by clicking the plus sign next to the cohort category.


4

Type the name of your cohort under 'Name.' In this case, we will name it 'Male Cohort'. You can type a more detailed description under 'Description'.

 

5

We want to include only males in this cohort. As such, under 'Properties,' set the Male property to be 'True' and a fixed value. If you want to decide whether to include males or not each time you run your report, you can set this as a parameter. We do not want to include females or patients of unknown gender in the report, so check 'False'. Click 'Save.'
*Previewing the cohort can show you whether there are any patients in the database to those specifications. You can generate a preview by clicking 'Preview' and selecting 'Run.'



6

We will now build our second cohort, 'Farmers', which will contain all the patients whose main occupation is farming. Go back to the 'Cohort Query' page by clicking the 'Cohort Queries' link on the toolbar above.


7

This type of query is a 'Coded Observation Query.' Click the plus sign next to the 'Coded Observation Query' to create the Farmers cohort.


8

Type 'Farmer Cohort' under name, and under properties, add in the observation 'MAIN ACTIVITY.' This is a fixed value, as you do not want to change the observation each time you run the report. Also, set the type of observation to 'Last' to take only the latest occupation of the patients into account. Under 'Constraint', set the comparison to a fixed value, the comparison to 'IN,' and the value to compare against to 'Farmer.' This sets the observation of 'Main activity' to the value 'Farmer.' All of these fields are fixed values because we do not want the choice of changing what the cohort contains each time the report is run.
We will leave the 'When' and 'Other' categories blank because the dates of observation and location will be set by the report parameters, which will be described in a later step.


9

We will now create our final cohort for this report, the 'In Heart Failure Program Cohort', which will contain all patients who are in the Heart Failure Program on a specific date. Go back to the 'Cohort Query' page and click the plus sign next to 'In Program Query'.


10

Under 'Name', type 'In Heart Failure Program.' Under 'Properties', set Programs to a fixed value and the 'Heart Failure Program.' Under 'Or Specifically', since we want to check the patients in the heart failure program on a specific date, set the property as a Parameter, as we may change the date each time we run the program, and the label as 'effectiveDate.' Then click 'Save'.

You are now ready to build an Indicator.

Step 2. Building Indicators

We will now build the 'Farmers Indicator', which will return the percent of farmers in the Heart Failure Program at the report 'End Date' and in a specific location.

1

Under 'Administration', click 'Indicator Definitions'.


2

Under 'Indicator Manager', click 'Create Cohort Indicator' to create a new indicator.


3

Under 'Name' time in 'Farmers Indicator.' Under 'Type', select 'Fraction', since this indicator will show the percent of farmers in the heart failure program. The 'Count' type will return the number of individuals in a cohort, and the 'Logic' type will allow you to perform other aggregate functions such as mean, median, etc.
Also check the Standard Parameters of 'startDate', 'endDate', and 'location', since we want all of these to be passed in and have the choice of changing at the initialization of a report.


4

For the 'Location Filter', click edit mappings to set it to 'Health Center Location.' Set it to a parameter, and of type 'Location.' Now, the indicator is restricted to a health center location which will be passed in at the run of the report.



5

For the 'Numerator', click edit mappings, and choose 'Farmer Cohort' for CohortDefinition.


6

For the 'Denominator', click edit mappings, and choose 'In Heart Failure Program'. Note that the numerator is automatically constrained by the denominator, so only farmers in the Heart Failure Program will be aggregated in the numerator since 'In Heart Failure Program' is the definition of the denominator.
For the effectiveDate, make sure to make it a parameter, and set it to 'End date'. Now, the End Date standard parameter initially passed in to the report at its start will be passed down to the effectiveDate of the indicator. See Understanding parameters for more details.


Cohort Indicator with Dimensions Report Step-By-Step

This step-by-step tutorial will guide the user in the creation of indicator reports, using a Cohort Indicator with Dimensions Report as an example. It will show how to create the underlying components for the report as well as how to set up the first question. This example will highlight how parameters are used in reports. See Understanding Parameters for details.
 
See Indicator Report Definition for details.
 
 

The first question will be:  

* People in the HIV Program at the endDate of the report.

Needed components (Must be done in this order as the first items are building blocks for items thereafter):

Step 1. Build Cohort

Step 2. Build Indicator

Step 3. Create Data Set Definition

Step 4. Create Report

Step 5. Add Data Set Definition to Report

Building Indicator Report Components

Creating Cohort Queries

See Cohort Query Definition.

 

 
 

Male Cohort--Returns all male patients.

 

 

 
 

Farmer Cohort--Returns all patients whose main activity is farming.

 

 
 

In Heart Failure Program Cohort--Returns all patients who are in the Heart Failure Program on a specific date.  You will set that date to be the End Date of the report in the indicator.  By using a parameter here, this cohort can be reused more easily. For instance, you could create two indicators, one which uses this cohort with the End Date of the report and one which uses this cohort with the Start Date of the report.

 

 

 
 

Heart Failure Form Cohort--Returns the patients who have any of the Heart Failure forms filled out.

 

 
 


In HIV Program Cohort--Returns the patients who in the HIV Program at the End Date of the report.
 

 

 
 


Transportation Cost Cohort--Returns the patients who have a transportation cost observation.


 
 

Health Center Location Cohort--Returns the patients who have been assigned a specific health center as a patient attribute.


 
 


Composition Cohorts

Composition Cohorts are a way to combine two or more cohorts or negate a single cohort. See Cohort Queries.

Farmer and In Heart Failure Program Cohort--Returns all patients who both have the main activity of farming and are in the Heart Failure Program on a specific date.
 
 

Creating Cohort Indicators

See Indicator Definition.

 

 

 
 

Farmer Indicator--Returns the percent patients in the Heart Failure Program at the report End Date whose main activity is farming and whose health center is set as the Location parameter passed into the report (at runtime).

 

You have to create cohorts for Health Center Location, Farmers, and In Heart Failure Program before you can create this indicator. You can't aggregate something you haven't created yet.
See Cohorts for step-by-step instructions.
 

 
NOTE--The cohort must have the word Location in the name in order to be used in the Location Filter.
 
 

 
NOTE--The numerator is automatically constrained by the denominator. This means that the numerator will only return members who are Farmers and also In Heart Failure Program.  
 
 
Notice that you have to put in the Start Date, End Date, and Location. The End Date parameter will be passed into the denominator cohort, In Heart Failure Program. The Start Date and Location are not used. 
The only reason to keep these two as parameters for your indicator is so that you can use this indicator in a Period Indicator Report (which requires all three parameters to be present). 

See Understanding Parameters for a quick overview of parameters use.
 
 

Transportation Cost Indicator--Returns the median cost of transport for the cohort of patients who have a cost of transport (in this case in Rwandan Francs).

 

 
NOTE--If you have any problems with the logic tokens not being recognized and the indicator preview failing, make sure that your logic tokens have been registered.
 
 


In HIV Program Indicator--Returns the number of patients in the HIV Program on the End Date of the report.
 




Creating Dimensions

See Dimension Definition.

 

 


 

 
You have to create a Male Cohort before this option will show up in the Cohort Definition drop down here.
See Cohorts for step-by-step instructions.  Now create a Female Cohort Query and Add that to your dimension on your own.
 

Creating a Period Indicator Report


Setting Up a Period Indicator Report

Add Filter to Report


Add Dimension(s) to Report


Add Indicators (Questions) to Report



Running a Period Indicator Report

See Running a Period Indicator Report.

 
 

Creating an Indicator with Dimensions Report

Create Data Set Definition

 

 

 
 

Add Question

 

 

 

 
 

Create Report



 

 
 

Add Data Set Definition

 

 

 

 

 
 

Running an Indicator with Dimension Report

See Running an Indicator with Dimension Report.

 
 

Screen Casts Step-By-Step

To help get you started with the Reporting Module, we have put together a few screen casts.

  • No labels