diff --git a/src/assets/scss/main.scss b/src/assets/scss/main.scss index 6003102f3..f553567e7 100644 --- a/src/assets/scss/main.scss +++ b/src/assets/scss/main.scss @@ -906,3 +906,19 @@ label.environment-option-label { overflow: hidden; text-overflow: ellipsis; } + +.missing-data { + /* using an opacity instead of a muted color (for example + 'gray') to preserve some difference in row color when + a table is striped. + */ + background-color: black; + opacity: 17%; + } + +#data_set th { + min-width: 5em; +} + + + diff --git a/src/breeding-insight/dao/ExperimentDAO.ts b/src/breeding-insight/dao/ExperimentDAO.ts index c344fa5c8..536c6a924 100644 --- a/src/breeding-insight/dao/ExperimentDAO.ts +++ b/src/breeding-insight/dao/ExperimentDAO.ts @@ -46,7 +46,7 @@ export class ExperimentDAO { config.experimentId = experimentId; config.datasetId = datasetId; config.params = { - stat : stats, + stats : stats, }; return new Promise>(((resolve, reject) => { api.call(config) diff --git a/src/breeding-insight/model/DatasetModel.ts b/src/breeding-insight/model/DatasetModel.ts index d2feeb5ab..1acd5016b 100644 --- a/src/breeding-insight/model/DatasetModel.ts +++ b/src/breeding-insight/model/DatasetModel.ts @@ -20,21 +20,22 @@ import {ObservationUnit} from "@/breeding-insight/model/ObservationUnit"; import {ObservationVariable} from "@/breeding-insight/model/ObservationVariable"; export class DatasetModel { - id?: string; - experimentId?: string; + id: string; + experimentId: string; + data: Observation[]; + observationUnits: ObservationUnit[]; + observationVariables: ObservationVariable[]; additionalInfo?: any; - data?: Observation[]; - observationUnits?: ObservationUnit[]; - observationVariables?: ObservationVariable[]; - - - constructor(id?: string, - experimentId?: string, - additionalInfo?: any, - data?: Observation[], - observationUnits?: ObservationUnit[], - observationVariables?: ObservationVariable[] - ) { + + + + constructor(id: string, + experimentId: string, + data: Observation[], + observationUnits: ObservationUnit[], + observationVariables: ObservationVariable[], + additionalInfo?: any + ) { this.id = id; this.experimentId = experimentId; this.additionalInfo = additionalInfo; @@ -48,10 +49,10 @@ export class DatasetModel { return new DatasetModel( dataset.id, dataset.experimentId, - dataset.additionalInfo, dataset.data, - dataset.observationUnits - ); + dataset.observationUnits, + dataset.additionalInfo + ); } equals(dataset?: DatasetModel): boolean { diff --git a/src/breeding-insight/model/DatasetTableRow.ts b/src/breeding-insight/model/DatasetTableRow.ts new file mode 100644 index 000000000..74594c042 --- /dev/null +++ b/src/breeding-insight/model/DatasetTableRow.ts @@ -0,0 +1,83 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class DatasetTableRow { + germplasmName?: string; + gid?: string; + testOrCheck?: string; + env?: string; + envLocation?: string; + envYear?: string; + expUnitId?: string; + expReplicate?: number; + expBlock?: number; + row?: string; + column?: string; + obsUnitId?: string; + traitValues?: string[] = []; + + + constructor(germplasmName?: string, + gid?: string, + testOrCheck?: string, + env?: string, + envLocation?: string, + envYear?: string, + expUnitId?: string, + expReplicate?: number, + expBlock?: number, + row?: string, + column?: string, + obsUnitId?: string, + traitValues?: string[]) { + this.germplasmName = germplasmName; + this.gid = gid; + this.testOrCheck = testOrCheck; + this.env = env; + this.envLocation = envLocation; + this.envYear = envYear; + this.expUnitId = expUnitId; + this.expReplicate = expReplicate; + this.expBlock = expBlock; + this.row = row; + this.column = column; + this.obsUnitId = obsUnitId; + this.traitValues = traitValues; + + } + + static assign(dataset: DatasetTableRow): DatasetTableRow { + + return new DatasetTableRow( + dataset.germplasmName, + dataset.gid, + dataset.testOrCheck, + dataset.env, + dataset.envLocation, + dataset.envYear, + dataset.expUnitId, + dataset.expReplicate, + dataset.expBlock, + dataset.row, + dataset.column, + dataset.obsUnitId, + dataset.traitValues + ); + } + + +} \ No newline at end of file diff --git a/src/breeding-insight/model/Observation.ts b/src/breeding-insight/model/Observation.ts index 3611b5963..1826d3165 100644 --- a/src/breeding-insight/model/Observation.ts +++ b/src/breeding-insight/model/Observation.ts @@ -17,10 +17,10 @@ export class Observation { id?: string; - studyId?: string; - germplasmId?: string; - observationUnitId?: string; - observationVariableId?: string; + studyDbId?: string; + germplasmDbId?: string; + observationUnitDbId?: string; + observationVariableDbId?: string; germplasmName?: string; observationUnitName?: string; observationVariableName?: string; @@ -33,10 +33,10 @@ export class Observation { observationTimeStamp?: string; constructor(id?: string, - studyId?: string, - germplasmId?: string, - observationUnitId?: string, - observationVariableId?: string, + studyDbId?: string, + germplasmDbId?: string, + observationUnitDbId?: string, + observationVariableDbId?: string, germplasmName?: string, observationUnitName?: string, observationVariableName?: string, @@ -48,10 +48,10 @@ export class Observation { value?: any ) { this.id = id; - this.studyId = studyId; - this.germplasmId = germplasmId; - this.observationUnitId = observationUnitId; - this.observationVariableId = observationVariableId; + this.studyDbId = studyDbId; + this.germplasmDbId = germplasmDbId; + this.observationUnitDbId = observationUnitDbId; + this.observationVariableDbId = observationVariableDbId; this.germplasmName = germplasmName; this.observationUnitName = observationUnitName; this.observationVariableName = observationVariableName; @@ -72,10 +72,10 @@ export class Observation { const stamp: string | undefined = observation.timeStamp ? observation.timeStamp.toISOString() : undefined; return new Observation(observation.id, - observation.studyId, - observation.germplasmId, - observation.observationUnitId, - observation.observationVariableId, + observation.studyDbId, + observation.germplasmDbId, + observation.observationUnitDbId, + observation.observationVariableDbId, observation.germplasmName, observation.observationUnitName, observation.observationVariableName, @@ -90,10 +90,10 @@ export class Observation { equals(observation?: Observation): boolean { if (!observation) {return false;} return (this.id === observation.id) && - (this.studyId === observation.studyId) && - (this.germplasmId === observation.germplasmId) && - (this.observationUnitId === observation.observationUnitId) && - (this.observationVariableId === observation.observationVariableId) && + (this.studyDbId === observation.studyDbId) && + (this.germplasmDbId === observation.germplasmDbId) && + (this.observationUnitDbId === observation.observationUnitDbId) && + (this.observationVariableDbId === observation.observationVariableDbId) && (this.germplasmName === observation.germplasmName) && (this.observationUnitName === observation.observationUnitName) && (this.observationVariableName === observation.observationVariableName) && diff --git a/src/breeding-insight/model/ObservationUnit.ts b/src/breeding-insight/model/ObservationUnit.ts index 14a24fc67..c6736b73c 100644 --- a/src/breeding-insight/model/ObservationUnit.ts +++ b/src/breeding-insight/model/ObservationUnit.ts @@ -15,22 +15,72 @@ * limitations under the License. */ +import {ExternalReferences} from "@/breeding-insight/brapi/model/externalReferences"; + export class ObservationUnit { - id?: string; - name?: string; - position?: ObservationUnitPosition; - - constructor(id?:string, name?:string, position?:ObservationUnitPosition) { - this.id = id; - this.name = name; - this.position = position; + observationUnitDbId: string; + germplasmDbId?: string; + germplasmName: string; + locationDbI?: string; + locationName: string; + observationUnitName?: string; + observationUnitPUI?: string; + programDbId?: string; + programName?: string; + studyDbId?: string; + studyName: string; + trialDbId?: string; + trialName?: string; + observationUnitPosition?: ObservationUnitPosition; + externalReferences?: ExternalReferences; + additionalInfo?: any; + treatments?: any; + + + constructor(observationUnitDbId:string, observationUnitName?:string, observationUnitPosition?:ObservationUnitPosition, externalReferences?: ExternalReferences) { + this.observationUnitDbId = observationUnitDbId; + this.observationUnitName = observationUnitName; + this.observationUnitPosition = observationUnitPosition; + this.externalReferences = externalReferences; } } export class ObservationUnitPosition { level?: string; + observationLevelRelationships?: ObservationLevelRelationship[]; + positionCoordinateXType?: string; + positionCoordinateX?: string; + positionCoordinateYType?: string; + positionCoordinateY?: string; + entryType?: string; - constructor(level?:string) { + constructor(level?:string, + observationLevelRelationships?: ObservationLevelRelationship[], + positionCoordinateXType?: string, + positionCoordinateX?: string, + positionCoordinateYType?: string, + positionCoordinateY?: string, + entryType?: string, + ) { this.level = level; + this.observationLevelRelationships = observationLevelRelationships; + this.positionCoordinateXType = positionCoordinateXType; + this.positionCoordinateX = positionCoordinateX; + this.positionCoordinateYType = positionCoordinateYType; + this.positionCoordinateY = positionCoordinateY; + this.entryType = entryType + } +} + + +export class ObservationLevelRelationship { + levelName?: string; + levelOrder?: string; + levelCode?: number; + + constructor(levelName?: string, levelOrder?: string, levelCode?: number) { + this.levelName = levelName; + this.levelOrder = levelOrder; + this.levelCode = levelCode; } } \ No newline at end of file diff --git a/src/breeding-insight/model/ObservationVariable.ts b/src/breeding-insight/model/ObservationVariable.ts index 828028ad4..7e044399a 100644 --- a/src/breeding-insight/model/ObservationVariable.ts +++ b/src/breeding-insight/model/ObservationVariable.ts @@ -21,20 +21,20 @@ import {Scale} from "@/breeding-insight/model/Scale"; // TODO: eventually refactor Trait into Observation Variable to be consistent with the BrAPI model export class ObservationVariable { - id?: string; + observationVariableDbId?: string; observationVariableName?: string; additionalInfo?: OVAdditionalInfo; trait?: Trait; method?: Method; scale?: Scale; - constructor(id?:string, + constructor(observationVariableDbId?:string, observationVariableName?:string, additionalInfo?:OVAdditionalInfo, trait?:Trait, method?:Method, scale?:Scale) { - this.id = id; + this.observationVariableDbId = observationVariableDbId; this.observationVariableName = observationVariableName; if (additionalInfo){ this.additionalInfo = OVAdditionalInfo.assign({...additionalInfo} as OVAdditionalInfo); diff --git a/src/breeding-insight/utils/BrAPIUtils.ts b/src/breeding-insight/utils/BrAPIUtils.ts index 1f9b3cf78..2825b8326 100644 --- a/src/breeding-insight/utils/BrAPIUtils.ts +++ b/src/breeding-insight/utils/BrAPIUtils.ts @@ -18,7 +18,10 @@ import {ExternalReferences} from "@/breeding-insight/brapi/model/externalReferences"; export class BrAPIUtils { - static getBreedingInsightId(references: ExternalReferences, referenceSourcePath: string = ""): string | undefined { + static getBreedingInsightId(references: ExternalReferences|undefined, referenceSourcePath: string = ""): string | undefined { + if(!references){ + return undefined; + } let val = references.find(ref => ref.referenceSource === process.env.VUE_APP_BI_REFERENCE_SOURCE + referenceSourcePath); return val ? val.referenceID : ""; } diff --git a/src/components/observations/ObservationsListTable.vue b/src/components/observations/ObservationsListTable.vue new file mode 100644 index 000000000..b63d881bd --- /dev/null +++ b/src/components/observations/ObservationsListTable.vue @@ -0,0 +1,240 @@ + + + + + diff --git a/src/views/import/Dataset.vue b/src/views/import/Dataset.vue index 8644384d5..316e24fcd 100644 --- a/src/views/import/Dataset.vue +++ b/src/views/import/Dataset.vue @@ -18,30 +18,184 @@ + \ No newline at end of file +