Skip to content

Commit

Permalink
Implement caching for parlaeus. See #452
Browse files Browse the repository at this point in the history
  • Loading branch information
breyten committed Jan 26, 2024
1 parent 4c2864a commit 6e5020b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ocd_backend/extractors/parlaeus.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def run(self):
meeting_data = resp.json()
agenda = meeting_data['agenda']
agenda['url'] = url
yield 'application/json', json.dumps(agenda), url, 'parlaeus/' + cached_path

if not self.check_if_most_recent('parlaeus', self.source_definition["key"], 'meeting', agenda, meeting['agid']):
yield 'application/json', json.dumps(agenda), url, 'parlaeus/' + cached_path


class ParlaeusCommitteesExtractor(ParlaeusMeetingsExtractor):
Expand All @@ -60,7 +62,8 @@ def run(self):

for committee in response.get('list', []):
committee['url'] = url
yield 'application/json', json.dumps(committee), None, 'parlaeus/' + cached_path
if not self.check_if_most_recent('parlaeus', self.source_definition["key"], 'committee', committee, committee['cmid']):
yield 'application/json', json.dumps(committee), None, 'parlaeus/' + cached_path


class ParlaeusPersonsExtractor(ParlaeusMeetingsExtractor):
Expand All @@ -75,4 +78,5 @@ def run(self):

for person in response.get('list', []):
person['url'] = url
yield 'application/json', json.dumps(person), None, 'parlaeus/' + cached_path
if not self.check_if_most_recent('parlaeus', self.source_definition["key"], 'person', person, person['raid']):
yield 'application/json', json.dumps(person), None, 'parlaeus/' + cached_path

0 comments on commit 6e5020b

Please sign in to comment.