def create_template(): return Template.create(templateName=PCE_34, templateRowTypesMap={ "PARTY_WISE_INVALID_VOTE_COUNT": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "invalidVoteCategoryId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] } })
def create_template(): return Template.create( templateName=PCE_CE_RO_V1, templateRowTypesMap={ "PARTY_WISE_VOTE": { "hasMany": True, "isDerived": True, "columns": [ {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY} ], "derivativeRows": [ {"templateName": PCE_35, "templateRowType": "PARTY_WISE_VOTE"} ] }, "REJECTED_VOTE": { "hasMany": True, "isDerived": True, "columns": [ {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY} ], "derivativeRows": [ {"templateName": PCE_35, "templateRowType": "REJECTED_VOTE"} ] } } )
def create_template(): return Template.create( templateName=PCE_POST_PC, templateRowTypesMap={ "PARTY_WISE_POSTAL_VOTE": { "hasMany": True, "isDerived": True, "columns": [ {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY} ], "derivativeRows": [ {"templateName": PCE_CE_RO_V1, "templateRowType": "PARTY_WISE_POSTAL_VOTE"} ] }, "PARTY_WISE_VOTE": { "hasMany": True, "isDerived": True, "columns": [ {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY}, {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY} ], "derivativeRows": [ {"templateName": PCE_CE_RO_V2, "templateRowType": "PARTY_WISE_VOTE"} ] }, TEMPLATE_ROW_TYPE_SEATS_ALLOCATED: { "hasMany": True, "isDerived": False, "columns": [ {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META}, {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META}, {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT}, {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT} ] , "derivativeRows": [ {"templateName": PCE_R2, "templateRowType": "TEMPLATE_ROW_TYPE_SEATS_ALLOCATED"} ] }, TEMPLATE_ROW_TYPE_BONUS_SEATS_ALLOCATED: { "hasMany": True, "isDerived": False, "columns": [ {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META}, {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META}, {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT}, {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT} ], "derivativeRows": [ {"templateName": PCE_PC_BS_1, "templateRowType": "TEMPLATE_ROW_TYPE_SEATS_ALLOCATED"} ] } } )
def create_template(): return Template.create(templateName=PCE_35, templateRowTypesMap={ "PARTY_WISE_VOTE": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "strValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "REJECTED_VOTE": { "hasMany": False, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] } })
def create_template(): return Template.create( templateName=PCE_CE_CO_PR_4, templateRowTypesMap={ "CANDIDATE_FIRST_PREFERENCE": { "hasMany": True, "isDerived": False, "columns": [ {"columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META}, {"columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META}, {"columnName": "partyId", "grouped": False, "func": None, "source": SOURCE_META}, {"columnName": "candidateId", "grouped": False, "func": None, "source": SOURCE_CONTENT}, {"columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT} ] } } )
def create_template(): return Template.create(templateName=PCE_CE_RO_PR_3, templateRowTypesMap={ "CANDIDATE_FIRST_PREFERENCE": { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "candidateId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_CE_RO_PR_2, "templateRowType": "CANDIDATE_FIRST_PREFERENCE" }] } })
def create_template(): return Template.create(templateName=PCE_PC_BS_2, templateRowTypesMap={ TEMPLATE_ROW_TYPE_SEATS_ALLOCATED: { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_PC_BS_1, "templateRowType": TEMPLATE_ROW_TYPE_SEATS_ALLOCATED }] }, TEMPLATE_ROW_TYPE_ELECTED_CANDIDATE: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "candidateId", "grouped": True, "func": None, "source": SOURCE_CONTENT }] }, TEMPLATE_ROW_TYPE_DRAFT_ELECTED_CANDIDATE: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "candidateId", "grouped": True, "func": None, "source": SOURCE_CONTENT }] } })
def create_template(): return Template.create( templateName=PCE_R2, templateRowTypesMap={ "PARTY_WISE_VOTE": { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_CE_RO_V2, "templateRowType": "PARTY_WISE_VOTE" }] }, "REJECTED_VOTE": { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_CE_RO_V2, "templateRowType": "REJECTED_VOTE" }] }, TEMPLATE_ROW_TYPE_VALID_VOTE_COUNT_CEIL_PER_SEAT: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] }, TEMPLATE_ROW_TYPE_MINIMUM_VALID_VOTE_COUNT_REQUIRED_FOR_SEAT_ALLOCATION: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] }, TEMPLATE_ROW_TYPE_SEATS_ALLOCATED_FROM_ROUND_1: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] }, TEMPLATE_ROW_TYPE_VALID_VOTES_REMAIN_FROM_ROUND_1: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] }, TEMPLATE_ROW_TYPE_DRAFT_SEATS_ALLOCATED_FROM_ROUND_2: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] }, # TEMPLATE_ROW_TYPE_DRAFT_BONUS_SEATS_ALLOCATED: { # "hasMany": True, # "isDerived": False, # "columns": [ # {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META}, # {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META}, # {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT}, # {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT} # ] # }, TEMPLATE_ROW_TYPE_SEATS_ALLOCATED_FROM_ROUND_2: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] }, # TEMPLATE_ROW_TYPE_BONUS_SEATS_ALLOCATED: { # "hasMany": True, # "isDerived": False, # "columns": [ # {"columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META}, # {"columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META}, # {"columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT}, # {"columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT} # ] # }, TEMPLATE_ROW_TYPE_SEATS_ALLOCATED: { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_CONTENT }] } })
def create_template(): return Template.create( templateName=CE_201, templateRowTypesMap={ "BALLOT_BOX": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "ballotBoxId", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_BALLOTS_RECEIVED": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_BALLOTS_SPOILT": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_BALLOTS_ISSUED": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_BALLOTS_UNUSED": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_ORDINARY_BALLOTS_IN_BALLOT_PAPER_ACCOUNT": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_ORDINARY_BALLOTS_IN_BALLOT_BOX": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_TENDERED_BALLOTS_IN_BALLOT_PAPER_ACCOUNT": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_TENDERED_BALLOTS_IN_BALLOT_BOX": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, })
def create_template(): return Template.create(templateName=PCE_PC_CD, templateRowTypesMap={ "PARTY_WISE_VOTE": { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_PC_V, "templateRowType": "PARTY_WISE_VOTE" }] }, "REJECTED_VOTE": { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_PC_V, "templateRowType": "REJECTED_VOTE" }] }, TEMPLATE_ROW_TYPE_SEATS_ALLOCATED: { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_PC_SA_1, "templateRowType": TEMPLATE_ROW_TYPE_SEATS_ALLOCATED }] }, TEMPLATE_ROW_TYPE_BONUS_SEATS_ALLOCATED: { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_PC_BS_1, "templateRowType": TEMPLATE_ROW_TYPE_SEATS_ALLOCATED }] }, TEMPLATE_ROW_TYPE_ELECTED_CANDIDATE: { "hasMany": True, "isDerived": True, "columns": [{ "columnName": "electionId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": True, "func": None, "source": SOURCE_META }, { "columnName": "partyId", "grouped": True, "func": None, "source": SOURCE_QUERY }, { "columnName": "numValue", "grouped": False, "func": "sum", "source": SOURCE_QUERY }], "derivativeRows": [{ "templateName": PCE_42, "templateRowType": TEMPLATE_ROW_TYPE_ELECTED_CANDIDATE }, { "templateName": PCE_PC_BS_2, "templateRowType": TEMPLATE_ROW_TYPE_ELECTED_CANDIDATE }] } })
def create_template(): return Template.create( templateName=CE_201_PV, templateRowTypesMap={ "SITUATION": { "hasMany": False, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "strValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "TIME_OF_COMMENCEMENT": { "hasMany": False, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "strValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "BALLOT_BOX": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "ballotBoxId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "strValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_PACKETS_INSERTED_TO_BALLOT_BOX": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "ballotBoxId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_PACKETS_FOUND_INSIDE_BALLOT_BOX": { "hasMany": True, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "ballotBoxId", "grouped": False, "func": None, "source": SOURCE_CONTENT }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_PACKETS_REJECTED_AFTER_OPENING_COVER_A": { "hasMany": False, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] }, "NUMBER_OF_PACKETS_REJECTED_AFTER_OPENING_COVER_B": { "hasMany": False, "isDerived": False, "columns": [{ "columnName": "electionId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "areaId", "grouped": False, "func": None, "source": SOURCE_META }, { "columnName": "numValue", "grouped": False, "func": None, "source": SOURCE_CONTENT }] } })