Commit df4189c5 authored by Célia Michotey's avatar Célia Michotey
Browse files

Merge branch 'refactor/uniformize' into 'master'

GPDS code refactor for uniformization

Closes GNP-5490

See merge request urgi-is/gpds!14
parents 9c8ec0f0 7cecf38e
......@@ -21,18 +21,14 @@ logging.level:
gpds:
elasticsearch-alias-template:
gnpis_{source}_{documentType}_5432_scratchy-group{groupId}
gnpis_{source}_{documentType}_5432_krusty-group{groupId}
elasticsearch-xref-index-name:
urgi_xref
urgi_xref_dev
cropOntology-repository-url:
https://urgi.versailles.inra.fr/files/ephesis/trait-ontology/data_16.3/ontology-repository.json
# TODO: Remove this and store at document generation directly (in BrAPI `observationVariable.documentationURL` field)
cropOntology-portal-link:
https://urgi.versailles.inra.fr/ephesis/ephesis/ontologyportal.do#termIdentifier=
# Provides access to user group WS used to query private data ES aliases
security-user-group-ws-url:
security-user-group-ws-token:
......
......@@ -40,7 +40,8 @@
"@id": "https://urgi.versailles.inra.fr",
"schema:identifier": "URGI",
"schema:name": "URGI GnpIS",
"schema:url": "https://urgi.versailles.inra.fr"
"schema:url": "https://urgi.versailles.inra.fr/gnpis/",
"schema:image": "./logos/GnpIS.png"
},
{
"@type": "schema:DataCatalog",
......
......@@ -1189,6 +1189,16 @@
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"dev": true
},
"angular-coordinates": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/angular-coordinates/-/angular-coordinates-1.0.0.tgz",
"integrity": "sha1-IcuYpv+PTV6LWLjOjvzBP7elnug="
},
"angular-mocks": {
"version": "1.7.8",
"resolved": "https://registry.npmjs.org/angular-mocks/-/angular-mocks-1.7.8.tgz",
"integrity": "sha512-LB13ESBT0eJrhQhfPXyLR9qm4LI9g44hyBFwUqZKEHEA4DpfxVTu0ONipiNoN0zWtmEAezA8u2gjcoaO2TStig=="
},
"ansi-colors": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.3.tgz",
......@@ -1258,6 +1268,7 @@
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
"dev": true,
"optional": true,
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
......@@ -2458,7 +2469,8 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"dev": true
"dev": true,
"optional": true
},
"constants-browserify": {
"version": "1.0.0",
......@@ -2854,7 +2866,8 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
"dev": true
"dev": true,
"optional": true
},
"depd": {
"version": "1.1.2",
......@@ -3821,7 +3834,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -3842,12 +3856,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -3862,17 +3878,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -3989,7 +4008,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -4001,6 +4021,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -4015,6 +4036,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -4022,12 +4044,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -4046,6 +4070,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -4126,7 +4151,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -4138,6 +4164,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -4223,7 +4250,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -4259,6 +4287,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -4278,6 +4307,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -4321,12 +4351,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -4335,6 +4367,7 @@
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz",
"integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"inherits": "~2.0.0",
......@@ -4347,6 +4380,7 @@
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"dev": true,
"optional": true,
"requires": {
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
......@@ -4384,7 +4418,8 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
"dev": true
"dev": true,
"optional": true
},
"get-stream": {
"version": "3.0.0",
......@@ -4564,7 +4599,8 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
"dev": true
"dev": true,
"optional": true
},
"has-value": {
"version": "1.0.0",
......@@ -5284,7 +5320,8 @@
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
"dev": true,
"optional": true
},
"is-windows": {
"version": "1.0.2",
......@@ -5927,6 +5964,7 @@
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"parse-json": "^2.2.0",
......@@ -5939,7 +5977,8 @@
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -6214,7 +6253,8 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
"dev": true
"dev": true,
"optional": true
},
"map-visit": {
"version": "1.0.0",
......@@ -6862,6 +6902,7 @@
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"dev": true,
"optional": true,
"requires": {
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
......@@ -7868,6 +7909,7 @@
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"dev": true,
"optional": true,
"requires": {
"load-json-file": "^1.0.0",
"normalize-package-data": "^2.3.2",
......@@ -7879,6 +7921,7 @@
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"pify": "^2.0.0",
......@@ -7889,7 +7932,8 @@
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -7898,6 +7942,7 @@
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
"dev": true,
"optional": true,
"requires": {
"find-up": "^1.0.0",
"read-pkg": "^1.0.0"
......@@ -7908,6 +7953,7 @@
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"dev": true,
"optional": true,
"requires": {
"path-exists": "^2.0.0",
"pinkie-promise": "^2.0.0"
......@@ -7918,6 +7964,7 @@
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"dev": true,
"optional": true,
"requires": {
"pinkie-promise": "^2.0.0"
}
......@@ -9192,6 +9239,7 @@
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
"dev": true,
"optional": true,
"requires": {
"is-utf8": "^0.2.0"
}
......@@ -10548,6 +10596,7 @@
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
"dev": true,
"optional": true,
"requires": {
"string-width": "^1.0.2 || 2"
}
......
......@@ -24,6 +24,8 @@
"@ng-bootstrap/ng-bootstrap": "4.0.0",
"@types/leaflet": "1.2.14",
"@types/leaflet.markercluster": "1.0.3",
"angular-coordinates": "1.0.0",
"angular-mocks": "1.7.8",
"bootstrap": "4.1.3",
"core-js": "2.5.7",
"font-awesome": "4.7.0",
......
......@@ -5,15 +5,15 @@ import { GermplasmCardComponent } from './germplasm-card/germplasm-card.componen
import { StudyCardComponent } from './study-card/study-card.component';
import { SiteCardComponent } from './site-card/site-card.component';
const routes: Routes = [
{ path: 'germplasm', component: GermplasmCardComponent },
export const routes: Routes = [
{ path: 'studies/:id', component: StudyCardComponent },
{ path: 'sites/:id', component: SiteCardComponent },
{ path: '', component: ResultPageComponent },
{ path: 'germplasm', component: GermplasmCardComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload' })],
exports: [RouterModule]
})
export class AppRoutingModule {
......
<gpds-navbar></gpds-navbar>
<div class="alert alert-warning text-center mb-4" role="alert">
This is a <b>beta</b> application. Please <a href="mailto:urgi-contact@inra.fr" class="alert-link" style="text-decoration: underline">contact us</a> for any comments
</div>
<div class="container">
<gpds-error></gpds-error>
<router-outlet></router-outlet>
......
......@@ -24,6 +24,7 @@ import { LoadingSpinnerComponent } from './loading-spinner/loading-spinner.compo
import { CardTableComponent } from './card-table/card-table.component';
import { MomentModule } from 'ngx-moment';
import { XrefsComponent } from './xrefs/xrefs.component';
import { CoordinatesModule } from 'angular-coordinates';
@NgModule({
......@@ -58,7 +59,8 @@ import { XrefsComponent } from './xrefs/xrefs.component';
NgbPopoverModule,
FormsModule,
ReactiveFormsModule,
MomentModule
MomentModule,
CoordinatesModule
],
providers: [
{ provide: HTTP_INTERCEPTORS, useExisting: ErrorInterceptorService, multi: true }
......
......@@ -2,26 +2,22 @@ import { BrapiService } from './brapi.service';
import {
BrapiContacts,
BrapiGermplasm,
BrapiGermplasmAttributes,
BrapiGermplasmPedigree,
BrapiGermplasmProgeny,
BrapiLocation,
BrapiObservationVariable,
BrapiProgeny,
BrapiResult,
BrapiResults,
BrapiSibling,
BrapiStudy,
BrapiTrial
} from './models/brapi.model';
import { DataDiscoverySource } from './models/data-discovery.model';
import {
BrapiDescriptor,
BrapiDonor,
BrapiGermplasmAttributes,
BrapiGermplasmPedigree,
BrapiGermplasmProgeny,
BrapiSet,
BrapiSibling
} from './models/brapi.germplasm.model';
import { Germplasm, GermplasmData, GermplasmResult, Institute, Origin, Site } from './models/gnpis.germplasm.model';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import { Donor, Germplasm, GermplasmInstitute, GermplasmSet, Institute, Site } from './models/gnpis.model';
describe('BrapiService', () => {
......@@ -112,17 +108,49 @@ describe('BrapiService', () => {
data: [{
germplasmDbId: 'g1',
accessionNumber: 'G_10',
defaultDisplayName: null,
germplasmPUI: null,
pedigree: null,
seedSource: null,
synonyms: null,
commonCropName: null,
instituteCode: null,
instituteName: null,
biologicalStatusOfAccessionCode: null,
countryOfOriginCode: null,
typeOfGermplasmStorageCode: null,
taxonIds: null,
germplasmName: 'germplam1',
genus: 'Populus',
species: 'x generosa',
subtaxa: ''
subtaxa: '',
speciesAuthority: null,
subtaxaAuthority: null,
donors: null,
acquisitionDate: null
}, {
germplasmDbId: 'g2',
accessionNumber: 'G_20',
germplasmName: 'germplam2',
genus: 'Triticum',
species: 'aestivum',
subtaxa: 'subsp'
subtaxa: 'subsp',
defaultDisplayName: null,
germplasmPUI: null,
pedigree: null,
seedSource: null,
synonyms: null,
commonCropName: null,
instituteCode: null,
instituteName: null,
biologicalStatusOfAccessionCode: null,
countryOfOriginCode: null,
typeOfGermplasmStorageCode: null,
taxonIds: null,
speciesAuthority: null,
subtaxaAuthority: null,
donors: null,
acquisitionDate: null
}],
}
};
......@@ -149,13 +177,14 @@ describe('BrapiService', () => {
defaultDisplayName: 'frere1'
};
const brapiDescriptor: BrapiDescriptor = {
name: 'caracteristique1',
pui: '12',
value: '32'
const brapiProgeny: BrapiProgeny = {
germplasmDbId: 'test',
defaultDisplayName: 'progeny1',
parentType: 'parent1'
};
const brapiGermplasmPedigree: GermplasmResult<BrapiGermplasmPedigree> = {
const brapiGermplasmPedigree: BrapiResult<BrapiGermplasmPedigree> = {
metadata: null,
result: {
germplasmDbId: 'test',
defaultDisplayName: '12',
......@@ -173,11 +202,12 @@ describe('BrapiService', () => {
}
};
const brapiGermplasmProgeny: GermplasmResult<BrapiGermplasmProgeny> = {
const brapiGermplasmProgeny: BrapiResult<BrapiGermplasmProgeny> = {
metadata: null,
result: {
germplasmDbId: 'test',
defaultDisplayName: '11',
progeny: [brapiSibling]
progeny: [brapiProgeny]
}
};
......@@ -192,9 +222,9 @@ describe('BrapiService', () => {
address: '12',
logo: null
};
const origin: Origin = {
const origin: GermplasmInstitute = {
...institute,
institute: institute,
germplasmPUI: '12',
accessionNumber: '12',
accessionCreationDate: '1993',
materialType: 'feuille',
......@@ -204,14 +234,15 @@ describe('BrapiService', () => {
distributionStatus: null
};
const brapiDonor: BrapiDonor = {
const brapiDonor: Donor = {
donorInstitute: institute,
germplasmPUI: '12',
accessionNumber: '12',
donorInstituteCode: 'urgi'
donorGermplasmPUI: '12',
donorAccessionNumber: '12',
donorInstituteCode: 'urgi',
donationDate: null
};
const brapiSet: BrapiSet = {
const germplasmSet: GermplasmSet = {
germplasmCount: 12,
germplasmRef: null,
id: 12,
......@@ -219,18 +250,21 @@ describe('BrapiService', () => {
type: 'plan'
};
const brapiGermplasmAttributes: GermplasmResult<GermplasmData<BrapiGermplasmAttributes[]>> = {
const brapiGermplasmAttributes: BrapiResult<BrapiGermplasmAttributes> = {
metadata: null,
result: {
germplasmDbId: 'test',
data: [{
attributeCode: 'att',
attributeDbId: 'attr2',
attributeName: 'longueur',
determinedDate: '2019',
value: '30'
}]
}
};
const germplasmTest: Germplasm = {
url: 'www.cirad.fr',
source: 'cirad',
germplasmDbId: 'test',
defaultDisplayName: 'test',
accessionNumber: 'test',
......@@ -264,20 +298,15 @@ describe('BrapiService', () => {
holdingGenbank: institute,
presenceStatus: null,
children: null,
descriptors: [brapiDescriptor],
originSite: null,
collectingSite: null,
evaluationSites: null,
collector: origin,
breeder: origin,