Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Ticket #916 (assigned defect)

Opened 2 years ago

Last modified 11 months ago

Report generation not handling date columns correctly (possible parsing error)

Reported by: jmiranda Assigned to: jmiranda (accepted)
Priority: blocker Milestone: BIRT Report Module v1.9
Component: BIRT Report Module Keywords:
Cc: Introductory Ticket: 0
Code Review Status:

Description

Email from Jeremy Keeton (jkeeton@pih.org) @ 7/16/2008 3:02 AM EDT

===== BEGIN email snippet

I think I’ve figured out what’s going on here. I did the following:

1. I generated the first PDF called “bobete_emr.pdf” directly from the emr 2. I downloaded the report design and the dataset directly from the server and opened them up in the BIRT RCP designer 3. I setup the dataset without editing the datatypes under “Select the file and columns for the dataset” and generated “bobete_wo_datatypes.pdf”

4. Lastly I setup the dataset and edited the datatypes (only the ones that were dates) and generated “bobete_w_datatypes.pdf” –THIS generated the correct report with the correct numbers.

So it looks like somehow BIRT in OpenMRS doesn’t know that the following report params are dates:

Any of the report params with the word date, obs_datetime and the column Earliest ARV start

So when it does a comparison against these dates (i.e. “DateTimeSpan.years(dataSetRowBirthdate?,paramsReport End Date? )>14”) it sees “Birthdate” as a string and counts ‘0’ patients.

One other note, there was a warning in the catalina.log file for every patient that says “There exists an error in toDate method” Unparsable date: “2007-08-16”. I’ve attached a sample, I couldn’t attach the whole log file because for some reason it was 760MB after running this, so I'm guessing this means there was a very long error for every patient.

===== END email snippet

Change History

07/17/08 17:56:03 changed by jmiranda

  • status changed from new to assigned.

During report generation, the module will write the new CSV dataset to the filesystem and then change the BIRT report design (XML) to references the new dataset. When overriding the flatfile dataset query to include the new filename, the module drops off an important part of the query which keeps track of the column data types.

The syntax for the flatfile dataset used to be a simple SQL-like query. The column data types must have been stored somewhere else in the report design.

SELECT columns FROM table

In some recent version of BIRT, the designer started tacking on the 'column_info' expression which includes the data type for every column.

SELECT columns FROM table : { column_info }

The BirtDataSetQuery class was only compatible with the former syntax, so it kept dropping off this critical section of the query during the report generation. This caused BIRT to essentially 'forget' the data type for each column, which means Integer, Date, and Boolean columns all became String columns.

Therefore, when performing Date operations on a String column (like the following):

DateTimeSpan.years(dataSetRowBirthdate?,paramsReportEnd Date?)>14

the BIRT report engine would complain

There exists an error in toDate method” Unparsable date: “2007-08-16”

The fix was to rewrite the query parsing utilities and make sure we maintain the extra data type column information.

04/29/09 13:08:01 changed by jmiranda

  • intro_ticket changed.
  • review_status changed.
  • milestone set to BIRT Report Module v1.9.