def getHouseholdCharacteristicsQuery(self): ''' build query for selecting household that match the selected household characteristics''' selectedHChars = [] selectedHChars = self.getSelectedHouseholdCharacteristics() projectid = self.getProjectID() hchars = ReportsSettingsManager () tablename = hchars.setHCharacteristicsTableName(projectid) connector = HouseholdsByCharacteristics() hquery = connector.buildHCharacteristicsQuery(selectedHChars,tablename,projectid) return hquery
def getPersonalCharacteristicsQuery(self): ''' build query for selecting household that match the selected personal characteristics''' selectedRows = [] selectedRows = self.getSelectedPersonalCharacteristics() projectid = self.getProjectID() pchars = ReportsSettingsManager () tablename = pchars.setPCharacteristicsTableName(projectid) connector = HouseholdsByCharacteristics() pquery = connector.buildPCharacteristicsQuery(selectedRows,tablename,projectid) return pquery
def getReportData(self): ''' get households that meet the combined criteria of household and personal characteristics''' pquery = self.getPersonalCharacteristicsQuery() hquery = self.getHouseholdCharacteristicsQuery() projectid = self.getProjectID() #check if any characteristics have been selected pcharselected = len(self.getSelectedPIndexes()) hcharselected = len(self.getSelectedHIndexes()) reporttable = [] report = HouseholdsByCharacteristics() reporttable = report.getReportTable(projectid,pcharselected,hcharselected,pquery,hquery) return reporttable