mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-25 20:22:33 +02:00
checkpoint: First iteration of fixed mapping
This commit is contained in:
parent
9d7bb07989
commit
2d9e3f19f9
@ -63,13 +63,20 @@ def parse_date_of_birth(data: dict) -> str | None:
|
|||||||
Returns:
|
Returns:
|
||||||
str | None: date of birth or None if not found
|
str | None: date of birth or None if not found
|
||||||
"""
|
"""
|
||||||
if "tns:geburt" in (base := data["tns:beteiligter"]["tns:auswahl_beteililgter"]["tns:natuerlichePerson"]):
|
if "tns:geburt" in (base := data["tns:beteiligter"]["tns:auswahl_beteiligter"]["tns:natuerlichePerson"]):
|
||||||
base = base["tns:geburt"]["tns:geburtsdatum"]
|
base = base["tns:geburt"]["tns:geburtsdatum"]
|
||||||
if isinstance(base, str):
|
if isinstance(base, str):
|
||||||
return base
|
return base
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# def map_role_id_to_enum(role_id: str) -> RelationshipRoleEnum:
|
def map_role_id_to_enum(role_id: str) -> RelationshipRoleEnum:
|
||||||
|
match role_id:
|
||||||
|
case "086":
|
||||||
|
return RelationshipRoleEnum.GESCHAEFTSFUEHRER
|
||||||
|
case "285":
|
||||||
|
return RelationshipRoleEnum.PROKURIST
|
||||||
|
case _:
|
||||||
|
raise KeyError(f'Uknown role_id: {role_id}')
|
||||||
|
|
||||||
|
|
||||||
def parse_stakeholder(data: dict) -> CompanyRelationship | None:
|
def parse_stakeholder(data: dict) -> CompanyRelationship | None:
|
||||||
@ -138,8 +145,8 @@ def parse_stakeholder(data: dict) -> CompanyRelationship | None:
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
# TODO get role via ID
|
# TODO get role via ID
|
||||||
"role": RelationshipRoleEnum(
|
"role": map_role_id_to_enum(
|
||||||
data["Rolle"]["Rollenbezeichnung"]["content"]
|
data["tns:rolle"]["tns:rollenbezeichnung"]["code"]
|
||||||
),
|
),
|
||||||
"type": CompanyRelationshipEnum.PERSON,
|
"type": CompanyRelationshipEnum.PERSON,
|
||||||
}
|
}
|
||||||
@ -606,13 +613,13 @@ def map_unternehmensregister_json(data: dict) -> Company:
|
|||||||
result["founding_date"] = map_founding_date(data)
|
result["founding_date"] = map_founding_date(data)
|
||||||
|
|
||||||
# TODO adapt...
|
# TODO adapt...
|
||||||
# for i in range(
|
for i in range(
|
||||||
# 2, len(data["tns:grunddaten"]["tns:verfahrensdaten"]["tns:beteiligung"])
|
2, len(data["tns:grunddaten"]["tns:verfahrensdaten"]["tns:beteiligung"])
|
||||||
# ):
|
):
|
||||||
# people = parse_stakeholder(
|
people = parse_stakeholder(
|
||||||
# data["tns:grunddaten"]["tns:verfahrensdaten"]["tns:beteiligung"][i]
|
data["tns:grunddaten"]["tns:verfahrensdaten"]["tns:beteiligung"][i]
|
||||||
# )
|
)
|
||||||
# result["relationships"].append(people)
|
result["relationships"].append(people)
|
||||||
result = map_co_relation(result)
|
result = map_co_relation(result)
|
||||||
return Company(**result)
|
return Company(**result)
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user