#NEWLINE# @ property #NEWLINE# def columns( self ) : #NEWLINE# #INDENT# columns = [ DatabaseColumn ( 'Total child registered ever' , CountUniqueColumn ( 'doc_id' , alias = 'total' ) ) ] #NEWLINE# if ( ( ( 'startdate' not in self . config ) and ( 'enddate' not in self . config ) ) or ( ( 'startdate' not in self . config ) and ( 'enddate' in self . config ) ) ) : #NEWLINE# #INDENT# columns . extend ( [ DatabaseColumn ( 'Total open children cases' , CountUniqueColumn ( 'doc_id' , alias = 'no_date_opened' , filters = ( self . filters + [ EQ ( 'closed_on' , 'empty' ) ] ) ) ) , DatabaseColumn ( 'Total closed children cases' , CountUniqueColumn ( 'doc_id' , alias = 'no_date_closed' , filters = ( self . filters + [ NOTEQ ( 'closed_on' , 'empty' ) ] ) ) ) , DatabaseColumn ( 'New registrations during last 30 days' , CountUniqueColumn ( 'doc_id' , alias = 'no_date_new_registrations' , filters = ( self . filters + [ AND ( [ GTE ( 'opened_on' , 'last_month' ) , LTE ( 'opened_on' , 'today' ) ] ) ] ) ) ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# columns . extend ( [ DatabaseColumn ( 'Children cases open at end period' , CountUniqueColumn ( 'doc_id' , alias = 'opened' , filters = ( self . filters + [ AND ( [ LTE ( 'opened_on' , 'stred' ) , OR ( [ EQ ( 'closed_on' , 'empty' ) , GT ( 'closed_on' , 'stred' ) ] ) ] ) ] ) ) ) , DatabaseColumn ( 'Children cases closed during period' , CountUniqueColumn ( 'doc_id' , alias = 'closed' , filters = ( self . filters + [ AND ( [ GTE ( 'closed_on' , 'strsd' ) , LTE ( 'closed_on' , 'stred' ) ] ) ] ) ) ) , DatabaseColumn ( 'Total children followed during period' , CountUniqueColumn ( 'doc_id' , alias = 'followed' , filters = ( self . filters + [ AND ( [ LTE ( 'opened_on' , 'stred' ) , OR ( [ EQ ( 'closed_on' , 'empty' ) , GTE ( 'closed_on' , 'strsd' ) ] ) ] ) ] ) ) ) , DatabaseColumn ( 'New registrations during period' , CountUniqueColumn ( 'doc_id' , alias = 'new_registrations' , filters = ( self . filters + [ AND ( [ LTE ( 'opened_on' , 'stred' ) , GTE ( 'opened_on' , 'strsd' ) ] ) ] ) ) ) ] ) #NEWLINE# #UNINDENT# return columns