Skip to content

Commit

Permalink
fix: add personplace relations to person
Browse files Browse the repository at this point in the history
Closes: #55
  • Loading branch information
b1rger committed Feb 29, 2024
1 parent f5e32f9 commit 3d9223d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion viecpro_typesense_detail/details/detail_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import List, Dict, Any
from apis_core.apis_labels.models import Label
from apis_core.apis_vocabularies.models import VocabsBaseClass
from apis_core.apis_relations.models import PersonPerson, PlacePlace, EventEvent, WorkWork, InstitutionInstitution
from apis_core.apis_relations.models import PersonPerson, PlacePlace, EventEvent, WorkWork, InstitutionInstitution, PersonPlace


# maps certain occurrences of label_types to keys in the result dictionary
Expand Down Expand Up @@ -155,6 +155,7 @@ def check_person_relation_type(rel:PersonInstitution):
def parse_person_relations(p:Person, res:Dict[str, Any])-> Dict[str, Any]:
rel: Any
temp_rel: Any
res["related_places"] = []
for rel in p.get_related_relation_instances():
model_name: Any= rel.__class__.__name__

Expand All @@ -172,6 +173,9 @@ def parse_person_relations(p:Person, res:Dict[str, Any])-> Dict[str, Any]:
if model_name == "PersonInstitution":
res["court_functions"].append(temp_rel)

if model_name == "PersonPlace":
res["related_places"].append(temp_rel)

if rel.relation_type.name == "ist geboren in":
res["place_of_birth"] = temp_rel["target"]

Expand Down

0 comments on commit 3d9223d

Please sign in to comment.