Commit e94afccd authored by Maud Marty's avatar Maud Marty Committed by Célia Michotey
Browse files

Merge BrapiMcpd and GnpisMcpd

parent c04accde
package fr.inra.urgi.faidare.api.brapi.v1;
import fr.inra.urgi.faidare.api.NotFoundException;
import fr.inra.urgi.faidare.domain.brapi.v1.data.*;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiGermplasm;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiGermplasmAttributeValueList;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiPedigree;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiProgeny;
import fr.inra.urgi.faidare.domain.brapi.v1.response.BrapiListResponse;
import fr.inra.urgi.faidare.domain.brapi.v1.response.BrapiResponse;
import fr.inra.urgi.faidare.domain.criteria.GermplasmAttributeCriteria;
......@@ -9,6 +12,7 @@ import fr.inra.urgi.faidare.domain.criteria.GermplasmGETSearchCriteria;
import fr.inra.urgi.faidare.domain.criteria.GermplasmPOSTSearchCriteria;
import fr.inra.urgi.faidare.domain.criteria.GermplasmSearchCriteria;
import fr.inra.urgi.faidare.domain.criteria.base.PaginationCriteriaImpl;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmMcpdVO;
import fr.inra.urgi.faidare.domain.response.ApiResponseFactory;
import fr.inra.urgi.faidare.domain.response.PaginatedList;
import fr.inra.urgi.faidare.domain.response.Pagination;
......@@ -71,9 +75,9 @@ public class GermplasmController {
*/
@ApiOperation("Get germplasm mcpd by id")
@GetMapping("/brapi/v1/germplasm/{germplasmDbId}/mcpd")
public BrapiResponse<BrapiGermplasmMcpd> getGermplasmMcpd(@PathVariable String germplasmDbId) {
public BrapiResponse<GermplasmMcpdVO> getGermplasmMcpd(@PathVariable String germplasmDbId) {
LOGGER.debug("germplasmDbId = " + germplasmDbId);
BrapiGermplasmMcpd germplasm = germplasmService.getMcpdById(germplasmDbId);
GermplasmMcpdVO germplasm = germplasmService.getMcpdById(germplasmDbId);
if (germplasm == null) {
throw new NotFoundException("Germplasm not found for id '" + germplasmDbId + "'");
}
......
......@@ -4,14 +4,11 @@ import com.google.common.base.Strings;
import fr.inra.urgi.faidare.api.BadRequestException;
import fr.inra.urgi.faidare.api.NotFoundException;
import fr.inra.urgi.faidare.api.brapi.v1.GermplasmController;
import fr.inra.urgi.faidare.domain.brapi.v1.response.BrapiResponse;
import fr.inra.urgi.faidare.domain.criteria.FaidareGermplasmPOSTShearchCriteria;
import fr.inra.urgi.faidare.domain.criteria.GermplasmGETSearchCriteria;
import fr.inra.urgi.faidare.domain.criteria.GermplasmPOSTSearchCriteria;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmMcpdVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmVO;
import fr.inra.urgi.faidare.domain.datadiscovery.response.GermplasmSearchResponse;
import fr.inra.urgi.faidare.domain.response.ApiResponseFactory;
import fr.inra.urgi.faidare.domain.response.PaginatedList;
import fr.inra.urgi.faidare.service.es.GermplasmService;
import io.swagger.annotations.Api;
......@@ -85,19 +82,6 @@ public class GnpISGermplasmController {
return germplasm;
}
/**
* @link https://brapi.docs.apiary.io/#reference/germplasm/germplasm/get-germplasm-mcpd-by-germplasmdbid
*/
@ApiOperation("Get germplasm mcpd by id")
@GetMapping("/faidare/v1/germplasm/{germplasmDbId}/mcpd")
public BrapiResponse<GermplasmMcpdVO> getGermplasmMcpd(@PathVariable String germplasmDbId) {
LOGGER.debug("germplasmDbId = " + germplasmDbId);
GermplasmMcpdVO germplasm = germplasmService.getMcpdById(germplasmDbId);
if (germplasm == null) {
throw new NotFoundException("Germplasm not found for id '" + germplasmDbId + "'");
}
return ApiResponseFactory.createSingleObjectResponse(germplasm, null);
}
/**
* Webservice for exporting germplasm by criteria into a CSV.
......
<faidare-loading-spinner [loading]="loading" class="float-right"></faidare-loading-spinner>
<ng-container *ngIf="germplasmGnpis">
<ng-container *ngIf="germplasmGnpis && germplasmMcpd">
<h3 class="mb-4">
<img *ngIf="!loading && germplasmGnpis.holdingGenbank && germplasmGnpis.holdingGenbank.instituteName"
[src]="germplasmGnpis.holdingGenbank.logo"
......@@ -18,30 +18,31 @@
<ng-template #taxonTemplate>
<faidare-card-row
label="Genus"
[test]="germplasmGnpis.genus">
[test]="germplasmMcpd.genus">
<ng-template>
<i>{{ germplasmGnpis.genus }}</i>
<i>{{ germplasmMcpd.genus }}</i>
</ng-template>
</faidare-card-row>
<faidare-card-row
label="Species"
[test]="germplasmGnpis.species">
[test]="germplasmMcpd.species">
<ng-template>
<i>{{ germplasmGnpis.species }}</i>
{{ germplasmGnpis.speciesAuthority ? '(' + germplasmGnpis.speciesAuthority + ')' : '' }}
<i>{{ germplasmMcpd.species }}</i>
{{ germplasmMcpd.speciesAuthority ? '(' + germplasmMcpd.speciesAuthority + ')' : '' }}
</ng-template>
</faidare-card-row>
<faidare-card-row
label="Subtaxa"
[test]="germplasmGnpis.subtaxa">
[test]="germplasmMcpd.subtaxon">
<ng-template>
<i>{{ germplasmGnpis.subtaxa }}</i>
{{ germplasmGnpis.subtaxaAuthority ? '(' + germplasmGnpis.subtaxaAuthority + ')' : '' }}
<i>{{ germplasmMcpd.subtaxon }}</i>
{{ germplasmMcpd.subtaxonAuthority ? '(' + germplasmMcpd.subtaxonAuthority + ')' : '' }}
</ng-template>
</faidare-card-row>
<faidare-card-row
label="Authority"
[test]="germplasmTaxonAuthor">
......@@ -265,7 +266,7 @@
<faidare-card-row
label="Biological status"
[value]="germplasmGnpis.biologicalStatusOfAccessionCode">
[value]="germplasmMcpd.biologicalStatusOfAccessionCode">
</faidare-card-row>
<faidare-card-row
......@@ -280,7 +281,7 @@
<faidare-card-row
label="Pedigree"
[value]="germplasmGnpis.pedigree">
[value]="germplasmMcpd.ancestralData">
</faidare-card-row>
<faidare-card-row
......@@ -398,6 +399,14 @@
</ng-template>
</faidare-card-row>
<faidare-card-row
label="Acquisition Source Code"
[test]="germplasmMcpd.acquisitionSourceCode">
<ng-template>
{{ germplasmMcpd.acquisitionSourceCode }}
</ng-template>
</faidare-card-row>
<faidare-card-row
label="Institution"
[test]="germplasmGnpis.collector && germplasmGnpis.collector.institute && germplasmGnpis.collector.institute.instituteName">
......
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { BrapiService } from '../brapi.service';
import { GnpisService } from '../gnpis.service';
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {BrapiService} from '../brapi.service';
import {GnpisService} from '../gnpis.service';
import {
BrapiAttributeData,
BrapiGermplasmMcpd,
BrapiGermplasmPedigree,
BrapiLocation,
BrapiTaxonIds,
} from '../models/brapi.model';
import { Children, Germplasm, GermplasmMcpd, Site } from '../models/gnpis.model';
import { environment } from '../../environments/environment';
import {Children, Germplasm, Site} from '../models/gnpis.model';
import {environment} from '../../environments/environment';
@Component({
selector: 'faidare-germplasm-card',
......@@ -26,7 +27,7 @@ export class GermplasmCardComponent implements OnInit {
taxonIdsWithURL: BrapiTaxonIds[] = [];
germplasmGnpis: Germplasm;
germplasmMcpd: GermplasmMcpd;
germplasmMcpd: BrapiGermplasmMcpd;
germplasmPedigree: BrapiGermplasmPedigree;
germplasmProgeny: Children[];
germplasmAttributes: BrapiAttributeData[];
......@@ -46,7 +47,6 @@ export class GermplasmCardComponent implements OnInit {
.then(germplasm => {
const germplasmId = id || germplasm.germplasmDbId;
this.germplasmGnpis = germplasm;
this.getTaxon();
this.reformatData();
// TODO use the progeny call when the information about parent will be added.
......@@ -60,7 +60,7 @@ export class GermplasmCardComponent implements OnInit {
this.brapiService.germplasmMcpd(germplasmId).subscribe(germplasmMcpd => {
this.germplasmMcpd = germplasmMcpd.result;
});
this.getTaxon();
this.germplasmPedigree = null;
this.brapiService.germplasmPedigree(germplasmId)
......@@ -89,14 +89,14 @@ export class GermplasmCardComponent implements OnInit {
} else if (this.germplasmGnpis.genusSpecies) {
this.germplasmTaxon = this.germplasmGnpis.genusSpecies;
this.germplasmTaxonAuthor = this.germplasmGnpis.speciesAuthority;
} else if (this.germplasmGnpis.subtaxa) {
this.germplasmTaxon = this.germplasmGnpis.genus + ' ' + this.germplasmGnpis.species + ' ' + this.germplasmGnpis.subtaxa;
this.germplasmTaxonAuthor = this.germplasmGnpis.subtaxaAuthority;
} else if (this.germplasmGnpis.species) {
this.germplasmTaxon = this.germplasmGnpis.genus + ' ' + this.germplasmGnpis.species;
} else if (this.germplasmMcpd.subtaxon) {
this.germplasmTaxon = this.germplasmMcpd.genus + ' ' + this.germplasmMcpd.species + ' ' + this.germplasmMcpd.subtaxon;
this.germplasmTaxonAuthor = this.germplasmMcpd.subtaxonAuthority;
} else if (this.germplasmMcpd.species) {
this.germplasmTaxon = this.germplasmMcpd.genus + ' ' + this.germplasmMcpd.species;
this.germplasmTaxonAuthor = this.germplasmGnpis.speciesAuthority;
} else {
this.germplasmTaxon = this.germplasmGnpis.genus;
this.germplasmTaxon = this.germplasmMcpd.genus;
this.germplasmTaxonAuthor = '';
}
}
......
import * as schema from './schema.org.model';
import { DataDiscoveryFacet } from './data-discovery.model';
import {DataDiscoveryFacet} from './data-discovery.model';
export interface GermplasmCriteria {
accessionNumbers: string[];
......@@ -178,6 +178,7 @@ export interface BrapiGermplasm extends BrapiHasDocumentationURL, schema.Dataset
}
export interface BrapiGermplasmMcpd extends BrapiHasDocumentationURL {
groupId: string;
accessionNames: string[];
accessionNumber: string;
acquisitionDate: string;
......@@ -185,19 +186,17 @@ export interface BrapiGermplasmMcpd extends BrapiHasDocumentationURL {
alternateIDs: string[];
ancestralData: string;
biologicalStatusOfAccessionCode: string;
breedingInstitutes: {
instituteCode: string;
instituteName: string;
};
breedingInstitutes: BrapiInstitute;
collectingInfo: {
collectingDate: string;
collectingInstitutes: {
instituteCode: string;
instituteName: string;
};
collectingInstitutes: BrapiInstitute;
collectingMissionIdentifier: string;
collectingNumber: string;
collectors: string;
materialType: string;
collectingSite: {
locationDbId: string;
locationName: string;
coordinateUncertainty: string;
elevation: string;
georeferencingMethod: string;
......@@ -213,10 +212,8 @@ export interface BrapiGermplasmMcpd extends BrapiHasDocumentationURL {
countryOfOriginCode: string;
donorInfo: {
donorAccessionNumber: string;
donorInstitute: {
instituteCode: string;
instituteName: string;
};
donorInstitute: BrapiInstitute;
donationDate: string;
};
genus: string;
germplasmDbId: string;
......@@ -233,6 +230,37 @@ export interface BrapiGermplasmMcpd extends BrapiHasDocumentationURL {
storageTypeCodes: string[];
subtaxon: string;
subtaxonAuthority: string;
breederAccessionNumber: string;
breedingCreationYear: string;
catalogRegistrationYear: string;
catalogDeregistrationYear: string;
originLocationDbId: string;
originLocationName: string;
holdingInstitute: BrapiInstitute;
holdingGenbank: {
instituteName: string;
instituteCode: string;
webSite: string;
logo: string;
};
geneticNature: string;
presenceStatus: string;
distributorInfos: {
institute: BrapiInstitute;
accessionNumber: string;
distrubutionStatus: string;
};
}
export interface BrapiInstitute {
instituteName: string;
instituteCode: string;
acronym: string;
organisation: string;
instituteType: string;
webSite: string;
institureAddress: string;
logo: string;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment