Skip to content
Snippets Groups Projects
Select Git revision
  • 8c6cbdb71ee279a44f2d414442eb087427e09654
  • master default protected
  • message_carte
  • mobilites
4 results

datacirco-web

user avatar
benoit-cty authored
8c6cbdb7
History

DataCirco : interface Web et export PDF

Prototype de version Web disponible sur https://datacirco-web-integ.leximpact.dev/circonscriptions/091-07

Installation

L'utilisation de NVM permet de gérer les versions de Node et de s'affranchir des limitations de version des distributions.

A exécuter dans le dossier du projet cd datacirco-web :

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm install node
npm install
npx playwright install-deps
npx playwright install
cp example.env .env

Developing

Start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Go to http://127.0.0.1:5173/

Using code-server

Run npm run dev -- --host 0.0.0.0 in the VSCode terminal

Go to https://5173.code-server.leximpact.dev/

Linting

Nous utilisont ESLint pour le linting, avec un plugin de tri des imports par ordre alphabétique.

For VS Code there is an option to execute eslint --fix when saving a file. For this to work you add this to your settings.json :

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  }
}

View data

Les données brutes peuvent être visualisées à l'adresse suivante : https://datacirco-web-integ.leximpact.dev/datacirco/data-json/091-07/common_data.json

Les sources sont les mémes pour toutes les circonscriptions : https://datacirco-web-integ.leximpact.dev/datacirco/data-json/sources.json

Génération d'un PDF

Pour voir la page qui sera imprimée en PDF il faut ajouter le paramètre print dans l'URL : http://localhost:5173/circonscriptions/091-07?print=true

wget -O 091-07.pdf http://localhost:5173/circo-print/091-07

export CIRCO=091-07; wget -O $CIRCO.pdf "http://localhost:5173/circo-print/$CIRCO"

L'erreur "waiting for locator('#precipitations').or(locator('#dpe')).first() to be visible" signifie que la circo n'existe probablement pas.

## Génération de tous les PDF

Il faut avoir installé :

  • ImageMagick pour créer la vignette
  • Ghostscript pour la reduction de taille du PDF
  • optipng pour la réduction de taille du PNG
  • qrcode pour la génération du QR code.
apt update && apt upgrade -y
apt -y install wget nano git curl optipng imagemagick-6.q16hdri ghostscript
pip install qrcode[pil]
generate_pdf.sh

Il faut compter 1h30.

Pour le détail de la production LexImpact, voir La doc DevOps (accès restreint).

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.