diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 50d88984..10aa0483 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -617,9 +617,9 @@ {{dataProviderInfo.jurisdiction}} -
+
Content policy
- {{dataProviderInfo.contentpolicy}} + {{dataProviderInfo.contentpolicies.join(", ")}}
diff --git a/landingPages/dataProvider/dataProvider.service.ts b/landingPages/dataProvider/dataProvider.service.ts index a9615b67..b3f49d96 100644 --- a/landingPages/dataProvider/dataProvider.service.ts +++ b/landingPages/dataProvider/dataProvider.service.ts @@ -198,9 +198,13 @@ export class DataProviderService { this.dataProviderInfo.jurisdiction = datasource.jurisdiction.label; } - // TODO: Add check for array if(datasource.contentpolicies) { - this.dataProviderInfo.contentpolicy = datasource.contentpolicies[0].label; + this.dataProviderInfo.contentpolicies = []; + datasource.contentpolicies.forEach(contentpolicy => { + if(contentpolicy.label) { + this.dataProviderInfo.contentpolicies.push(contentpolicy.label); + } + }) } if(datasource['datasourcetype']) { diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 7fd591b1..4eeae5a9 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -974,41 +974,46 @@ export class ParsingFunctions { let downloads: number = 0; elements.forEach(element => { if (element.id == 'views') { - let viewsNum = parseInt(element.unit.label); - views += viewsNum; - let datasourceId = element.unit.code; - if(datasourceId) { - if(datasourcePosition.has(datasourceId)) { - countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum; - } else { - datasourcePosition.set(datasourceId, countsPerDatasource.length); - countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": viewsNum, "downloads": 0}) + element.unit.forEach(unit => { + let viewsNum = parseInt(unit.label); + views += viewsNum; + let datasourceId = unit.code; + if(datasourceId) { + if(datasourcePosition.has(datasourceId)) { + countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum; + } else { + datasourcePosition.set(datasourceId, countsPerDatasource.length); + countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": viewsNum, "downloads": 0}) + } } - } - // measure.views = element.count; - } - if (element.id == 'downloads') { - let downloadsNum = parseInt(element.unit.label); - downloads += downloadsNum; - let datasourceId = element.unit.code; - if(datasourceId) { - if(datasourcePosition.has(datasourceId)) { - countsPerDatasource[datasourcePosition.get(datasourceId)].downloads = downloadsNum; - } else { - datasourcePosition.set(datasourceId, countsPerDatasource.length); - countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": 0, "downloads": downloadsNum}) + }); + } else if (element.id == 'downloads') { + element.unit.forEach(unit => { + let downloadsNum = parseInt(unit.label); + downloads += downloadsNum; + let datasourceId = unit.code; + if (datasourceId) { + if (datasourcePosition.has(datasourceId)) { + countsPerDatasource[datasourcePosition.get(datasourceId)].downloads = downloadsNum; + } else { + datasourcePosition.set(datasourceId, countsPerDatasource.length); + countsPerDatasource.push({ + "datasourceId": datasourceId.split("||")[0], + "datasourceName": datasourceId.split("||")[1], + "views": 0, + "downloads": downloadsNum + }) + } } - } + }); // measure.downloads = element.count; - } - if (element.id == 'influence_alt' || element.id == 'citation_count') { + } else if (element.id == 'influence_alt' || element.id == 'citation_count') { for(let unit of element.unit) { if(unit.code == "score") { - bip.push({name: 'citations', icon: 'cite', value: parseInt(element.unit.label), order: 2}); + bip.push({name: 'citations', icon: 'cite', value: parseInt(unit.label), order: 2}); } } - } - if (element.id == 'popularity' || element.id == 'influence' || element.id == 'impulse') { + } else if (element.id == 'popularity' || element.id == 'influence' || element.id == 'impulse') { let value = ""; for(let unit of element.unit) { if (unit.code == "class") { @@ -1029,12 +1034,10 @@ export class ParsingFunctions { if (element.id == 'popularity') { let metric: Metric = {name: 'popularity', icon: 'fire', value: value, order: 3}; bip.push(metric); - } - if (element.id == 'influence') { + } else if (element.id == 'influence') { let metric: Metric = {name: 'influence', icon: 'landmark', value: value, order: 4}; bip.push(metric); - } - if (element.id == 'impulse') { + } else if (element.id == 'impulse') { let metric: Metric = {name: 'impulse', icon: 'rocket', value: value, order: 5}; bip.push(metric); } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index 7b0175d8..9cc514d3 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -138,14 +138,14 @@ export class ResultLandingService { if(data["header"]) { this.resultLandingInfo.objIdentifier = data["header"]["id"]; this.resultLandingInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.resultLandingInfo.record, "result"); - //this.resultLandingInfo.resultType = data['header']['recordType']; + this.resultLandingInfo.resultType = data['header']['recordType']; + + this.resultLandingInfo.underCurationMessage = data["header"]['status'] == "UNDER_CURATION"; } if(data["result"]) { let result = data["result"]; - this.resultLandingInfo.resultType = result.resulttype; - let date: string = (result['publicationdate'] ? result['publicationdate'] : '') + ''; // transform to string in case it is an integer this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date; this.resultLandingInfo.dateofacceptance = result['publicationdate'] ? Dates.getDate(result['publicationdate']) : null; @@ -342,8 +342,8 @@ export class ResultLandingService { } // TODO: example? - if (result["externalreference"]) { - let externalResults: Map> = this.parseBioentitiesAndSoftware(result["externalreference"]); + if (result["externalReference"]) { + let externalResults: Map> = this.parseBioentitiesAndSoftware(result["externalReference"]); this.resultLandingInfo.bioentities = externalResults; } } @@ -421,12 +421,6 @@ export class ResultLandingService { // this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[13]); // } // - // // res['result']['header']['dri:status'] - // if (data[14] != null && data[14] == "under curation") { - // this.resultLandingInfo.underCurationMessage = true; - // } else { - // this.resultLandingInfo.underCurationMessage = false; - // } return this.resultLandingInfo; } diff --git a/services/searchOrganizations.service.ts b/services/searchOrganizations.service.ts index 2f9e70af..4a952afa 100644 --- a/services/searchOrganizations.service.ts +++ b/services/searchOrganizations.service.ts @@ -186,8 +186,8 @@ export class SearchOrganizationsService { } } - if(result['pid']) { - result.identifiers = this.parsingFunctions.parseIdentifiers(result['pid']); + if(resBody['pid']) { + result.identifiers = this.parsingFunctions.parseIdentifiers(resBody['pid']); } results.push(result); diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 65338787..3af01489 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -194,11 +194,12 @@ export class SearchResearchResultsService { let resData = Array.isArray(data) ? data[i]: data; var result: SearchResult = new SearchResult(); try { - if (resData.result['resulttype']) { - result.entityType = resData.result['resulttype']; + if (resData.header['recordType']) { + result.entityType = resData.header['recordType']; } else { result.entityType = resultType; } + result['title'] = {"name": '', "accessMode": ''}; result['title'].name = (resData.result['maintitle']) ? StringUtils.HTMLToString(resData.result['maintitle']) : ""; diff --git a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts index 71504bc4..85ac2c53 100644 --- a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts +++ b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts @@ -253,7 +253,6 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { return [item as String]; } - // TODO: schemeid field is missing private getLicense(result: any): License[] { const item = _.get(result, "result.bestaccessright", null); if (!item) return null; @@ -390,7 +389,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization { }; } - // TODO: extraInfo missing + // TODO: extraInfo missing - should be references, not citations private getCitation(result: any): Citation[] { const item = _.get(result, "result.metadata.oaf:entity.extraInfo.citations.citation", null); if (!item) return null; diff --git a/utils/entities/dataProviderInfo.ts b/utils/entities/dataProviderInfo.ts index 8054e5cb..151f6ffd 100644 --- a/utils/entities/dataProviderInfo.ts +++ b/utils/entities/dataProviderInfo.ts @@ -35,7 +35,7 @@ export class DataProviderInfo { subjects: string[]; jurisdiction: string; thematic: boolean; - contentpolicy: string; + contentpolicies: string[]; identifiers: Map; //key is the classname fundedContent: string; // search query