Thread Previous • Date Previous • Date Next • Thread Next |
Hi Hieu, I have been looking at this again, and have manged to get it working (at least I think) with the demo DB and the Zambia database. It is strange, and I think it comes down to the organisationUnitService.getNumberOfOrganisationalLevels() method. I assumed that this returned the number of organizational levels, and it worked for my database. However with the Sierra Leone DB, there are also 4 levels, but the order of the levels is not sequential with respect to the primary key. This is the only thing that I can figure out that might effect what is returned from that method. I tried deciphering this method, but it was not clear, so I introduced a new one (HibernateOrganisationUnitStore and DefaultOrganisationUnitService.java), that made more sense to me.. @Override public int getMaxOrgUnitLevels() { final String sql = "SELECT count(level) FROM orgunitlevel"; return jdbcTemplate.queryForInt( sql ); } I then use this method to calculate the final number of levels in setUpQueryForDrillDownDescendants if ( maxLevel == null ) { maxLevel = organisationUnitService.getMaxOrgUnitLevels(); } Perhaps this is not the right way to do it, but anyway, you get my point from the code I hope. I just want to get the maximum orgunitlevel. The setUpQueryGetDescendants method is a bit better I think but I am still not 100% sure what to do with the selected unit.. One thing that I did not understand in the original file was whether the parent orgunits data count should be displayed, along with the descendants. This method, as I understand it, is supposed to provide a list of children orgunits (of the selected orgunit) along with a count of all data values of all descendants, grouped by the immediate child of the selected organizational unit. Perhaps again, we are not seeing eye to eye on this, but this has been my intended behaviour all along. A couple of things still are a mystery to me..why all the 0's in the orgunitstructure table? This again comes back to my long standing gripe with DHIS, assuming that NULLs and zeroes are the same thing. I guess it is impossible to have an orgunit with id 0, but it would seem to make little sense to me in this case. I think all of the 0s should actually be NULL. Lars? I got these changes (against rev 2086 from 2.0.5 branch) to work with both the demo DB as well as the Zambia database that I shared with you on the DropBox and it provided the results that I expected. I am including the output (export.pdf) of ( http://localhost:8080/dhis/dhis-web-maintenance-dataadmin/searchResult.action?searchOption=OrganisationUnit&periodTypeId=Monthly&fromDate=2010-01-01&toDate=2010-06-30&selectedUnitChanger=264 ) from the SL demo DB, which allowed be pretty quickly to determine that data was missing from Selenga for May 2010. This is the main functionality that I am trying to acheive...to find the obvious gaps in the data pretty quickly by examining patterns in the levels of data submission. If it is constant, it is probably OK, but sudden changes generally indicate that data may be missing. Sorry for all the back and forth. I should have tested it against the SL demo DB as well. Let me know what you guys think. Regards, Jason -- Jason P. Pickering email: jason.p.pickering@xxxxxxxxx tel:+260968395190
Attachment:
data_browser_2_0_5.diff
Description: Binary data
Attachment:
StatementManagerDataBrowserStore.java
Description: Binary data
Attachment:
export.pdf
Description: Adobe PDF document
Thread Previous • Date Previous • Date Next • Thread Next |