Skip to content

Commit

Permalink
Merge branch 'feature-unificado' of https://github.com/Abrimos-info/a…
Browse files Browse the repository at this point in the history
…pi-politica-bridge into feature-unificado
  • Loading branch information
alanabravo committed Jun 3, 2024
2 parents 8eb49b0 + ee2d552 commit 5a8b45d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
39 changes: 33 additions & 6 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Build data
name: Build data unificado

on:
push:
Expand All @@ -27,7 +27,7 @@ jobs:
repository: abrimos-info/api-politica
path: api
ref: feature-unificada
- name: Set up Python 3.10
- name: Set up Python 3.10 unificado
uses: actions/setup-python@v3
with:
python-version: "3.10"
Expand All @@ -51,11 +51,38 @@ jobs:
python db_create.py 1 && python application.py &
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
cd ..
- name: Correr unificada
- name: Correr pipeline de carga de bridge a api
run: |
cd bridge
ls -la
python pipeline.py local unificado.json
- name: Exportar datos
- name: Exportar datos de api a json
run: |
curl -H "Authorization: Bearer 1" http://localhost:5000/export-min/
echo "Export"
curl -s -H "Authorization: Bearer 1" http://localhost:5000/export-min/ > gob_export_min_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/area/ > gob_area_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/party/ > gob_party_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/chamber/ > gob_chamber_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/contest/ > gob_contest_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/coalition/ > gob_coalition_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/membership/ > gob_membership_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/role/ > gob_role_unificado.json
curl -s -H "Authorization: Bearer 1" http://localhost:5000/person/ > gob_person_unificado.json
- name: Get current date
run: |
echo "DATE={$(date +'%Y-%m-%d')}" >> $GITHUB_OUTPUT
id: "date"
- uses: actions/upload-artifact@v4
with:
name: gob_json-elecciones_unificado-${{steps.date.outputs.DATE}}
path: |
gob_*.json
bridge/Documentacion_API_2024.pdf
- uses: actions/upload-artifact@v4
with:
name: gob_csv-elecciones_unificado-${{steps.date.outputs.DATE}}
path: |
./bridge/csv_db/*.csv
bridge/Documentacion_API_2024.pdf
Binary file added Documentacion_API_2024.pdf
Binary file not shown.
8 changes: 0 additions & 8 deletions static_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
import json
import sys

# Campaign
#SHEET_ID = "1fKXpwXhKlLLG-kjh8udQIH9poNLs7kAzSnXndZ1Le4Y"
#ST_RANGES = {
# "area": "A1:H427", "chamber": "A1:C410", "role": "A1:F410",
# "coalition": "A1:D49", "party": "A1:F80",
# "profession": "A1:B119", "contest": "A1:G426"
# # "past-membership": "A1:G1",
# }
CSV_DB_PATH = 'csv_db_officeholders'

CONFIG_FILE = sys.argv[2];
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def send_data(base_url, endpoint, dataset):
"""
full_url = base_url + endpoint + '/'
deleted = []
with ProgressBar(max_value=len(dataset), redirect_stdout=True) as bar:
with ProgressBar(max_value=len(dataset), redirect_stdout=True, min_poll_interval=5) as bar:
for i, row in enumerate(dataset, start=1):
try:
if row["is_deleted"]:
Expand Down

0 comments on commit 5a8b45d

Please sign in to comment.