[new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProviderInfo.ts: Updated field "contentpolicy: string;" to "contentpolicies: string[];". 2. dataProvider.service.ts: Parse contentPolicies field as array. 3. dataProvider.component.html: Display contentpolicies array. 4. searchResearchResults.service.ts: Parse field "entityType" from header.recordType instead of result.resulttype. 5. resultLanding.service.ts: Parse field "entityType" from header.recordType instead of result.resulttype | Parse header.status (not yet available field) for under curation records | [BUG] Parse field externalReference instead of externalreference. 6. searchOrganizations.service.ts: [BUG] Get "pid" field from correct path. 7. parsingFunctions.class.ts: [BUG] Fix parsing of measures - unit is an array.
This commit is contained in:
parent
61c60eff60
commit
01ccbb9d68
|
@ -617,9 +617,9 @@
|
|||
{{dataProviderInfo.jurisdiction}}
|
||||
</div>
|
||||
|
||||
<div *ngIf="dataProviderInfo.contentpolicy" class="uk-margin-medium-bottom">
|
||||
<div *ngIf="dataProviderInfo.contentpolicies?.length > 0" class="uk-margin-medium-bottom">
|
||||
<div class="uk-text-meta uk-margin-small-bottom">Content policy</div>
|
||||
{{dataProviderInfo.contentpolicy}}
|
||||
{{dataProviderInfo.contentpolicies.join(", ")}}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
|
|
|
@ -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']) {
|
||||
|
|
|
@ -974,9 +974,10 @@ export class ParsingFunctions {
|
|||
let downloads: number = 0;
|
||||
elements.forEach(element => {
|
||||
if (element.id == 'views') {
|
||||
let viewsNum = parseInt(element.unit.label);
|
||||
element.unit.forEach(unit => {
|
||||
let viewsNum = parseInt(unit.label);
|
||||
views += viewsNum;
|
||||
let datasourceId = element.unit.code;
|
||||
let datasourceId = unit.code;
|
||||
if(datasourceId) {
|
||||
if(datasourcePosition.has(datasourceId)) {
|
||||
countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum;
|
||||
|
@ -985,30 +986,34 @@ export class ParsingFunctions {
|
|||
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);
|
||||
});
|
||||
} else if (element.id == 'downloads') {
|
||||
element.unit.forEach(unit => {
|
||||
let downloadsNum = parseInt(unit.label);
|
||||
downloads += downloadsNum;
|
||||
let datasourceId = element.unit.code;
|
||||
if(datasourceId) {
|
||||
if(datasourcePosition.has(datasourceId)) {
|
||||
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})
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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<string, Map<string, string>> = this.parseBioentitiesAndSoftware(result["externalreference"]);
|
||||
if (result["externalReference"]) {
|
||||
let externalResults: Map<string, Map<string, string>> = 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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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']) : "";
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,7 +35,7 @@ export class DataProviderInfo {
|
|||
subjects: string[];
|
||||
jurisdiction: string;
|
||||
thematic: boolean;
|
||||
contentpolicy: string;
|
||||
contentpolicies: string[];
|
||||
identifiers: Map<string, string[]>; //key is the classname
|
||||
|
||||
fundedContent: string; // search query
|
||||
|
|
Loading…
Reference in New Issue