Skip to content

Commit

Permalink
Merge pull request #75 from NewWays-TechForImpactKAIST/feat-api-add-year
Browse files Browse the repository at this point in the history
API 받아온 정보에 당선연도 필드 추가
  • Loading branch information
keonly authored Nov 27, 2023
2 parents 42dde19 + 05e1733 commit 72a535d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions API/MongoDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Councilor:
job: str
eduId: int
edu: str
year: str

@classmethod
def from_dict(cls, data: dict):
Expand All @@ -31,6 +32,7 @@ def from_dict(cls, data: dict):
job=data.get("job"),
eduId=int(data.get("eduId")),
edu=data.get("edu"),
year=data.get("year"),
)

def to_dict(self):
Expand All @@ -47,4 +49,5 @@ def to_dict(self):
"job": self.job,
"eduId": self.eduId,
"edu": self.edu,
"year": self.year,
}
1 change: 1 addition & 0 deletions API/elected.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def fetch_data(
data_list = []
for item in root.findall(".//item"):
data_entry = {child.tag: child.text for child in item}
data_entry["year"] = sgId[:4]

for column in drop_columns:
data_entry.pop(column)
Expand Down

0 comments on commit 72a535d

Please sign in to comment.