Coder Social home page Coder Social logo

portic-storymaps-2022's Introduction

Portic storymaps 2022 : "Commerce, contrebande et ports francs : le cas de Dunkerque au XVIIIe siècle"

Screenshot of the website

This repository hosts the source code of PORTIC research program's second case study (see PORTIC homepage for more information). Built by an interdisciplinary team of historians, engineers and designers, it proposes a detailed study of the economic history of the free port of Dunkerque circa 1789.

Through a series of three "storymaps" combining text and visualization, this publication tells the story of the Dunkerque port trade at the dawn of french revolution. It also features an atlas allowing to browse and share individually all the visualizations crafted during this research.

This project rests on the shoulders of two existing digital history projects : Toflit18 and Navigo.

Installation

Prerequisites:

Then in a shell terminal, copy the following commands and hit enter:

yarn
sh install.sh
yarn run thumbnails

Development

Use following command.

yarn dev

Maintenance

In order to collect freshest contents and data source, update the data with the following command :

sh retrieve_data.sh

You can update the thumbnails with the following command :

yarn thumbnails

Warning: thumbnails building can be capricious on some machines. Backup existing screenshots from public/thumbnails before re-running this script.

Contributing

The project is open to contribution through pull requests.

Suggested guidelines for commiting to the repository

  • the main branch is the principal branch for the website version under development. Suggested workflow for contributing to the code is : for project members, to develop new features in a separated branch, then to merge it in main branch when it is ready ; for external person, to clone it then to submit a pull request with your modifications.
  • it is suggested to use imperative tense verbs and explicit features/bugs mentions in commit messages (see this guide for optimal commit messages)
  • it is suggested to reference related issue in commit messages in order to keep track of commits related to an issue in particular.

Guidelines concerning code development and modification

  • reusable components should go into src/components folder. Each component should have its own folder with an index.js file, plus as many files as you want (js subcomponent files, scss files, component-specific assets, ...)
  • components aimed at being directly used for specific visualizations should go in the src/visualizations folder. They should use reusable components from src/components as much as possible.
  • style is managed through scss files. It is suggested to use existing variables in src/variables.scss as much as possible, and to add a .scss file specific to each new component with its non-reusable styling rules (if any).

How to translate the app

How to translate the app

How to update the data

How to update the data

App architecture

Front-end : webpack & react architecture

The application is bundled with Webpack. The root file is /index.js. It is in this file that must be imported all the JavaScript scripts that compose the application.

The React library (v.17+) is configured in the project, as well as other bundling tools. You can integrate React scripts, .scss styles, .yml files from the root /index.js file.

The React router (v6+) development tool allows you to redirect the user to activate certain display scripts based on the page address and the parameters entered. The page address is used as a source of truth, for the active language and the texts, visualizations to be displayed.

Data retrieval and computation

The data is downloaded and processed with Python and NodeJs scripts in the /datascript/ directory.

The shell script /retrieve_data.sh does three things. First it will download the data files from the two databases Toflit18 and Navigo. Then it will activate the script /datascript/_fetch_content.py which allows to find texts and data stored on the Google Drive of SciencesPo, on the Zotero library. Finally, it activates a series of Python and NodeJS scripts to process all the downloaded data.

This data allows to generate the text content of the application, as well as the visualizations. It is useful for both the development and the production of the application.

data type source target integration on app downloading
navigo database data.portic.fr/api/ /data/*.csv /retrieve_data.sh
toflit database GitHub /data/*.csv /retrieve_data.sh
spreadsheets Google Drive (GSheet) /public/data/**/*.csv HTTP GET /datascript/_fetch_content.py
index of visualisations Google Drive /src/data/viz.json ES6 import /datascript/_fetch_content.py
bibliography Zotero /src/data/bib.json /datascript/_fetch_content.py
texts Google Drive (GDoc) /src/content/**/*.mdx /src/summary.js /datascript/_fetch_content.py

Data local storage and visualizations management

The visualizations index /src/data/viz.json contains the names of the .csv data files which are loaded in the front-end for each visualization.

The /src/visualizations/index.js file is the entrypoint for all the visualizations code and components. It also automatically passes each visualization component the data it needs as prescribed in /src/data/viz.json. For this, the columns 'id' and 'n_chapter' must match the caller id of the visualization. Here is an example of how a call to the "history-dunkerque" in chapter 1 looks like:

Part 1
---

Lorem ipsum dolor est.

<Caller id=”histoire-dunkerque” />

Deployment

Deployment is automated to happen every day and each time a commit is pushed to the prod branch. The published website is then pushed on the gh-pages branch, which serves the site at https://medialab.github.io/portic-storymaps-2022/.

portic-storymaps-2022's People

Contributors

myllaume avatar robindemourat avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

portic-storymaps-2022's Issues

conges-dunkerque

Hint : issue name = visualization id

https://docs.google.com/document/d/1YtuKf4hgk9UJiekNcVa_vK2MGYYgvopOVTuZeHfyopU/edit?disco=AAAAZzb05XY

possible idée de visu: reprendre éventuellement partie de la courbe courbe 1765-1791 par comptes rendus avec uniquement les congés pour les ïles (ces congés sont pratiquement tous de navires de Dkq): https://docs.google.com/spreadsheets/d/1oy0IZWiqaWiZFuEAJAj5BF_m4BwV_UQ6/edit#gid=2048052074

Data

https://docs.google.com/spreadsheets/d/1oy0IZWiqaWiZFuEAJAj5BF_m4BwV_UQ6/edit#gid=2048052074

Model/draft

Interactions

MVP du site PORTIC

  • mise à jour du menu afin qu'il soit géré automatiquement en fonction de summary.js

  • renommer functions.py (utils.py?)

  • lancement auto des scripts python

  • système de récupération des données pour les visualisations (au niveau de app ou de scrollypage)

  • intégrer viz smogglage

  • brancher sur les vrais fichiers ("Rédaction" et "index des visualisations") - ne pas hésiter à mettre des callers de test dans rédaction !

  • workflow de publication automatique vers github pages (s'inspirer de https://github.com/medialab/portic-storymaps-2021/blob/main/.github/workflows/main.yml)

[Reproductibility] csl file handling for `_fetch_content.py`

Right now to reproduce the repo and launch the datascripts/_fetch_content.py script it is necessary to copy a csl file in user's python lib data.

This should be either removed by finding a detour, or added it to the README.md installation instructions.

stigmates-smoggleurs-dunkerque

Hint : issue name = visualization id

Data

  • source : navigo raw_flows 1789 & 1787
  • departure_function = 'O'
  • departure = 'Dunkerque'
  • flag = 'british'

Model/draft

stigmates-smoggleurs-dunkerque

Interactions

  • highlight au hover
  • switch between 1787 and 1789
  • switch with animations

resume-activite-dunkerquois

Data

Use navigo raw flows 1787 with filters:

  • departure_function = 'O'
  • homeport = 'Dunkerque'

Model/draft

resume-activite-dunkerquois-1787

Interactions

/

tonnages-1787-f12

Hint : issue name = visualization id

Data

See notebook/doc

Model/draft

Interactions

tonnages-1787-f12

CSS bugs/papercuts

  • mobile : can't access the arrow to switch between text and visualization when scrolling

Capture d’écran 2022-11-08 à 06 20 59

Homepage design + `intro` viz

Animation:

  • boats: day/night cycle (depending of time of access)
  • boats: add flags
  • boats: add corsairs and smogglers

Intro viz intro:

  • state 1 §0: Dunkerque in France
  • state 2 §3: france vs port franc
  • state 3 §3: 2 sources

departs-fr-vers-angleterre

Data

Navigo raw_flows 1789 with filters:

  • departure_function == 'O'

Computation :

We want to aggregate by port and a two-modality category in ['departs vers GB', 'autres départs']

'departs vers GB' corresponds to row['destination_state_1789_fr'] == 'Grande-Bretagne' and 'colonies britanniques' not in row['destination_substate_1789_fr']

see following code https://github.com/medialab/portic-datasprint-2022/blob/main/productions/modules_00/reperage_smoggleurs

Output csv:

  • 1 line = one french port + one category in ['departs vers GB', 'autres départs']

Columns:

  • port name : ...
  • port lat, port lon : ...
  • type : in ['departs vers GB', 'autres départs']
  • number_of_travels: number of departures to GB for british vessels
  • cumulated_tonnage: ...

Model/draft

departs-fr-vers-angleterre

Interactions

  • switch between cumulated tonnage and number of travels ?

Linechart improvements

  • handle negative values
  • handle vertical layout
  • API : add an option to format axis ticks with pretty numbers (use misc/formatNumber)

imports-dunkerque-vs-ports-francs

Data

[WIP] imports regroupés par produits pour Dunkerque et pour les autres ports francs, modulés selon différentes provenances.

See module 4 tops 20:

Model/draft

imports-dunkerque-vs-ports-francs

Interactions

  • left: change provenances (filer)
  • right: compare with all ports francs or a specific port franc
  • "rappoter au total des imports" -> dimensions are not in value anymore but in % of the total sum of imports

LinearAlluvial component improvements

  • provide palette in props
  • display rectangle for each step
  • (interactivity) highlight when clicking a link
  • (interactivity) highlight when clicking a node
  • animate component with react-spring

Pages robustness

  • display text even if datasets fetching fails
  • (optional) place a componentDidCatch at some point in the components tree to avoid white screen

homeports-from-dunkerque

Data

  • Navigo 1789 pointcalls
  • aggregation: homeport then homeport_state, with differenciation between dunkerque and rest of France
  • sizing: cumulated tonnage

Model/draft

homeports-from-dunkerque

Interactions

/

Screenshotting error in automated workflow

Running the github action Build and deploy generates the following error:

webpack 5.72.1 compiled successfully in 5107 ms
screenshot for  smoggleur-statut
screenshot for  peche-type-value
/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:528
            const timeoutError = new Errors_js_1.TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
                                 ^

TimeoutError: waiting for selector `.viz-render` failed: timeout 30000ms exceeded
    at new WaitTask (/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:528:34)
    at DOMWorld.waitForSelectorInPage (/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:432:26)
    at Object.internalHandler.waitFor (/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:31:77)
    at DOMWorld.waitForSelector (/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:323:29)
    at Frame.waitForSelector (/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:942:51)
    at Page.waitForSelector (/home/runner/work/portic-storymaps-2022/portic-storymaps-2022/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2370:33)
    at /home/runner/work/portic-storymaps-2022/portic-storymaps-2022/makeThumbnails.js:56:24
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

histoire-dunkerque - Viz 1.1 (timeline + map)

  • affichage de la carte avec overlays en svg qui reste toujours ferrée en haut et pleine largeur du cadre, avec ratio fixe (gestion avec la viewbox)

  • création du fond de frise avec d3 + rendu en svg via react: utiliser d3-scale (scaleLinear ou scaleBand)

  • mapping des éléments de la frise à partir du csv + du figma de Maxime

  • gestion de la date -> afficher les overlays en fonction de leur date de début/fin / prendre en compte la vue atlas = frise cliquable qui met l'année en cours sur l'année cliquée

Graphic design finetunings

  • update animation
  • update colors: slight variation with la rochelle
  • stylize tooltips
  • zoomable viz (e.g. series) : stylize "return to main viz"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.