# add edge comm.CAND_ID.add(cand) zipcode = Zipcode.select(graph, data.CMTE_ZIP).first() if not zipcode: zipcode = Zipcode() zipcode.ZIPCODE = data.CMTE_ZIP graph.push(zipcode) # add edge comm.CMTE_ZIP.add(zipcode) city = City.select(graph, data.CMTE_CITY).first() if not city: city = City() city.CITY = data.CMTE_CITY graph.push(city) # add edge comm.CMTE_CITY.add(city) party = Party.select(graph, data.CMTE_PTY_AFFILIATION).first() if not party: party = Party() party.PARTY = data.CMTE_PTY_AFFILIATION graph.push(party) # add edge comm.CMTE_PTY_AFFILIATION.add(party) state = State.select(graph, data.CMTE_ST).first() if not state: state = State()
cand.CAND_PCC = data.CAND_PCC cand.CAND_ST1 = data.CAND_ST1 cand.CAND_ST2 = data.CAND_ST2 zipcode = Zipcode.select(graph, data.CAND_ZIP).first() if not zipcode: zipcode = Zipcode() zipcode.ZIPCODE = data.CAND_ZIP graph.push(zipcode) cand.CAND_ZIP.add(zipcode) city = City.select(graph, data.CAND_CITY).first() if not city: city = City() city.CITY = data.CAND_CITY graph.push(city) cand.CAND_CITY.add(city) status = Status.select(graph, data.CAND_STATUS).first() if not status: status = Status() status.STATUS = data.CAND_STATUS graph.push(status) cand.CAND_STATUS.add(status) party = Party.select(graph, data.CAND_PTY_AFFILIATION).first() if not party: party = Party() party.PARTY = data.CAND_PTY_AFFILIATION graph.push(party)