Added funding visualization for institution cordis eu projects

This commit is contained in:
Mats Paul Tončik
2026-06-19 10:17:48 +02:00
parent 305ab7ba6a
commit 6cd32eecec
10 changed files with 282 additions and 113 deletions
+122 -61
View File
@@ -45,67 +45,6 @@ export class ProjectsService extends BaseService {
super(basePath, configuration);
}
/**
* Get funding over time for bund projects.
* Returns the funding over time for bund projects associated with the specified institution.
* @endpoint get /api/projects/institution/bund/funding-over-time
* @param institutionId The institution ID to filter by.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getBundFundingOverTime(institutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionFunderSummary>;
public getBundFundingOverTime(institutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionFunderSummary>>;
public getBundFundingOverTime(institutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionFunderSummary>>;
public getBundFundingOverTime(institutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (institutionId === null || institutionId === undefined) {
throw new Error('Required parameter institutionId was null or undefined when calling getBundFundingOverTime.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>institutionId, 'institution_id');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/projects/institution/bund/funding-over-time`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<InstitutionFunderSummary>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Get DFG projects.
* Returns a page of DFG projects based on the provided pagination parameters and optional institution filter.
@@ -182,6 +121,128 @@ export class ProjectsService extends BaseService {
);
}
/**
* Get funding over time for bund projects.
* Returns the funding over time for bund projects associated with the specified institution.
* @endpoint get /api/projects/institution/bund/funding-over-time
* @param rawOaInstitutionId The institution ID to filter by.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionFunderSummary>;
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionFunderSummary>>;
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionFunderSummary>>;
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) {
throw new Error('Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionBundProjectsFundingOverTime.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>rawOaInstitutionId, 'raw_oa_institution_id');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/projects/institution/bund/funding-over-time`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<InstitutionFunderSummary>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Get funding over time for EU projects.
* Returns the funding over time for EU projects associated with the specified institution.
* @endpoint get /api/projects/institution/eu/funding-over-time
* @param rawOaInstitutionId The institution ID to filter by.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionFunderSummary>;
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionFunderSummary>>;
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionFunderSummary>>;
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) {
throw new Error('Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionCordisEuProjectsFundingOverTime.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>rawOaInstitutionId, 'raw_oa_institution_id');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/projects/institution/eu/funding-over-time`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<InstitutionFunderSummary>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Get bund projects.
* Returns a page of bund projects based on the provided pagination parameters and optional institution filter.
@@ -7,13 +7,14 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ProjectType } from './projectType';
export interface InstitutionFunderSummary {
/**
* The type of funding data (e.g., \'bund\', \'eu\', \'dfg\').
*/
type: InstitutionFunderSummary.TypeEnum;
type: ProjectType;
/**
* A dictionary mapping years to total funding amounts for that year.
*/
@@ -24,12 +25,6 @@ export interface InstitutionFunderSummary {
annual_average_over_period?: number;
}
export namespace InstitutionFunderSummary {
export const TypeEnum = {
Bund: 'bund',
Eu: 'eu',
Dfg: 'dfg'
} as const;
export type TypeEnum = typeof TypeEnum[keyof typeof TypeEnum];
}
+3 -1
View File
@@ -10,6 +10,7 @@ import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver';
import { institutionsResolver } from './resolvers/institutions.resolver';
import { bundProjectsFundingResolver } from './resolvers/bund-projects-funding.resolver';
import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page.resolver';
import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver';
export const routes: Routes = [
{
@@ -230,8 +231,9 @@ export const routes: Routes = [
},
resolve: {
bundProjectPage: bundProjectPageResolver,
cordisEuProjectPage: cordisEuProjectPageResolver,
bundProjectsFunding: bundProjectsFundingResolver,
cordisEuProjectPage: cordisEuProjectPageResolver,
cordisEuProjectsFunding: cordisEuProjectsFundingResolver,
},
runGuardsAndResolvers: (from, to) => {
const keys = ['page', 'size', 'sort_by', 'sort_direction', 'search'];
@@ -51,7 +51,7 @@
</mat-card-header>
<mat-card-content>
<app-institution-projects-funding-graph
[fundings]="[bundProjectsFunding()]" />
[fundings]="[bundProjectsFunding(), cordisEuProjectsFunding()]" />
</mat-card-content>
</mat-card>
@@ -71,7 +71,7 @@
<app-person-network-info-card
[description]="'Gesamte Förderung durch die Europäische Union'"
[value]="
(123456789 | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ??
(euTotalFunding() | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ??
undefined
" />
<app-person-network-info-card
@@ -79,7 +79,8 @@
'Durchschnittliche jährliche Förderung durch die Europäische Union'
"
[value]="
(12345 | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
(euAverageAnnualFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
</div>
</div>
@@ -85,19 +85,29 @@ export class InstitutionProjectsComponent implements OnInit {
bundProjectData: BundProjectRow[] = [];
bundProjectsFunding = input.required<InstitutionFunderSummary>();
bundTotalFunding = computed(() => {
const funding = this.bundProjectsFunding();
return Object.values(
funding.funding_per_year as Record<string, number>,
).reduce((sum, yearFunding) => sum + yearFunding, 0);
});
bundAverageAnnualFunding = computed(() => {
const funding = this.bundProjectsFunding();
return funding.annual_average_over_period ?? 0;
});
cordisEuProjectsFunding = input.required<InstitutionFunderSummary>();
euTotalFunding = computed(() => {
const funding = this.cordisEuProjectsFunding();
return Object.values(
funding.funding_per_year as Record<string, number>,
).reduce((sum, yearFunding) => sum + yearFunding, 0);
});
euAverageAnnualFunding = computed(() => {
const funding = this.cordisEuProjectsFunding();
return funding.annual_average_over_period ?? 0;
});
urlSortKey = signal<string>('');
urlSortDirection = signal<SortDirection>('');
urlSearchTerm = signal<string>('');
@@ -239,7 +249,7 @@ export class InstitutionProjectsComponent implements OnInit {
type: 'accessor',
accessorKey: 'funding_amount',
cellTemplate: this.fundingAmountTmp(),
}
},
];
}
@@ -5,9 +5,11 @@ import { inject } from '@angular/core';
export const bundProjectsFundingResolver: ResolveFn<
InstitutionFunderSummary
> = (route, state) => {
let institutionId = route.paramMap.get('institutionId');
let institutionId = route.parent?.paramMap.get('institutionId') ?? null;
if (!institutionId) {
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
}
return inject(ProjectsService).getBundFundingOverTime(institutionId || '');
return inject(ProjectsService).getInstitutionBundProjectsFundingOverTime(
institutionId!,
);
};
@@ -0,0 +1,17 @@
import { ResolveFn } from '@angular/router';
import { InstitutionFunderSummary, ProjectsService } from '../api';
import { inject } from '@angular/core';
export const cordisEuProjectsFundingResolver: ResolveFn<
InstitutionFunderSummary
> = (route, state) => {
let institutionId = route.parent?.paramMap.get('institutionId') ?? null;
if (!institutionId) {
throw new Error(
'Institution ID is required to resolve Cordis EU projects funding',
);
}
return inject(ProjectsService).getInstitutionCordisEuProjectsFundingOverTime(
institutionId,
);
};