Skip to content

Commit

Permalink
fix: common profile sync (#103)
Browse files Browse the repository at this point in the history
* fix: commom profile sync

* fix: insert-date treatment
  • Loading branch information
alebinson authored Nov 18, 2021
1 parent 9a45bbf commit 5159300
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 39 deletions.
36 changes: 31 additions & 5 deletions src/models/layerMetadata/bestMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import { DiscreteOrder } from './discreteOrder';

export interface IBestMetadata {
productVersion: string | undefined;
productType: ProductType | undefined;
resolution: number | undefined;
srsName: string | undefined;
rms: number | undefined;
scale: string | undefined;
discretes: DiscreteOrder[] | undefined;
Expand Down Expand Up @@ -241,9 +239,6 @@ export class BestMetadata implements IBestMetadata, IMetadataCommonModel {
@graphql({
nullable: true,
})
@fieldConfig({
category: FieldCategory.GENERAL,
})
//#endregion
public ingestionDate: Date | undefined = undefined;

Expand Down Expand Up @@ -431,6 +426,37 @@ export class BestMetadata implements IBestMetadata, IMetadataCommonModel {
})
//#endregion
public region: string | undefined = undefined;

//#region COMMON: productId
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:productId',
queryableField: 'mc:productId',
pycswField: 'pycsw:ProductId',
})
@catalogDB({
column: {
name: 'product_id',
type: 'text',
nullable: false,
},
})
@tsTypes({
mappingType: TsTypes.STRING,
})
@graphql()
@fieldConfig({
category: FieldCategory.MAIN,
infoMsgCode: ['info-general-tooltip.required'],
validation: [
{
errorMsgCode: 'validation-general.required',
required: true,
},
],
})
//#endregion
public productId: string | undefined = 'UNKNOWN';
//#endregion

//#region BEST SPECIFIC FIELDS
Expand Down
12 changes: 6 additions & 6 deletions src/models/layerMetadata/interfaces/metadataCommonModel.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { GeoJSON } from 'geojson';
import { SensorType } from '../enums';
import { ProductType, SensorType } from '../enums';
import { RecordType } from '../../pycsw/coreEnums';

export interface IMetadataCommonModel {
// PROFILES COMMON FIELDS
type: RecordType | undefined;
classification: string | undefined;
productName: string | undefined; //title
productName: string | undefined;
description: string | undefined;
srsId: string | undefined;
producerName: string | undefined; //not in spec but present in profile (probably 3D only)
creationDate: Date | undefined;
ingestionDate: Date | undefined;
srsName: string | undefined;
producerName: string | undefined;
updateDate: Date | undefined;
sourceDateStart: Date | undefined;
sourceDateEnd: Date | undefined;
accuracyCE90: number | undefined;
sensorType: SensorType[] | undefined; //sensors
region: string | undefined;
footprint: GeoJSON | undefined;
productId: string | undefined;
productType: ProductType | undefined;
}
54 changes: 33 additions & 21 deletions src/models/layerMetadata/layer3DMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,11 @@ import { getPyCSWMapping, IPYCSWMapping, pycsw } from './decorators/property/csw
import { tsTypes, TsTypes } from './decorators/property/tsTypes.decorator';
import { ProductType, SensorType } from './enums';
import { catalogDB } from './decorators/property/catalogDB.decorator';
import { IMetadataCommonModel } from './interfaces/metadataCommonModel';

export interface ILayer3DMetadata {
type: RecordType | undefined;

productId: string | undefined;
productName: string | undefined;
productVersion: number | undefined;
productType: ProductType | undefined;
description: string | undefined;
productVersion: string | undefined;
creationDate: Date | undefined;
sourceDateStart: Date | undefined;
sourceDateEnd: Date | undefined;
minResolutionMeter: number | undefined;
maxResolutionMeter: number | undefined;
nominalResolution: number | undefined;
Expand All @@ -32,18 +25,11 @@ export interface ILayer3DMetadata {
accuracySE90: number | undefined;
relativeAccuracyLEP90: number | undefined;
visualAccuracy: number | undefined;
sensors: SensorType[] | undefined;
footprint: GeoJSON | undefined;
heightRangeFrom: number | undefined;
heightRangeTo: number | undefined;
srsId: number | undefined;
srsName: string | undefined;
srsOrigin: string | undefined;
region: string | undefined;
classification: string | undefined;
productionSystem: string | undefined;
productionSystemVer: string | undefined;
producerName: string | undefined;
productionMethod: string | undefined;
minFlightAlt: number | undefined;
maxFlightAlt: number | undefined;
Expand All @@ -55,7 +41,7 @@ export interface IPropPYCSWMapping extends IPYCSWMapping {
prop: string;
}

export class Layer3DMetadata implements ILayer3DMetadata {
export class Layer3DMetadata implements ILayer3DMetadata, IMetadataCommonModel {
//#region 3D SPECIFIC FIELDS
//#region 3D: type
@pycsw({
Expand Down Expand Up @@ -168,7 +154,7 @@ export class Layer3DMetadata implements ILayer3DMetadata {
isAutoGenerated: true,
})
//#endregion
public productVersion: number | undefined = undefined;
public productVersion: string | undefined = undefined;

//#region 3D: productType
@pycsw({
Expand Down Expand Up @@ -254,6 +240,32 @@ export class Layer3DMetadata implements ILayer3DMetadata {
//#endregion
public creationDate: Date | undefined = undefined;

//#region COMMON: updateDate
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:updateDateUTC',
queryableField: 'mc:updateDateUTC',
pycswField: 'pycsw:UpdateDate',
})
@catalogDB({
column: {
name: 'update_date',
type: 'timestamp without time zone',
},
})
@tsTypes({
mappingType: TsTypes.DATE,
})
@graphql({
nullable: true,
})
@fieldConfig({
category: FieldCategory.MAIN,
isAutoGenerated: true,
})
//#endregion
public updateDate: Date | undefined = undefined;

//#region 3D: sourceDateStart
@pycsw({
profile: 'mc3d',
Expand Down Expand Up @@ -628,7 +640,7 @@ export class Layer3DMetadata implements ILayer3DMetadata {
//#endregion
public visualAccuracy: number | undefined = undefined;

//#region 3D: sensors
//#region 3D: sensorsType
@pycsw({
profile: 'mc3d',
xmlElement: 'mc:sensors',
Expand Down Expand Up @@ -661,7 +673,7 @@ export class Layer3DMetadata implements ILayer3DMetadata {
],
})
//#endregion
public sensors: SensorType[] | undefined = undefined;
public sensorType: SensorType[] | undefined = undefined;

//#region 3D: footprint
@pycsw({
Expand Down Expand Up @@ -772,7 +784,7 @@ export class Layer3DMetadata implements ILayer3DMetadata {
category: FieldCategory.GEO_INFO,
})
//#endregion
public srsId: number | undefined = undefined;
public srsId: string | undefined = undefined;

//#region 3D: srsName
@pycsw({
Expand Down
10 changes: 3 additions & 7 deletions src/models/layerMetadata/layerMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import { getTsTypesMapping, ITsTypesMapping, tsTypes, TsTypes } from './decorato
import { ProductType, SensorType } from './enums';

export interface ILayerMetadata {
productId: string | undefined;
productVersion: string | undefined;
productType: ProductType | undefined;
resolution: number | undefined;
srsName: string | undefined;
rms: number | undefined;
scale: string | undefined;
includedInBests: string[] | undefined;
creationDate: Date | undefined;
ingestionDate: Date | undefined;
accuracyCE90: number | undefined;
}
export interface IPropSHPMapping extends IDataMapping, ITsTypesMapping {
prop: string;
Expand Down Expand Up @@ -251,10 +251,6 @@ export class LayerMetadata implements ILayerMetadata, IMetadataCommonModel {
@graphql({
nullable: true,
})
@fieldConfig({
category: FieldCategory.GENERAL,
isAutoGenerated: true,
})
//#endregion
public ingestionDate: Date | undefined = undefined;

Expand Down
10 changes: 10 additions & 0 deletions src/models/layerMetadata/pycswBestCatalogRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ export class PycswBestCatalogRecord extends BestMetadata implements IPycswCoreMo
public anyText: string | undefined = undefined;

//#region CORE: insertDate
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:insertDate',
queryableField: 'mc:insertDate',
pycswField: 'pycsw:InsertDate',
})
@catalogDB({
column: {
name: 'insert_date',
Expand All @@ -123,6 +129,10 @@ export class PycswBestCatalogRecord extends BestMetadata implements IPycswCoreMo
@graphql({
nullable: true,
})
@fieldConfig({
category: FieldCategory.GENERAL,
isAutoGenerated: true,
})
//#endregion
public insertDate: Date | undefined = undefined;

Expand Down
10 changes: 10 additions & 0 deletions src/models/layerMetadata/pycswLayerCatalogRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ export class PycswLayerCatalogRecord extends LayerMetadata implements IPycswCore
public anyText: string | undefined = undefined;

//#region CORE: insertDate
@pycsw({
profile: 'mc_raster',
xmlElement: 'mc:insertDate',
queryableField: 'mc:insertDate',
pycswField: 'pycsw:InsertDate',
})
@catalogDB({
column: {
name: 'insert_date',
Expand All @@ -122,6 +128,10 @@ export class PycswLayerCatalogRecord extends LayerMetadata implements IPycswCore
@graphql({
nullable: true,
})
@fieldConfig({
category: FieldCategory.GENERAL,
isAutoGenerated: true,
})
//#endregion
public insertDate: Date | undefined = undefined;

Expand Down

0 comments on commit 5159300

Please sign in to comment.