diff --git a/parcoursup-app/package-lock.json b/parcoursup-app/package-lock.json index f2f5800..33e0456 100644 --- a/parcoursup-app/package-lock.json +++ b/parcoursup-app/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0", "dependencies": { "@riotjs/compiler": "^10.0.1", + "chart.css": "^0.1.1", "riot": "^10.1.3", "rollup-plugin-riot": "^10.0.0" }, @@ -480,6 +481,12 @@ "node": ">=4" } }, + "node_modules/chart.css": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/chart.css/-/chart.css-0.1.1.tgz", + "integrity": "sha512-/YZcm5FrkVsE8EOlVnn8Va9/GiSBPbD3fAFFbb0fJfplEsA92F52XUqQc8+uesfmGjsoxxw3JMc7bKuPsPx7Qw==", + "license": "MIT" + }, "node_modules/css-simple-parser": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/css-simple-parser/-/css-simple-parser-3.0.2.tgz", @@ -881,9 +888,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "license": "MIT", "engines": { "node": ">=12" diff --git a/parcoursup-app/package.json b/parcoursup-app/package.json index 204cd6a..ec531bf 100644 --- a/parcoursup-app/package.json +++ b/parcoursup-app/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@riotjs/compiler": "^10.0.1", + "chart.css": "^0.1.1", "riot": "^10.1.3", "rollup-plugin-riot": "^10.0.0" } diff --git a/parcoursup-app/src/api/parcoursup.js b/parcoursup-app/src/api/parcoursup.js index 812eafb..8890157 100644 --- a/parcoursup-app/src/api/parcoursup.js +++ b/parcoursup-app/src/api/parcoursup.js @@ -1,20 +1,37 @@ -const API_BASE = "https://data.education.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records"; +const API_BASE = "https://data.education.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records" export async function recupereFormations(motCle, limit = 20) { - const url = `${API_BASE}?where=search("${motCle}")&limit=${limit}`; - - const response = await fetch(url); - const data = await response.json(); - - return data.results; + const url = `${API_BASE}?where=search("${motCle}")&limit=${limit}` + const response = await fetch(url) + const data = await response.json() + return data.results } -export async function recupereFormation(id) { + + +export async function recupereFormation(id) +{ const url = `${API_BASE}?where=cod_aff_form="${id}"&limit=1` const response = await fetch(url) const data = await response.json() return data.results[0] +} + + + +export async function recupereEvolutionFormation(id) +{ + const années = ["2020", "2021", "2022", "2023", "2024", "2025"] + + const promesses = années.map(annee => + fetch(`${API_BASE}?where=cod_aff_form="${id}" AND session="${annee}"&limit=1`) + .then(r => r.json()) + .then(data => data.results[0]) + ) + + const resultats = await Promise.all(promesses) + return resultats.filter(r => r !== null && r !== undefined) } \ No newline at end of file diff --git a/parcoursup-app/src/components/page-detail.riot b/parcoursup-app/src/components/page-detail.riot index 237d186..2bab7e9 100644 --- a/parcoursup-app/src/components/page-detail.riot +++ b/parcoursup-app/src/components/page-detail.riot @@ -1,28 +1,179 @@ +
+ Chargement... +
-

{ state.formation.fil_lib_voe_acc }

+

{ state.formation.fil_lib_voe_acc }

+

{ state.formation.g_ea_lib_vx }

+

{ state.formation.ville_etab } ({ state.formation.dep_lib })

+ ← Retour à la recherche -

{ state.formation.g_ea_lib_vx }

-

{ state.formation.ville_etab } ({ state.formation.dep_lib })

+

Phase d'admission

-

Taux d'accès : { state.formation.taux_acces_ens }%

+ + -

Capacité : { state.formation.capa_fin } places

+ + + + -

Candidatures : { state.formation.voe_tot }

+ + + + -

Admis : { state.formation.acc_tot }

+ + + + + + +
Places disponibles + { state.formation.capa_fin } +
Candidatures + { state.formation.voe_tot } +
Admis + { state.formation.acc_tot } +
+ + +

Profil des admis — Type de bac

+ + + + + + + + + + + + + + + + + + + + +
Bac Général + { state.formation.pct_bg }% +
Bac Techno + { state.formation.pct_bt }% +
Bac Pro + { state.formation.pct_bp }% +
+ + +

Profil des admis — Mentions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Sans mention + { state.formation.pct_sansmention }% +
Assez Bien + { state.formation.pct_ab }% +
Bien + { state.formation.pct_b }% +
Très Bien + { state.formation.pct_tb }% +
Félicitations + { state.formation.pct_tbf }% +
+ + +

Évolution du taux d'accès depuis 2020

+ +
+ Chargement de l'évolution... +
+ + + + + + + + + + +
{ annee.session } + { annee.taux_acces_ens }% +
+ -
Chargement...
+ @@ -30,15 +181,14 @@ +
\ No newline at end of file diff --git a/parcoursup-app/src/main.js b/parcoursup-app/src/main.js index f8c6c1c..a456329 100644 --- a/parcoursup-app/src/main.js +++ b/parcoursup-app/src/main.js @@ -1,6 +1,7 @@ import { component, unmount } from 'riot' import App from './components/app.riot' import PageDetail from './components/page-detail.riot' +import 'chart.css' const app = document.getElementById('app') let currentComponent = null