Spaces:
Runtime error
Runtime error
Commit ·
5bc74c0
1
Parent(s): 7270531
Connected funding schemes too
Browse files
backend/main.py
CHANGED
|
@@ -456,6 +456,12 @@ def get_stats(request: Request):
|
|
| 456 |
if c := params.get("country"):
|
| 457 |
lf = lf.filter(pl.col("list_country").list.contains(c))
|
| 458 |
df = df.filter(pl.col("list_country").list.contains(c))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
if mn := params.get("minFunding"):
|
| 460 |
lf = lf.filter(pl.col("ecMaxContribution") >= int(mn))
|
| 461 |
df = df.filter(pl.col("ecMaxContribution") >= int(mn))
|
|
|
|
| 456 |
if c := params.get("country"):
|
| 457 |
lf = lf.filter(pl.col("list_country").list.contains(c))
|
| 458 |
df = df.filter(pl.col("list_country").list.contains(c))
|
| 459 |
+
if eu := params.get("topic"):
|
| 460 |
+
lf = lf.filter(pl.col("list_euroSciVocTitle").list.contains(eu))
|
| 461 |
+
df = df.filter(pl.col("list_euroSciVocTitle").list.contains(eu))
|
| 462 |
+
if fs := params.get("fundingScheme"):
|
| 463 |
+
lf = lf.filter(pl.col("_fundingScheme_lc").str.contains(fs.lower()))
|
| 464 |
+
df = df.filter(pl.col("_fundingScheme_lc").str.contains(fs.lower()))
|
| 465 |
if mn := params.get("minFunding"):
|
| 466 |
lf = lf.filter(pl.col("ecMaxContribution") >= int(mn))
|
| 467 |
df = df.filter(pl.col("ecMaxContribution") >= int(mn))
|
frontend/src/components/Dashboard.tsx
CHANGED
|
@@ -64,7 +64,8 @@ const FILTER_LABELS: Record<keyof FilterState, string> = {
|
|
| 64 |
organization: "Organization",
|
| 65 |
country: "Country",
|
| 66 |
legalBasis: "Legal Basis",
|
| 67 |
-
|
|
|
|
| 68 |
};
|
| 69 |
|
| 70 |
type ChartType = "bar" | "pie" | "doughnut" | "line";
|
|
@@ -121,7 +122,7 @@ const Dashboard: React.FC<DashboardProps> = ({
|
|
| 121 |
}));
|
| 122 |
|
| 123 |
const filterKeys: Array<keyof FilterState> = [
|
| 124 |
-
'status', 'organization', 'country', 'legalBasis','topics'
|
| 125 |
];
|
| 126 |
|
| 127 |
if (loadingStats && !Object.keys(statsData).length) {
|
|
@@ -139,7 +140,8 @@ const Dashboard: React.FC<DashboardProps> = ({
|
|
| 139 |
: key === 'organization' ? 'organizations'
|
| 140 |
: key === 'country' ? 'countries'
|
| 141 |
: key === "legalBasis" ? "legalBases"
|
| 142 |
-
:
|
|
|
|
| 143 |
] || [];
|
| 144 |
const isOrg = key === 'organization';
|
| 145 |
return (
|
|
|
|
| 64 |
organization: "Organization",
|
| 65 |
country: "Country",
|
| 66 |
legalBasis: "Legal Basis",
|
| 67 |
+
topic: "EuroSciVoc",
|
| 68 |
+
fundingScheme: "Funding Scheme",
|
| 69 |
};
|
| 70 |
|
| 71 |
type ChartType = "bar" | "pie" | "doughnut" | "line";
|
|
|
|
| 122 |
}));
|
| 123 |
|
| 124 |
const filterKeys: Array<keyof FilterState> = [
|
| 125 |
+
'status', 'organization', 'country', 'legalBasis','topics','fundingScheme',
|
| 126 |
];
|
| 127 |
|
| 128 |
if (loadingStats && !Object.keys(statsData).length) {
|
|
|
|
| 140 |
: key === 'organization' ? 'organizations'
|
| 141 |
: key === 'country' ? 'countries'
|
| 142 |
: key === "legalBasis" ? "legalBases"
|
| 143 |
+
: key === "topic" ? "topics"
|
| 144 |
+
: 'fundingSchemes'
|
| 145 |
] || [];
|
| 146 |
const isOrg = key === 'organization';
|
| 147 |
return (
|
frontend/src/components/ProjectDetails.tsx
CHANGED
|
@@ -130,10 +130,8 @@ export default function ProjectDetails({
|
|
| 130 |
<Text fontWeight="bold">Acronym</Text>
|
| 131 |
<Text>{project.acronym}</Text>
|
| 132 |
</Box>
|
| 133 |
-
<Box><Text fontWeight="bold">Start Date</Text><Text>{project.startDate
|
| 134 |
-
|
| 135 |
-
<Box><Text fontWeight="bold">End Date</Text><Text>{project.endDate && project.endDate !== "NaT" && !isNaN(Date.parse(project.endDate))
|
| 136 |
-
? new Date(project.endDate).toISOString().split("T")[0]: "--"}</Text></Box>
|
| 137 |
<Box><Text fontWeight="bold">Funding (EC max)</Text><Text>€{fmtNum(project.ecMaxContribution)}</Text></Box>
|
| 138 |
<Box><Text fontWeight="bold">Total Cost</Text><Text>€{fmtNum(project.totalCost)}</Text></Box>
|
| 139 |
<Box><Text fontWeight="bold">Funding Scheme</Text><Text>{project.fundingScheme}</Text></Box>
|
|
|
|
| 130 |
<Text fontWeight="bold">Acronym</Text>
|
| 131 |
<Text>{project.acronym}</Text>
|
| 132 |
</Box>
|
| 133 |
+
<Box><Text fontWeight="bold">Start Date</Text><Text>{project.startDate}</Text></Box>
|
| 134 |
+
<Box><Text fontWeight="bold">End Date</Text><Text>{project.endDate}</Text></Box>
|
|
|
|
|
|
|
| 135 |
<Box><Text fontWeight="bold">Funding (EC max)</Text><Text>€{fmtNum(project.ecMaxContribution)}</Text></Box>
|
| 136 |
<Box><Text fontWeight="bold">Total Cost</Text><Text>€{fmtNum(project.totalCost)}</Text></Box>
|
| 137 |
<Box><Text fontWeight="bold">Funding Scheme</Text><Text>{project.fundingScheme}</Text></Box>
|
frontend/src/components/ProjectExplorer.tsx
CHANGED
|
@@ -256,7 +256,7 @@ const ProjectExplorer: React.FC<ProjectExplorerProps> = ({
|
|
| 256 |
<Td w="50%" overflow="hidden" textOverflow="ellipsis">{p.title}</Td>
|
| 257 |
<Td w="10%">{p.status}</Td>
|
| 258 |
<Td w="10%">{p.id}</Td>
|
| 259 |
-
<Td w="10%" whiteSpace="nowrap">{p.startDate
|
| 260 |
<Td w="10%">{p.fundingScheme || '-'}</Td>
|
| 261 |
<Td w="10%">€{fmtNum(p.ecMaxContribution)}</Td>
|
| 262 |
|
|
|
|
| 256 |
<Td w="50%" overflow="hidden" textOverflow="ellipsis">{p.title}</Td>
|
| 257 |
<Td w="10%">{p.status}</Td>
|
| 258 |
<Td w="10%">{p.id}</Td>
|
| 259 |
+
<Td w="10%" whiteSpace="nowrap">{p.startDate}</Td>
|
| 260 |
<Td w="10%">{p.fundingScheme || '-'}</Td>
|
| 261 |
<Td w="10%">€{fmtNum(p.ecMaxContribution)}</Td>
|
| 262 |
|
frontend/src/hooks/types.ts
CHANGED
|
@@ -52,7 +52,8 @@ export interface FilterState {
|
|
| 52 |
organization: string;
|
| 53 |
country: string;
|
| 54 |
legalBasis: string;
|
| 55 |
-
|
|
|
|
| 56 |
minYear: string;
|
| 57 |
maxYear: string;
|
| 58 |
minEndYear: string;
|
|
|
|
| 52 |
organization: string;
|
| 53 |
country: string;
|
| 54 |
legalBasis: string;
|
| 55 |
+
topic: string;
|
| 56 |
+
fundingScheme: string;
|
| 57 |
minYear: string;
|
| 58 |
maxYear: string;
|
| 59 |
minEndYear: string;
|
frontend/src/hooks/useAppState.ts
CHANGED
|
@@ -32,7 +32,8 @@ export const useAppState = () => {
|
|
| 32 |
organization: "",
|
| 33 |
country: "",
|
| 34 |
legalBasis: "",
|
| 35 |
-
|
|
|
|
| 36 |
minYear: "2000",
|
| 37 |
maxYear: "2025",
|
| 38 |
minEndYear: "2000",
|
|
|
|
| 32 |
organization: "",
|
| 33 |
country: "",
|
| 34 |
legalBasis: "",
|
| 35 |
+
topic: "",
|
| 36 |
+
fundingScheme: "",
|
| 37 |
minYear: "2000",
|
| 38 |
maxYear: "2025",
|
| 39 |
minEndYear: "2000",
|