Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Use pydash for faster deep dict checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood committed Jan 18, 2024
1 parent 0864dbe commit d6cb3ab
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 201 deletions.
2 changes: 2 additions & 0 deletions app/records/schemas/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Record(Details):
closure_status: str | None = None
access_condition: str | None = None
languages: list[str] = []
related_materials: list[dict] = []
hierarchy: list[dict] = []

def __init__(self, id: str):
Expand All @@ -56,6 +57,7 @@ class Aggregation(Details):
closure_status: str | None = None
access_condition: str | None = None
languages: list[str] = []
related_materials: list[dict] = []
hierarchy: list[dict] = []

def __init__(self, id: str):
Expand Down
2 changes: 2 additions & 0 deletions app/sources/rosetta/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def parse_results(self, raw_results, source_url):
record.closure_status = parsed_data.closure_status()
record.access_condition = parsed_data.access_condition()
record.languages = parsed_data.languages()
record.related_materials = parsed_data.related_materials()
record.hierarchy = (
parsed_data.hierarchies()[0]
if len(parsed_data.hierarchies())
Expand Down Expand Up @@ -132,6 +133,7 @@ def parse_results(self, raw_results, source_url):
record.closure_status = parsed_data.closure_status()
record.access_condition = parsed_data.access_condition()
record.languages = parsed_data.languages()
record.related_materials = parsed_data.related_materials()
record.hierarchy = (
parsed_data.hierarchies()[0]
if len(parsed_data.hierarchies())
Expand Down
Loading

0 comments on commit d6cb3ab

Please sign in to comment.