[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
This commit is contained in:
parent
0982dec4c3
commit
06c35e9049
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
|||
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
|
||||
<span *ngIf="(sizeOfPreviousIdentifiers + j) < pageSize || showAll">
|
||||
<span class="uk-display-inline-block">
|
||||
<a *ngIf="key=='doi'" [href]="doiURL + item" target="_blank">
|
||||
<a *ngIf="key=='doi'" [href]="properties.doiURL + item" target="_blank">
|
||||
{{item}} <span class="custom-external custom-icon space"></span>
|
||||
</a>
|
||||
<a *ngIf="key=='pmc'" [href]="pmcURL + item" target="_blank">
|
||||
<a *ngIf="key=='pmc'" [href]="properties.pmcURL + item" target="_blank">
|
||||
{{item}} <span class="custom-external custom-icon space"></span>
|
||||
</a>
|
||||
<a *ngIf="key=='pmid'" [href]="pmidURL + item" target="_blank">
|
||||
<a *ngIf="key=='pmid'" [href]="properties.pmidURL + item" target="_blank">
|
||||
{{item}} <span class="custom-external custom-icon space"></span>
|
||||
</a>
|
||||
<a *ngIf="key=='handle'" [href]="handleURL + item" target="_blank">
|
||||
<a *ngIf="key=='handle'" [href]="properties.handleURL + item" target="_blank">
|
||||
{{item}} <span class="custom-external custom-icon space"></span>
|
||||
</a>
|
||||
</span>
|
||||
|
@ -43,21 +44,13 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
|||
|
||||
export class ShowIdentifiersComponent {
|
||||
@Input() identifiers: Map<string, string[]>;
|
||||
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() {}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
</li>
|
||||
<!-- Identifiers -->
|
||||
<li *ngIf="resultLandingInfo.identifiers && resultLandingInfo.identifiers.size > 0">
|
||||
<showIdentifiers [identifiers]="resultLandingInfo.identifiers"></showIdentifiers>
|
||||
<showIdentifiers [identifiers]="resultLandingInfo.identifiers" [properties]="properties"></showIdentifiers>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Description -->
|
||||
|
@ -585,10 +585,10 @@
|
|||
<div
|
||||
*ngFor="let item of resultLandingInfo.references.slice((referencesPage-1)*1.5*pageSize, referencesPage*1.5*pageSize)">
|
||||
<p *ngIf="item">
|
||||
{{item['name']}}
|
||||
<span *ngIf="item.url">
|
||||
{{item.name}}
|
||||
<!--<span *ngIf="item.url">
|
||||
[<a href="{{item['url']}}" target="_blank">PubMed</a>]
|
||||
</span>
|
||||
</span>-->
|
||||
</p>
|
||||
</div>
|
||||
<no-load-paging *ngIf="resultLandingInfo.references.length > 1.5*pageSize" [type]="'references'"
|
||||
|
|
|
@ -7,6 +7,17 @@ import {
|
|||
RelationResult
|
||||
} from "../result-preview/result-preview";
|
||||
|
||||
export interface id {
|
||||
type: "pmid" | "doi" | "pmc" | "handle" | "openaire";
|
||||
value: string;
|
||||
trust: number
|
||||
}
|
||||
|
||||
export interface Reference {
|
||||
name?: string;
|
||||
ids: id[];
|
||||
}
|
||||
|
||||
export class ResultLandingInfo {
|
||||
// PUBLICATION, DATASET, SOFTWARE, ORP
|
||||
record;
|
||||
|
@ -51,7 +62,7 @@ export class ResultLandingInfo {
|
|||
deletedByInferenceIds: string[];
|
||||
|
||||
// PUBLICATION, DATASET, ORP
|
||||
references: { "name": string, "url": string }[];
|
||||
references: Reference[];
|
||||
|
||||
// PUBLICATION
|
||||
bioentities: Map<string, Map<string, string>>; //<site name, <>>
|
||||
|
|
|
@ -30,7 +30,9 @@ export class EnvProperties {
|
|||
searchOrcidURL;
|
||||
orcidURL;
|
||||
doiURL;
|
||||
pmcURL;
|
||||
pmidURL;
|
||||
handleURL;
|
||||
cordisURL;
|
||||
openDoarURL;
|
||||
r3DataURL;
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
</div>
|
||||
<!-- Identifiers -->
|
||||
<div *ngIf="result.identifiers && result.identifiers.size > 0">
|
||||
<showIdentifiers [identifiers]="result.identifiers"></showIdentifiers>
|
||||
<showIdentifiers [identifiers]="result.identifiers" [properties]="properties"></showIdentifiers>
|
||||
</div>
|
||||
<!-- Publisher -->
|
||||
<div *ngIf="result.publisher && result.publisher != ''" class="uk-text-small uk-margin-small-bottom">
|
||||
|
|
Loading…
Reference in New Issue