From 06c35e904937de9ed3ac8256bf9197f6fe0b20f2 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 17 Mar 2020 17:48:02 +0000 Subject: [PATCH] [Library | Trunk]: 1. Add pid urls on properties. 2. References: Change parsing functions to get all pids with the confidence value. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58288 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../landing-utils/parsingFunctions.class.ts | 45 +++++++++---------- .../showIdentifiers.component.ts | 21 +++------ .../result/resultLanding.component.html | 8 ++-- utils/entities/resultLandingInfo.ts | 13 +++++- utils/properties/env-properties.ts | 2 + .../result-preview.component.html | 2 +- 6 files changed, 47 insertions(+), 44 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index c01cfc6c..9a03dfa3 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -1,4 +1,5 @@ import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../utils/result-preview/result-preview"; +import {Reference} from "../../utils/entities/resultLandingInfo"; export class ParsingFunctions { @@ -629,31 +630,27 @@ export class ParsingFunctions { return pLanguages; } - parseReferences(citations: any): { "name": string, "url": string }[] { - let references = new Array<{ "name": string, "url": string }>(); - - let citation; - let length = Array.isArray(citations) ? citations.length : 1; - for (let i = 0; i < length; i++) { - citation = Array.isArray(citations) ? citations[i] : citations; - - let url; - if (citation.hasOwnProperty("id")) { - let citationId; - let length1 = Array.isArray(citation['id']) ? citation['id'].length : 1; - for (let j = 0; j < length1; j++) { - citationId = Array.isArray(citation['id']) ? citation['id'][j] : citation['id']; - - if (citationId.type == "pmid") { - url = "http://www.ncbi.nlm.nih.gov/pubmed/" + citationId.value; - } - } + parseReferences(citations: any): Reference[] { + let references: Reference[] = []; + citations = Array.isArray(citations) ? citations : [citations]; + citations.forEach(citation => { + let reference: Reference = {name: null, ids: []}; + if(citation.rawText) { + reference.name = citation.rawText; } - - references[citation.position - 1] = {"name": "", "url": ""}; - references[citation.position - 1]['name'] = citation.rawText; - references[citation.position - 1]['url'] = url; - } + if(citation.id) { + let ids: any[] = Array.isArray(citation.id) ? citation.id : [citation.id]; + ids.forEach(id => { + reference.ids.push({ + type: id.type, + value: id.value, + trust: id.confidenceLevel + }); + }); + } + references[citation.position - 1] = reference; + }); + console.log(references); return references; } } diff --git a/landingPages/landing-utils/showIdentifiers.component.ts b/landingPages/landing-utils/showIdentifiers.component.ts index b8a1bcb7..b6b2b599 100644 --- a/landingPages/landing-utils/showIdentifiers.component.ts +++ b/landingPages/landing-utils/showIdentifiers.component.ts @@ -1,5 +1,6 @@ import {Component, Input} from '@angular/core'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {EnvProperties} from "../../utils/properties/env-properties"; @Component({ selector: 'showIdentifiers', @@ -11,16 +12,16 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; - + {{item}} - + {{item}} - + {{item}} - + {{item}} @@ -43,21 +44,13 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class"; export class ShowIdentifiersComponent { @Input() identifiers: Map; - public doiURL: string; - public pmcURL: string; - public pmidURL: string; - public handleURL: string; + @Input() properties: EnvProperties; public showAll: boolean = false; public sizeOfIdentifiers: number = -1; public sizeOfPreviousIdentifiers: number = -1; public pageSize: number = 3; - constructor() { - this.doiURL = "https://dx.doi.org/"; - this.pmcURL = "http://europepmc.org/articles/"; - this.handleURL = "http://hdl.handle.net/"; - this.pmidURL = "https://www.ncbi.nlm.nih.gov/pubmed/"; - } + constructor() {} ngOnInit() {} diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 7a25b826..518ce3a1 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -79,7 +79,7 @@
  • - +
  • @@ -585,10 +585,10 @@

    - {{item['name']}} - + {{item.name}} +

    >; //> diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index 57ad55e3..d725f496 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -30,7 +30,9 @@ export class EnvProperties { searchOrcidURL; orcidURL; doiURL; + pmcURL; pmidURL; + handleURL; cordisURL; openDoarURL; r3DataURL; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index a51b0f66..0ef41e71 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -179,7 +179,7 @@
    - +