generated from dataforgoodfr/d4g-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* blue for animated map * Graph 1.1 and data into french * Graph 1.2 and data in french * Graph 1.3 and data in french * Graph 1.4 and data in french * Graph 2.1 and data in french * Graph 2.3 and data in french * Changes to Graph 1.1 including option to block zoom and add caption with data source * modifications to Graph 1.2 after talking to Maxime * Graph 1.0 pour page story with transparent background and data and graph in french * Graph 1.4 fixed animation issues and remove autoplay when saving html * Changes to graph 1.3 based on maxime comments * Changes to Graph 2.1 and 2.3 after talking tot Maxime * Graph 4.4 and data into french * Small changes to zoom stuff * Remove graphs no longer needed * Update config.py for french graphs * Graph 7 alternatives with french english * Small change on Graph 7 * feat: add routes for french version * fix: linting * feat: setup migration * remove workflows * fix config * generate graphs * remove white as default * fix: generation --------- Co-authored-by: Sarah Rieubland <[email protected]>
- Loading branch information
1 parent
0cca1f9
commit 4ff7662
Showing
12 changed files
with
139 additions
and
138 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build Graphs | ||
|
||
on: | ||
workflow_dispatch: | ||
# push: | ||
# branches: | ||
# - main | ||
|
||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.12 | ||
- name: cache poetry install | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.local | ||
key: poetry-1.8.2-0 | ||
- uses: snok/install-poetry@v1 | ||
with: | ||
version: 1.8.2 | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
- name: cache deps | ||
id: cache-deps | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: pydeps-${{ hashFiles('**/poetry.lock') }} | ||
- run: poetry install --no-interaction --no-root | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
- run: poetry install --no-interaction | ||
- run: poetry run python 12_pinkbombs_app/generate.py | ||
- id: files | ||
uses: jitterbit/get-changed-files@v1 | ||
with: | ||
format: 'csv' | ||
|
||
|
||
|
||
push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 12_pinkbombs_app | ||
ref: 'main' | ||
token: ${{ secrets.D4GTECH_TOKEN }} | ||
path: './12_pinkbombs_app' | ||
- name: setup git config | ||
run: | | ||
git config user.name "Pinkbombs Bot" | ||
git config user.email "<>" | ||
- run : git add . | ||
- run: git commit -m "bot: update data" | ||
- run: git push origin main |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
,Saumon élevage sur terre,Saumon élevage en mer,Thon albacore en boite (pêché),"Poissons “proie” (sardines, maquereaux)","Coquillages (moules, huitres)",Algues,Huile de colza (bio),Simili poissons végétaux industriels | ||
Éléments toxiques,5,5,6,4,4,2,1,2 | ||
Apport en omégas 3,2,2,5,1,5,0,1,2 | ||
Biodiversité,5,6,6,4,4,4,1,2 | ||
CO2,6,5,3,4,4,4,2,1 | ||
Impacts sociaux ,6,5,6,4,3,1,1,2 | ||
Condition animale,6,5,6,3,2,0,0,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from config import MAPPING, MAPS, MAPPINGFR, MAPSFR | ||
import json | ||
|
||
def generate_graph(graph_name, mapping): | ||
if graph_name not in mapping: | ||
raise ValueError(f"Graph '{graph_name}' not found") | ||
df = mapping[graph_name]["parser"]( | ||
"data/" + mapping[graph_name]["filename"], | ||
) | ||
chart_obj = mapping[graph_name]["function"](df, *mapping[graph_name]["arguments"]) | ||
return chart_obj.to_json() | ||
|
||
|
||
def generate_map(map_name, mapping): | ||
if map_name not in mapping: | ||
raise ValueError(f"Map '{map_name}' not found") | ||
df = mapping[map_name]["parser"]( | ||
"data/" + mapping[map_name]["filename"], | ||
) | ||
html_map = mapping[map_name]["function"](df, *mapping[map_name]["arguments"]) | ||
return html_map | ||
|
||
|
||
if __name__ == "__main__": | ||
for graph_name in MAPPING: | ||
print(graph_name) | ||
graph_json = generate_graph(graph_name, MAPPING) | ||
with open(f"data/graphs/en/{graph_name}.json", "w") as f: | ||
json.dump(graph_json, f) | ||
|
||
for graph_name in MAPPINGFR: | ||
print(graph_name) | ||
graph_json = generate_graph(graph_name, MAPPINGFR) | ||
with open(f"data/graphs/fr/{graph_name}.json", "w") as f: | ||
json.dump(graph_json, f) | ||
|
||
for map_name in MAPS: | ||
print(map_name) | ||
map_json = generate_map(map_name, MAPS) | ||
with open(f"data/maps/en/{map_name}.html", "w") as f: | ||
f.write(map_json) | ||
|
||
for map_name in MAPSFR: | ||
print(map_name) | ||
map_json = generate_map(map_name, MAPSFR) | ||
with open(f"data/maps/fr/{map_name}.html", "w") as f: | ||
f.write(map_json) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from .viz import make_area_chart, make_area_single_chart, make_area_chart_options | ||
from .viz import make_area_order_chart, make_bar_chart, make_area_order_chart_grouped | ||
from .viz import make_color_bar_chart, make_color_bar_chart2 | ||
from .viz import make_animated_bubble_map, make_treemap_chart | ||
from .viz import make_simple_bar_chart, make_simple_pie_chart | ||
from .viz import make_simple_box_chart, make_matrix_alternatives | ||
from .maps_viz import make_ras_bubble_map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters