diff --git a/client/src/pages/european-projects/charts-config.json b/client/src/pages/european-projects/charts-config.json
index efc931ba..797f6821 100644
--- a/client/src/pages/european-projects/charts-config.json
+++ b/client/src/pages/european-projects/charts-config.json
@@ -51,6 +51,24 @@
"sourceURL": "https://cordis.europa.eu/",
"integrationURL": "/european-projects/components/pages/analysis/overview/charts/projects-types-1"
},
+ {
+ "id": "projectsTypesPiliers2",
+ "title": "",
+ "subtitle": "Subventions demandées et obtenues (M€)",
+ "description": "",
+ "source": "Commission européenne, Cordis",
+ "sourceURL": "https://cordis.europa.eu/",
+ "integrationURL": "/european-projects/components/pages/analysis/overview/charts/projects-types-1"
+ },
+ {
+ "id": "projectsTypesPiliers2Rates",
+ "title": "",
+ "subtitle": "Part des subventions demandées et obtenues sur HE",
+ "description": "",
+ "source": "Commission européenne, Cordis",
+ "sourceURL": "https://cordis.europa.eu/",
+ "integrationURL": "/european-projects/components/pages/analysis/overview/charts/projects-types-1"
+ },
{
"id": "projectsTypesPiliers1Rates",
"title": "",
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-1/options-subventions_values.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-1/options-subventions_values.tsx
index 3c4b0e1c..83279cde 100644
--- a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-1/options-subventions_values.tsx
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-1/options-subventions_values.tsx
@@ -1,5 +1,6 @@
export default function Options(data) {
if (!data) return null;
+ console.log(data);
const filteredData = data.country.filter(
(el) => el.total_evaluated && el.total_successful
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/index.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/index.tsx
index 15a6c175..32cd3754 100644
--- a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/index.tsx
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/index.tsx
@@ -10,7 +10,7 @@ import ChartWrapper from "../../../../../chart-wrapper";
import { getDefaultParams } from "./utils";
import { Container, Row, Col } from "@dataesr/dsfr-plus";
-export default function ProjectsTypes1() {
+export default function ProjectsTypesPiliers1() {
const [searchParams] = useSearchParams();
const params = getDefaultParams(searchParams);
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/query.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/query.tsx
index 07551116..1871c766 100644
--- a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/query.tsx
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-1/query.tsx
@@ -1,9 +1,9 @@
const { VITE_APP_SERVER_URL } = import.meta.env;
export async function GetData(params: string) {
- let url = `${VITE_APP_SERVER_URL}/european-projects/analysis-synthese-projects-types-piliers-1`;
+ let url = `${VITE_APP_SERVER_URL}/european-projects/general-objectives-and-projects-types-piliers-subventions-1`;
if (params !== "") {
- url = `${VITE_APP_SERVER_URL}/european-projects/analysis-synthese-projects-types-piliers-1?${params}`;
+ url = `${VITE_APP_SERVER_URL}/european-projects/general-objectives-and-projects-types-piliers-subventions-1?${params}`;
}
return fetch(url).then((response) => response.json());
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/index.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/index.tsx
new file mode 100644
index 00000000..cf6ab9c7
--- /dev/null
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/index.tsx
@@ -0,0 +1,128 @@
+import { useQuery } from "@tanstack/react-query";
+import { useSearchParams } from "react-router-dom";
+
+import Template from "./template";
+import { GetData } from "./query";
+import optionsSubventionsValuesEvaluated from "./options-subventions_values_evaluated";
+import optionsSubventionsValuesEvaluatedRates from "./options-subventions_values_evaluated_rates";
+
+import ChartWrapper from "../../../../../chart-wrapper";
+import { getDefaultParams } from "./utils";
+import { Container, Row, Col, Title } from "@dataesr/dsfr-plus";
+
+export default function ProjectsTypesPiliers2() {
+ const [searchParams] = useSearchParams();
+ const params = getDefaultParams(searchParams);
+
+ const { data, isLoading } = useQuery({
+ queryKey: ["projectsTypesPiliers2", params],
+ queryFn: () => GetData(params),
+ });
+
+ if (isLoading || !data) return ;
+
+ return (
+
+
+
+
+ Projets évalués
+
+
+
+
+
+
+
+
+ Europe plus innovante
+
+
+
+ Excellence scientifique
+
+
+
+
+ Problématiques mondiales et compétitivité industrielle
+ européenne
+
+
+
+
+
+ Élargir la participation et renforcer l'espace européen de
+ la recherche
+
+
+
+ }
+ />
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/options-subventions_values_evaluated.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/options-subventions_values_evaluated.tsx
new file mode 100644
index 00000000..fa5b9566
--- /dev/null
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/options-subventions_values_evaluated.tsx
@@ -0,0 +1,84 @@
+export default function Options(data) {
+ if (!data) return null;
+
+ const filteredData = data.filter((item) => item.country !== "all")[0].data;
+
+ const years = new Set();
+ filteredData.forEach((item) => years.add(item.year));
+
+ return {
+ chart: {
+ type: "line",
+ height: 500,
+ backgroundColor: "transparent",
+ },
+ title: { text: "" },
+ legend: { enabled: false },
+ credits: { enabled: false },
+
+ xAxis: {
+ categories: Array.from(years),
+ crosshair: true,
+ accessibility: {
+ description: "Years",
+ },
+ },
+ yAxis: {
+ min: 0,
+ title: {
+ text: "(M€)",
+ },
+ },
+ tooltip: {
+ valueSuffix: " (M€)",
+ },
+ plotOptions: {
+ line: {
+ dataLabels: {
+ enabled: true,
+ formatter: function (this: Highcharts.TooltipFormatterContextObject) {
+ return (this.y as number).toFixed(1);
+ },
+ },
+ },
+ },
+ series: [
+ {
+ name: "Europe plus innovante",
+ data: filteredData
+ .filter((item) => item.pilier_name_fr === "Europe plus innovante")
+ .map((item) => item.total_evaluated / 1000000),
+ color: "#A558A0",
+ },
+ {
+ name: "Excellence scientifique",
+ data: filteredData
+ .filter((item) => item.pilier_name_fr === "Excellence scientifique")
+ .map((item) => item.total_evaluated / 1000000),
+ color: "#21AB8E",
+ },
+ {
+ name: "Problématiques mondiales et compétitivité industrielle européenne",
+ data: filteredData
+ .filter(
+ (item) =>
+ item.pilier_name_fr ===
+ "Problématiques mondiales et compétitivité industrielle européenne"
+ )
+ .map((item) => item.total_evaluated / 1000000),
+ color: "#223F3A",
+ },
+ {
+ name: "Élargir la participation et renforcer l'espace européen de la recherche",
+ data: filteredData
+ .filter(
+ (item) =>
+ item.pilier_name_fr ===
+ "Élargir la participation et renforcer l'espace européen de la recherche"
+ )
+ .map((item) => item.total_evaluated / 1000000),
+ color: "#E4794A",
+ },
+ ],
+ };
+}
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/options-subventions_values_evaluated_rates.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/options-subventions_values_evaluated_rates.tsx
new file mode 100644
index 00000000..3c710c41
--- /dev/null
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/options-subventions_values_evaluated_rates.tsx
@@ -0,0 +1,121 @@
+export default function Options(data) {
+ if (!data) return null;
+
+ const filteredDataCountry = data.filter((item) => item.country !== "all")[0]
+ .data;
+ const filteredDataAll = data.filter((item) => item.country === "all")[0].data;
+
+ const years = new Set();
+ filteredDataCountry.forEach((item) => years.add(item.year));
+
+ return {
+ chart: {
+ type: "line",
+ height: 500,
+ backgroundColor: "transparent",
+ },
+ title: { text: "" },
+ legend: { enabled: false },
+ credits: { enabled: false },
+
+ xAxis: {
+ categories: Array.from(years),
+ crosshair: true,
+ accessibility: {
+ description: "Years",
+ },
+ },
+ yAxis: {
+ min: 0,
+ title: {
+ text: "(%)",
+ },
+ },
+ tooltip: {
+ valueSuffix: " (M€)",
+ },
+ plotOptions: {
+ line: {
+ dataLabels: {
+ enabled: true,
+ formatter: function (this: Highcharts.TooltipFormatterContextObject) {
+ return (this.y as number).toFixed(1) + " %";
+ },
+ },
+ },
+ },
+ series: [
+ {
+ name: "Europe plus innovante",
+ data: filteredDataCountry
+ .filter((item) => item.pilier_name_fr === "Europe plus innovante")
+ .map(
+ (item) =>
+ Math.round(
+ ((item.total_evaluated * 100) /
+ filteredDataAll.find(
+ (itemAll) =>
+ itemAll.year === item.year &&
+ itemAll.pilier_name_fr === item.pilier_name_fr
+ ).total_evaluated) *
+ 10
+ ) / 10
+ ),
+ color: "#A558A0",
+ },
+ {
+ name: "Excellence scientifique",
+ data: filteredDataCountry
+ .filter((item) => item.pilier_name_fr === "Excellence scientifique")
+ .map(
+ (item) =>
+ (item.total_evaluated * 100) /
+ filteredDataAll.find(
+ (itemAll) =>
+ itemAll.year === item.year &&
+ itemAll.pilier_name_fr === item.pilier_name_fr
+ ).total_evaluated
+ ),
+ color: "#21AB8E",
+ },
+ {
+ name: "Problématiques mondiales et compétitivité industrielle européenne",
+ data: filteredDataCountry
+ .filter(
+ (item) =>
+ item.pilier_name_fr ===
+ "Problématiques mondiales et compétitivité industrielle européenne"
+ )
+ .map(
+ (item) =>
+ (item.total_evaluated * 100) /
+ filteredDataAll.find(
+ (itemAll) =>
+ itemAll.year === item.year &&
+ itemAll.pilier_name_fr === item.pilier_name_fr
+ ).total_evaluated
+ ),
+ color: "#223F3A",
+ },
+ {
+ name: "Élargir la participation et renforcer l'espace européen de la recherche",
+ data: filteredDataCountry
+ .filter(
+ (item) =>
+ item.pilier_name_fr ===
+ "Élargir la participation et renforcer l'espace européen de la recherche"
+ )
+ .map(
+ (item) =>
+ (item.total_evaluated * 100) /
+ filteredDataAll.find(
+ (itemAll) =>
+ itemAll.year === item.year &&
+ itemAll.pilier_name_fr === item.pilier_name_fr
+ ).total_evaluated
+ ),
+ color: "#E4794A",
+ },
+ ],
+ };
+}
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/query.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/query.tsx
new file mode 100644
index 00000000..8b8ed2ac
--- /dev/null
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/query.tsx
@@ -0,0 +1,10 @@
+const { VITE_APP_SERVER_URL } = import.meta.env;
+
+export async function GetData(params: string) {
+ let url = `${VITE_APP_SERVER_URL}/european-projects/general-objectives-and-projects-types-piliers-subventions-2`;
+ if (params !== "") {
+ url = `${VITE_APP_SERVER_URL}/european-projects/general-objectives-and-projects-types-piliers-subventions-2?${params}`;
+ }
+
+ return fetch(url).then((response) => response.json());
+}
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/template.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/template.tsx
new file mode 100644
index 00000000..035d7d52
--- /dev/null
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/template.tsx
@@ -0,0 +1,7 @@
+export default function Template() {
+ return (
+ <>
+ graph template
+ >
+ );
+}
\ No newline at end of file
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/utils.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/utils.tsx
new file mode 100644
index 00000000..32137f2f
--- /dev/null
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/charts/projects-types-piliers-2/utils.tsx
@@ -0,0 +1,5 @@
+export function getDefaultParams(searchParams) {
+ const params = [...searchParams].map(([key, value]) => `${key}=${value}`).join('&');
+
+ return params + '&stage=successful';
+}
\ No newline at end of file
diff --git a/client/src/pages/european-projects/components/pages/general/projects-types/index.tsx b/client/src/pages/european-projects/components/pages/general/projects-types/index.tsx
index eca57108..926254a5 100644
--- a/client/src/pages/european-projects/components/pages/general/projects-types/index.tsx
+++ b/client/src/pages/european-projects/components/pages/general/projects-types/index.tsx
@@ -5,6 +5,7 @@ import { useEffect } from "react";
import ProjectsTypesPiliers1 from "./charts/projects-types-piliers-1";
import ProjectsTypes1 from "./charts/projects-types-1";
import ProjectsTypes2 from "./charts/projects-types-2";
+import ProjectsTypesPiliers2 from "./charts/projects-types-piliers-2";
export default function ProjectsTypes() {
const [searchParams, setSearchParams] = useSearchParams();
@@ -21,6 +22,8 @@ export default function ProjectsTypes() {
Par pilier
+
+
{/*
*/}
diff --git a/server/src/routes/tableaux/european-projects/index.js b/server/src/routes/tableaux/european-projects/index.js
index 44910270..03856c28 100644
--- a/server/src/routes/tableaux/european-projects/index.js
+++ b/server/src/routes/tableaux/european-projects/index.js
@@ -1,91 +1,10 @@
import express from "express";
import { db } from "../../../services/mongo";
-import evol_all_pc_coordination_EVAL from "./data/evol_all_pc_coordination_EVAL.json" assert { type: "json" };
-import evol_all_pc_coordination_SIGNED from "./data/evol_all_pc_coordination_SIGNED.json" assert { type: "json" };
-import evol_all_pc_funding_EVAL from "./data/evol_all_pc_funding_EVAL.json" assert { type: "json" };
-import evol_all_pc_funding_SIGNED from "./data/evol_all_pc_funding_SIGNED.json" assert { type: "json" };
-import evol_all_pc_participant_EVAL from "./data/evol_all_pc_participant_EVAL.json" assert { type: "json" };
-import evol_all_pc_participant_SIGNED from "./data/evol_all_pc_participant_SIGNED.json" assert { type: "json" };
-
-import evol_all_pc_project_EVAL from "./data/evol_all_pc_project_EVAL.json" assert { type: "json" };
-import evol_all_pc_project_SIGNED from "./data/evol_all_pc_project_SIGNED.json" assert { type: "json" };
-import funding_participant_share_actions from "./data/funding_participant_share_actions.json" assert { type: "json" };
import funding_programme from "./data/funding_programme.json" assert { type: "json" };
const router = new express.Router();
-router.route("/european-projects").get((req, res) => {
- const allData = {};
-
- if (req.query.countryCode) {
- // filtre de toutes les data sur le pays
- allData["evol_all_pc_coordination_EVAL"] =
- evol_all_pc_coordination_EVAL.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_coordination_SIGNED"] =
- evol_all_pc_coordination_SIGNED.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_funding_EVAL"] = evol_all_pc_funding_EVAL.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_funding_SIGNED"] =
- evol_all_pc_funding_SIGNED.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_participant_EVAL"] =
- evol_all_pc_participant_EVAL.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_participant_SIGNED"] =
- evol_all_pc_participant_SIGNED.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_project_EVAL"] = evol_all_pc_project_EVAL.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["evol_all_pc_project_SIGNED"] =
- evol_all_pc_project_SIGNED.data.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["funding_participant_share_actions"] =
- funding_participant_share_actions.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- allData["funding_programme"] = funding_programme.filter(
- (el) =>
- el.country_code.toLowerCase() === req.query.countryCode.toLowerCase()
- );
- } else {
- allData["evol_all_pc_coordination_EVAL"] =
- evol_all_pc_coordination_EVAL.data;
- allData["evol_all_pc_coordination_SIGNED"] =
- evol_all_pc_coordination_SIGNED.data;
- allData["evol_all_pc_funding_EVAL"] = evol_all_pc_funding_EVAL.data;
- allData["evol_all_pc_funding_SIGNED"] = evol_all_pc_funding_SIGNED.data;
- allData["evol_all_pc_participant_EVAL"] = evol_all_pc_participant_EVAL.data;
- allData["evol_all_pc_participant_SIGNED"] =
- evol_all_pc_participant_SIGNED.data;
- allData["evol_all_pc_project_EVAL"] = evol_all_pc_project_EVAL.data;
- allData["evol_all_pc_project_SIGNED"] = evol_all_pc_project_SIGNED.data;
- allData["funding_participant_share_actions"] =
- funding_participant_share_actions;
- allData["funding_programme"] = funding_programme;
- }
- res.json(allData);
-});
-
router.route("/european-projects/funding_programme").get((req, res) => {
const iso2 = req.query.country_code || "FR";
res.json(
@@ -625,7 +544,9 @@ router
});
router
- .route("/european-projects/analysis-synthese-projects-types-piliers-1")
+ .route(
+ "/european-projects/general-objectives-and-projects-types-piliers-subventions-1"
+ )
.get(async (req, res) => {
if (!req.query.country_code) {
res.status(400).send("country_code is required");
@@ -634,6 +555,7 @@ router
if (req.query.country_code) {
req.query.country_code = req.query.country_code.toUpperCase();
}
+
const data_country = await db
.collection("fr-esr-all-projects-synthese")
.aggregate([
@@ -695,7 +617,6 @@ router
const data_all = await db
.collection("fr-esr-all-projects-synthese")
.aggregate([
- // { $match: { country_code: req.query.country_code } },
{
$group: {
_id: {
@@ -768,6 +689,142 @@ router
return res.json({ country, all });
});
+router
+ .route(
+ "/european-projects/general-objectives-and-projects-types-piliers-subventions-2"
+ )
+ .get(async (req, res) => {
+ if (!req.query.country_code) {
+ res.status(400).send("country_code is required");
+ return;
+ }
+ if (req.query.country_code) {
+ req.query.country_code = req.query.country_code.toUpperCase();
+ }
+ const data_country = await db
+ .collection("fr-esr-all-projects-synthese")
+ .aggregate([
+ { $match: { country_code: req.query.country_code } },
+ {
+ $group: {
+ _id: {
+ stage: "$stage",
+ pilier_name_fr: "$pilier_name_fr",
+ call_year: "$call_year",
+ },
+ total_fund_eur: { $sum: "$fund_eur" },
+ },
+ },
+ {
+ $project: {
+ _id: 0,
+ stage: "$_id.stage",
+ total_fund_eur: 1,
+ pilier_name_fr: "$_id.pilier_name_fr",
+ call_year: "$_id.call_year",
+ },
+ },
+ {
+ $group: {
+ _id: {
+ name: "$pilier_name_fr",
+ year: "$call_year",
+ },
+ total_successful: {
+ $sum: {
+ $cond: [
+ { $eq: ["$stage", "successful"] },
+ "$total_fund_eur",
+ 0,
+ ],
+ },
+ },
+ total_evaluated: {
+ $sum: {
+ $cond: [{ $eq: ["$stage", "evaluated"] }, "$total_fund_eur", 0],
+ },
+ },
+ },
+ },
+ {
+ $project: {
+ _id: 0,
+ pilier_name_fr: "$_id.name",
+ year: "$_id.year",
+ total_successful: 1,
+ total_evaluated: 1,
+ },
+ },
+ { $sort: { pilier_name_fr: 1 } },
+ ])
+ .toArray();
+
+ const data_all = await db
+ .collection("fr-esr-all-projects-synthese")
+ .aggregate([
+ {
+ $group: {
+ _id: {
+ stage: "$stage",
+ pilier_name_fr: "$pilier_name_fr",
+ call_year: "$call_year",
+ },
+ total_fund_eur: { $sum: "$fund_eur" },
+ },
+ },
+ {
+ $project: {
+ _id: 0,
+ stage: "$_id.stage",
+ total_fund_eur: 1,
+ pilier_name_fr: "$_id.pilier_name_fr",
+ call_year: "$_id.call_year",
+ },
+ },
+ {
+ $group: {
+ _id: {
+ name: "$pilier_name_fr",
+ year: "$call_year",
+ },
+ total_successful: {
+ $sum: {
+ $cond: [
+ { $eq: ["$stage", "successful"] },
+ "$total_fund_eur",
+ 0,
+ ],
+ },
+ },
+ total_evaluated: {
+ $sum: {
+ $cond: [{ $eq: ["$stage", "evaluated"] }, "$total_fund_eur", 0],
+ },
+ },
+ },
+ },
+ {
+ $project: {
+ _id: 0,
+ pilier_name_fr: "$_id.name",
+ year: "$_id.year",
+ total_successful: 1,
+ total_evaluated: 1,
+ },
+ },
+ { $sort: { pilier_name_fr: 1 } },
+ ])
+ .toArray();
+
+ return res.json([
+ {
+ country: req.query.country_code,
+ data: data_country,
+ },
+ { country: "all", data: data_all },
+ ]);
+ });
+
router
.route("/european-projects/analysis-synthese-main-beneficiaries")
.get(async (req, res) => {
@@ -1098,4 +1155,5 @@ router
router.route("/european-projects/template").get(async (req, res) => {
return res.json([]);
});
+
export default router;