Sync deputies once a month #143

Closed
opened 2026-09-12 20:08:30 +00:00 by aniram · 4 comments
Owner
  • Add ON CONFLICT clause to the statement that syncs deputies from api/v2/deputados/<ID>
- [x] Add ON CONFLICT clause to the statement that syncs deputies from `api/v2/deputados/<ID>`
aniram added this to the 2027.1 milestone 2026-09-12 20:08:30 +00:00
Author
Owner

This will probably solve problems like this one

This will probably solve problems like this one
Author
Owner

This table, "deputy", was added because I wanted to show if a deputy is still active on their detail page, and this table has a column called ultimoStatus_situacao with this information.

This table, "deputy", was added because I wanted to show if a deputy is still active on their detail page, and this table has a column called **ultimoStatus_situacao** with this information.
Author
Owner

I cannot add it to the sync script because it is supposed to be synced more or less once a month and not daily. Add it to a separate cronjob when the time comes.

I cannot add it to the sync script because it is supposed to be synced more or less once a month and not daily. Add it to a separate cronjob when the time comes.
aniram added reference fix/show-amendments-sum-in-detail-page 2026-10-05 17:44:03 +00:00
aniram changed reference from fix/show-amendments-sum-in-detail-page to feat/add-sync-of-deputies-from-JSON-API 2026-10-05 17:44:35 +00:00
Author
Owner

@aniram wrote in #143 (comment):

This will probably solve problems like this one

This problem here was not purely related to the fact that this deputy was from a different legislature but also due to the detail page using the SUM function which returns NULL in their case while the expected return type was float64.
I've set it to a float64 pointer for now but the best solution is for the detail page to be of the member's last legislature and MAYBE also show other legislatures if possible, currently it fetches data from the current legislature only except for the projects section since its data comes from across all legislatures.
This endpoint gives us all legislatures the deputy was elected for: https://dadosabertos.camara.leg.br/api/v2/deputados/<MEMBER_ID>/historico

We could also hide certain parts of the detail page according to the legislature.

@aniram wrote in https://git.marinabsa.com/overdrives/chambersbr/issues/143#issuecomment-1204: > This will probably solve problems like this one This problem here was not purely related to the fact that this deputy was from a different legislature but also due to the detail page using the SUM function which returns NULL in their case while the expected return type was float64. I've set it to a float64 pointer for now but the best solution is for the detail page to be of the member's last legislature and MAYBE also show other legislatures if possible, currently it fetches data from the current legislature only except for the projects section since its data comes from across all legislatures. This endpoint gives us all legislatures the deputy was elected for: `https://dadosabertos.camara.leg.br/api/v2/deputados/<MEMBER_ID>/historico` We could also hide certain parts of the detail page according to the legislature.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
overdrives/chambersbr#143
No description provided.