updated project funding resolvers to apply filters
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev Build queued...

This commit is contained in:
2026-08-01 01:58:19 +02:00
parent 211f7b82dc
commit 3f1ea0a418
4 changed files with 275 additions and 19 deletions
+173 -17
View File
@@ -317,23 +317,82 @@ 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.
* Returns the funding over time for BUND projects. Accepts the same filters as /bund/search, so the funding total can be made to match whatever the results table is currently filtered to.
* @endpoint get /api/projects/institution/bund/funding-over-time
* @param rawOaInstitutionId The institution ID to filter by.
* @param executingAgency Executing Agencies (Ausführende Stellen) to filter by.
* @param fundingArts Project types to include: fp7, h2020, heu.
* @param title Project title/acronym search.
* @param keywords Raw keywords to search in title/objective/keywords/topics.
* @param topicIds OpenAlex topic IDs used for fuzzy topic resolution.
* @param filterTopicIds Additional OpenAlex topic IDs used as mandatory filters.
* @param fundingStartYears Funding start years.
* @param fundingEndYears Funding end years.
* @param countries Organization countries.
* @param fuzzy Use OpenAlex topic-id resolution if true, otherwise raw keyword search.
* @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.');
}
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId?: string, executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, fuzzy?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionFunderSummary>;
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId?: string, executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, fuzzy?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionFunderSummary>>;
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId?: string, executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, fuzzy?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionFunderSummary>>;
public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId?: string, executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, fuzzy?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>rawOaInstitutionId, 'raw_oa_institution_id');
if (executingAgency) {
executingAgency.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'executing_agency');
})
}
if (fundingArts) {
fundingArts.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'funding_arts');
})
}
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>title, 'title');
if (keywords) {
keywords.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'keywords');
})
}
if (topicIds) {
topicIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'topic_ids');
})
}
if (filterTopicIds) {
filterTopicIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'filter_topic_ids');
})
}
if (fundingStartYears) {
fundingStartYears.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'funding_start_years');
})
}
if (fundingEndYears) {
fundingEndYears.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'funding_end_years');
})
}
if (countries) {
countries.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'countries');
})
}
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>fuzzy, 'fuzzy');
let localVarHeaders = this.defaultHeaders;
@@ -378,23 +437,120 @@ export class ProjectsService extends BaseService {
/**
* Get funding over time for EU projects.
* Returns the funding over time for EU projects associated with the specified institution.
* Returns the funding over time for EU CORDIS projects. Accepts the same filters as /eu/search, so the funding total can be made to match whatever the results table is currently filtered to.
* @endpoint get /api/projects/institution/eu/funding-over-time
* @param rawOaInstitutionId The institution ID to filter by.
* @param rawOaInstitutionId OpenAlex institution ID to filter by.
* @param authorId OpenAlex author ID to filter by.
* @param authorIds Additional OpenAlex author IDs to filter by. All selected authors must match.
* @param organizationIds CORDIS organisation IDs. All selected organizations must match.
* @param organizationNames CORDIS organization names. All selected organizations must match.
* @param projectTypes Project types to include: fp7, h2020, heu.
* @param title Project title/acronym search.
* @param keywords Raw keywords to search in title/objective/keywords/topics.
* @param topicIds OpenAlex topic IDs used for fuzzy topic resolution.
* @param filterTopicIds Additional OpenAlex topic IDs used as mandatory filters.
* @param fundingStartYears Funding start years.
* @param fundingEndYears Funding end years.
* @param countries Organization countries.
* @param frameworkProgrammes Framework programme filters.
* @param fundingSchemes Funding scheme filters.
* @param statuses Project status filters.
* @param fuzzy Use OpenAlex topic-id resolution if true, otherwise raw keyword search.
* @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.');
}
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, fuzzy?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionFunderSummary>;
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, fuzzy?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionFunderSummary>>;
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, fuzzy?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionFunderSummary>>;
public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, fuzzy?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>rawOaInstitutionId, 'raw_oa_institution_id');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>authorId, 'author_id');
if (authorIds) {
authorIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'author_ids');
})
}
if (organizationIds) {
organizationIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'organization_ids');
})
}
if (organizationNames) {
organizationNames.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'organization_names');
})
}
if (projectTypes) {
projectTypes.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'project_types');
})
}
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>title, 'title');
if (keywords) {
keywords.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'keywords');
})
}
if (topicIds) {
topicIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'topic_ids');
})
}
if (filterTopicIds) {
filterTopicIds.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'filter_topic_ids');
})
}
if (fundingStartYears) {
fundingStartYears.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'funding_start_years');
})
}
if (fundingEndYears) {
fundingEndYears.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'funding_end_years');
})
}
if (countries) {
countries.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'countries');
})
}
if (frameworkProgrammes) {
frameworkProgrammes.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'framework_programmes');
})
}
if (fundingSchemes) {
fundingSchemes.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'funding_schemes');
})
}
if (statuses) {
statuses.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'statuses');
})
}
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>fuzzy, 'fuzzy');
let localVarHeaders = this.defaultHeaders;
+1
View File
@@ -693,6 +693,7 @@ export const routes: Routes = [
bundProjectsFunding: bundProjectsFundingResolver,
cordisEuProjectsFunding: cordisEuProjectsFundingResolver,
},
runGuardsAndResolvers: 'always',
children: [
{
path: '',
@@ -1,15 +1,55 @@
import { ResolveFn } from '@angular/router';
import { InstitutionFunderSummary, ProjectsService } from '../api';
import { inject } from '@angular/core';
import { bundProjectQueryParamKeys } from './bund-projects.resolver';
export const bundProjectsFundingResolver: ResolveFn<
InstitutionFunderSummary
> = (route, state) => {
let institutionId = route.parent?.paramMap.get('institutionId') ?? null;
if (!institutionId) {
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
institutionId = route.parent?.parent?.paramMap.get('institutionId') ?? null;
}
if (!institutionId) {
throw new Error(
'Institution ID is required to resolve BUND projects funding',
);
}
const fundingStartYears = route.queryParamMap.getAll(
bundProjectQueryParamKeys.funding_start,
);
const fundingEndYears = route.queryParamMap.getAll(
bundProjectQueryParamKeys.funding_end,
);
const keywords =
route.queryParamMap.get(bundProjectQueryParamKeys.keywords)?.split(',') ||
[];
const topicIds = route.queryParamMap.getAll(
bundProjectQueryParamKeys.topicId,
);
const topics = route.queryParamMap.getAll(bundProjectQueryParamKeys.topics);
const fundingType = route.queryParamMap.getAll(
bundProjectQueryParamKeys.funding_type,
);
const fuzzySearch = route.queryParamMap.get('fuzzy') === 'true';
const search =
route.queryParamMap.get(bundProjectQueryParamKeys.title) || undefined;
const executingAgency = route.queryParamMap.getAll(
bundProjectQueryParamKeys.agency,
);
return inject(ProjectsService).getInstitutionBundProjectsFundingOverTime(
institutionId!,
institutionId,
executingAgency,
fundingType,
search,
keywords,
topics,
topicIds,
fundingStartYears,
fundingEndYears,
[], // countries - bundProjectsResolver doesn't wire this up yet either
fuzzySearch,
);
};
@@ -1,17 +1,76 @@
import { ResolveFn } from '@angular/router';
import { InstitutionFunderSummary, ProjectsService } from '../api';
import { inject } from '@angular/core';
import { euProjectQueryParamKeys } from './eu-cordis-projects.resolver';
export const cordisEuProjectsFundingResolver: ResolveFn<
InstitutionFunderSummary
> = (route, state) => {
let institutionId = route.parent?.paramMap.get('institutionId') ?? null;
if (!institutionId) {
institutionId = route.parent?.parent?.paramMap.get('institutionId') ?? null;
}
if (!institutionId) {
throw new Error(
'Institution ID is required to resolve Cordis EU projects funding',
);
}
const searchTerm =
route.queryParamMap.get(euProjectQueryParamKeys.title) ?? undefined;
const fundingStart = route.queryParamMap.getAll(
euProjectQueryParamKeys.funding_start,
);
const fundingEnd = route.queryParamMap.getAll(
euProjectQueryParamKeys.funding_end,
);
const filteredTopicIds = route.queryParamMap.getAll(
euProjectQueryParamKeys.topicId,
);
const projectTypes = route.queryParamMap.getAll(
euProjectQueryParamKeys.projectType,
);
const organizationIds = route.queryParamMap.getAll(
euProjectQueryParamKeys.institutionId,
);
const authorIds = route.queryParamMap
.getAll(euProjectQueryParamKeys.authorId)
.map((id) => id.split('/').pop() || id);
const countries = route.queryParamMap.getAll(euProjectQueryParamKeys.country);
const frameworkProgrammes = route.queryParamMap.getAll(
euProjectQueryParamKeys.frameworkProgramme,
);
const fundingSchemes = route.queryParamMap.getAll(
euProjectQueryParamKeys.fundingScheme,
);
const statuses = route.queryParamMap.getAll(euProjectQueryParamKeys.status);
return inject(ProjectsService).getInstitutionCordisEuProjectsFundingOverTime(
institutionId,
undefined, // authorId (single) - institution view doesn't use this
authorIds,
organizationIds,
[], // organizationNames
projectTypes as any,
searchTerm,
[], // keywords - institution view doesn't use free-text keywords
[], // topicIds (fuzzy) - institution view doesn't use fuzzy topic search
filteredTopicIds,
fundingStart,
fundingEnd,
countries,
frameworkProgrammes,
fundingSchemes,
statuses,
false, // fuzzy
);
};