From 340185e963d8c89b1486b4217dbb3a8b0d1c0b6a Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:41:46 +0200 Subject: [PATCH 1/9] Specify date-time format for contains_data_* fields --- src/datadoc/datadoc-json-schema.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index 7063ebe..63c25d8 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -205,12 +205,14 @@ "contains_data_from": { "title": "Contains data from", "description": "The data set contains data from date/time", - "type": "string" + "type": "string", + "format": "date-time" }, "contains_data_until": { "title": "Contains data up until", "description": "The data set contains data up until date/time", - "type": "string" + "type": "string", + "format": "date-time" } }, "required": [ From 3b7d4dac811cd43d16a3328f11f8b40c006aca82 Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:22:23 +0000 Subject: [PATCH 2/9] [GENERATE] Java classes from JSON Schema --- .../ssb/dapla/metadata/datadoc/Dataset.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java index dadbdb6..af25e3f 100644 --- a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java +++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java @@ -324,7 +324,7 @@ public class Dataset implements Serializable */ @JsonProperty("contains_data_from") @JsonPropertyDescription("The data set contains data from date/time") - private String containsDataFrom; + private Date containsDataFrom; /** * Contains data up until *

@@ -333,11 +333,11 @@ public class Dataset implements Serializable */ @JsonProperty("contains_data_until") @JsonPropertyDescription("The data set contains data up until date/time") - private String containsDataUntil; + private Date containsDataUntil; @JsonIgnore @Valid private Map additionalProperties = new LinkedHashMap(); - private final static long serialVersionUID = -226168508644193475L; + private final static long serialVersionUID = 3893292763053544510L; /** * No args constructor for use in serialization @@ -405,7 +405,7 @@ public Dataset() { * @param dataSource * Data source. Data source. Set either for the data set or instance variable. */ - public Dataset(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { + public Dataset(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, Date containsDataFrom, Date containsDataUntil) { super(); this.shortName = shortName; this.assessment = assessment; @@ -1032,7 +1032,7 @@ public void setMetadataLastUpdatedBy(String metadataLastUpdatedBy) { * */ @JsonProperty("contains_data_from") - public String getContainsDataFrom() { + public Date getContainsDataFrom() { return containsDataFrom; } @@ -1043,7 +1043,7 @@ public String getContainsDataFrom() { * */ @JsonProperty("contains_data_from") - public void setContainsDataFrom(String containsDataFrom) { + public void setContainsDataFrom(Date containsDataFrom) { this.containsDataFrom = containsDataFrom; } @@ -1054,7 +1054,7 @@ public void setContainsDataFrom(String containsDataFrom) { * */ @JsonProperty("contains_data_until") - public String getContainsDataUntil() { + public Date getContainsDataUntil() { return containsDataUntil; } @@ -1065,7 +1065,7 @@ public String getContainsDataUntil() { * */ @JsonProperty("contains_data_until") - public void setContainsDataUntil(String containsDataUntil) { + public void setContainsDataUntil(Date containsDataUntil) { this.containsDataUntil = containsDataUntil; } @@ -1311,7 +1311,7 @@ public DatasetBuilder() { super(); } - public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { + public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, Date containsDataFrom, Date containsDataUntil) { super(shortName, assessment, datasetStatus, datasetState, name, description, dataSource, populationDescription, version, versionDescription, unitType, temporalityType, subjectField, keyword, spatialCoverageDescription, containsPersonalData, useRestriction, useRestrictionDate, customType, id, owner, filePath, metadataCreatedDate, metadataCreatedBy, metadataLastUpdatedDate, metadataLastUpdatedBy, containsDataFrom, containsDataUntil); } @@ -1330,7 +1330,7 @@ public DatasetBuilderBase() { } @SuppressWarnings("unchecked") - public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { + public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, Date containsDataFrom, Date containsDataUntil) { // Skip initialization when called from subclass if (this.getClass().equals(Dataset.DatasetBuilder.class)) { this.instance = ((T) new Dataset(shortName, assessment, datasetStatus, datasetState, name, description, dataSource, populationDescription, version, versionDescription, unitType, temporalityType, subjectField, keyword, spatialCoverageDescription, containsPersonalData, useRestriction, useRestrictionDate, customType, id, owner, filePath, metadataCreatedDate, metadataCreatedBy, metadataLastUpdatedDate, metadataLastUpdatedBy, containsDataFrom, containsDataUntil)); @@ -1474,12 +1474,12 @@ public Dataset.DatasetBuilderBase withMetadataLastUpdatedBy(String metadataLastU return this; } - public Dataset.DatasetBuilderBase withContainsDataFrom(String containsDataFrom) { + public Dataset.DatasetBuilderBase withContainsDataFrom(Date containsDataFrom) { ((Dataset) this.instance).containsDataFrom = containsDataFrom; return this; } - public Dataset.DatasetBuilderBase withContainsDataUntil(String containsDataUntil) { + public Dataset.DatasetBuilderBase withContainsDataUntil(Date containsDataUntil) { ((Dataset) this.instance).containsDataUntil = containsDataUntil; return this; } From 1d357048b10ed0b331fbab1ee40f5e7fbd186eef Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:22:55 +0000 Subject: [PATCH 3/9] [GENERATE] Pydantic models from JSON Schema --- generated/python/datadoc_model/datadoc_model/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index 4ffaa30..c5b9d37 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -# timestamp: 2024-04-23T13:18:29+00:00 +# timestamp: 2024-04-25T13:22:55+00:00 from __future__ import annotations @@ -300,12 +300,12 @@ class Dataset(DatadocBaseModel): description="Last change made by identifiable person. ", title="Metadata last updated by", ) - contains_data_from: Optional[str] = Field( + contains_data_from: Optional[AwareDatetime] = Field( None, description="The data set contains data from date/time", title="Contains data from", ) - contains_data_until: Optional[str] = Field( + contains_data_until: Optional[AwareDatetime] = Field( None, description="The data set contains data up until date/time", title="Contains data up until", From 6d67c8648da4a8ac2f3a3ddc913e09e04f79acc3 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:23:52 +0200 Subject: [PATCH 4/9] Specify date format for all contains_data_* fields --- src/datadoc/datadoc-json-schema.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index 63c25d8..a160c18 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -206,13 +206,13 @@ "title": "Contains data from", "description": "The data set contains data from date/time", "type": "string", - "format": "date-time" + "format": "date" }, "contains_data_until": { "title": "Contains data up until", "description": "The data set contains data up until date/time", "type": "string", - "format": "date-time" + "format": "date" } }, "required": [ @@ -440,13 +440,13 @@ "title": "Contains data from", "description": "The instance variable in the data set contains data from and including this date. This can be useful information for data sets that contain many instance variables in addition to data for many periods/years. In many cases, it will then be the case that some variables only contain data for the most recent periods/years, e.g. if the entire data set contains data from 1970 to 2020, while some instance variables only contain data from 1998 onwards.", "type": "string", - "format": "date-time" + "format": "date" }, "contains_data_until": { "title": "Contains data up until", "description": "The instance variable in the data set contains data up to and including this date. This can be useful information for data sets that contain many instance variables in addition to data for many periods/years. In many cases, it will then be the case that some of the instance variables in the data set are terminated (no longer updated) after a given point in time.", "type": "string", - "format": "date-time" + "format": "date" } }, "required": [ From 84a5cd169c5126bf75f2792776506d3770511d70 Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:24:36 +0000 Subject: [PATCH 5/9] [GENERATE] Pydantic models from JSON Schema --- generated/python/datadoc_model/datadoc_model/model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index c5b9d37..a055e5b 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,9 +1,10 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -# timestamp: 2024-04-25T13:22:55+00:00 +# timestamp: 2024-04-25T13:24:36+00:00 from __future__ import annotations +from datetime import date from enum import Enum from typing import Any, Literal, Optional, Union from uuid import UUID @@ -300,12 +301,12 @@ class Dataset(DatadocBaseModel): description="Last change made by identifiable person. ", title="Metadata last updated by", ) - contains_data_from: Optional[AwareDatetime] = Field( + contains_data_from: Optional[date] = Field( None, description="The data set contains data from date/time", title="Contains data from", ) - contains_data_until: Optional[AwareDatetime] = Field( + contains_data_until: Optional[date] = Field( None, description="The data set contains data up until date/time", title="Contains data up until", @@ -422,12 +423,12 @@ class Variable(DatadocBaseModel): description="Unique SSB identifier for the instance variable in the data set", title="Identifier", ) - contains_data_from: Optional[AwareDatetime] = Field( + contains_data_from: Optional[date] = Field( None, description="The instance variable in the data set contains data from and including this date. This can be useful information for data sets that contain many instance variables in addition to data for many periods/years. In many cases, it will then be the case that some variables only contain data for the most recent periods/years, e.g. if the entire data set contains data from 1970 to 2020, while some instance variables only contain data from 1998 onwards.", title="Contains data from", ) - contains_data_until: Optional[AwareDatetime] = Field( + contains_data_until: Optional[date] = Field( None, description="The instance variable in the data set contains data up to and including this date. This can be useful information for data sets that contain many instance variables in addition to data for many periods/years. In many cases, it will then be the case that some of the instance variables in the data set are terminated (no longer updated) after a given point in time.", title="Contains data up until", From a9f407de133d0e691a2204d1f245d03f0381145a Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:25:15 +0000 Subject: [PATCH 6/9] [GENERATE] Java classes from JSON Schema --- .../ssb/dapla/metadata/datadoc/Dataset.java | 24 +++++++++--------- .../ssb/dapla/metadata/datadoc/Variable.java | 25 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java index af25e3f..dadbdb6 100644 --- a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java +++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java @@ -324,7 +324,7 @@ public class Dataset implements Serializable */ @JsonProperty("contains_data_from") @JsonPropertyDescription("The data set contains data from date/time") - private Date containsDataFrom; + private String containsDataFrom; /** * Contains data up until *

@@ -333,11 +333,11 @@ public class Dataset implements Serializable */ @JsonProperty("contains_data_until") @JsonPropertyDescription("The data set contains data up until date/time") - private Date containsDataUntil; + private String containsDataUntil; @JsonIgnore @Valid private Map additionalProperties = new LinkedHashMap(); - private final static long serialVersionUID = 3893292763053544510L; + private final static long serialVersionUID = -226168508644193475L; /** * No args constructor for use in serialization @@ -405,7 +405,7 @@ public Dataset() { * @param dataSource * Data source. Data source. Set either for the data set or instance variable. */ - public Dataset(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, Date containsDataFrom, Date containsDataUntil) { + public Dataset(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { super(); this.shortName = shortName; this.assessment = assessment; @@ -1032,7 +1032,7 @@ public void setMetadataLastUpdatedBy(String metadataLastUpdatedBy) { * */ @JsonProperty("contains_data_from") - public Date getContainsDataFrom() { + public String getContainsDataFrom() { return containsDataFrom; } @@ -1043,7 +1043,7 @@ public Date getContainsDataFrom() { * */ @JsonProperty("contains_data_from") - public void setContainsDataFrom(Date containsDataFrom) { + public void setContainsDataFrom(String containsDataFrom) { this.containsDataFrom = containsDataFrom; } @@ -1054,7 +1054,7 @@ public void setContainsDataFrom(Date containsDataFrom) { * */ @JsonProperty("contains_data_until") - public Date getContainsDataUntil() { + public String getContainsDataUntil() { return containsDataUntil; } @@ -1065,7 +1065,7 @@ public Date getContainsDataUntil() { * */ @JsonProperty("contains_data_until") - public void setContainsDataUntil(Date containsDataUntil) { + public void setContainsDataUntil(String containsDataUntil) { this.containsDataUntil = containsDataUntil; } @@ -1311,7 +1311,7 @@ public DatasetBuilder() { super(); } - public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, Date containsDataFrom, Date containsDataUntil) { + public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { super(shortName, assessment, datasetStatus, datasetState, name, description, dataSource, populationDescription, version, versionDescription, unitType, temporalityType, subjectField, keyword, spatialCoverageDescription, containsPersonalData, useRestriction, useRestrictionDate, customType, id, owner, filePath, metadataCreatedDate, metadataCreatedBy, metadataLastUpdatedDate, metadataLastUpdatedBy, containsDataFrom, containsDataUntil); } @@ -1330,7 +1330,7 @@ public DatasetBuilderBase() { } @SuppressWarnings("unchecked") - public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, Date containsDataFrom, Date containsDataUntil) { + public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List name, List description, String dataSource, List populationDescription, String version, List versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List keyword, List spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List customType, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { // Skip initialization when called from subclass if (this.getClass().equals(Dataset.DatasetBuilder.class)) { this.instance = ((T) new Dataset(shortName, assessment, datasetStatus, datasetState, name, description, dataSource, populationDescription, version, versionDescription, unitType, temporalityType, subjectField, keyword, spatialCoverageDescription, containsPersonalData, useRestriction, useRestrictionDate, customType, id, owner, filePath, metadataCreatedDate, metadataCreatedBy, metadataLastUpdatedDate, metadataLastUpdatedBy, containsDataFrom, containsDataUntil)); @@ -1474,12 +1474,12 @@ public Dataset.DatasetBuilderBase withMetadataLastUpdatedBy(String metadataLastU return this; } - public Dataset.DatasetBuilderBase withContainsDataFrom(Date containsDataFrom) { + public Dataset.DatasetBuilderBase withContainsDataFrom(String containsDataFrom) { ((Dataset) this.instance).containsDataFrom = containsDataFrom; return this; } - public Dataset.DatasetBuilderBase withContainsDataUntil(Date containsDataUntil) { + public Dataset.DatasetBuilderBase withContainsDataUntil(String containsDataUntil) { ((Dataset) this.instance).containsDataUntil = containsDataUntil; return this; } diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Variable.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Variable.java index cb54bdd..5d0d582 100644 --- a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Variable.java +++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Variable.java @@ -4,7 +4,6 @@ import java.io.Serializable; import java.net.URI; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -232,7 +231,7 @@ public class Variable implements Serializable */ @JsonProperty("contains_data_from") @JsonPropertyDescription("The instance variable in the data set contains data from and including this date. This can be useful information for data sets that contain many instance variables in addition to data for many periods/years. In many cases, it will then be the case that some variables only contain data for the most recent periods/years, e.g. if the entire data set contains data from 1970 to 2020, while some instance variables only contain data from 1998 onwards.") - private Date containsDataFrom; + private String containsDataFrom; /** * Contains data up until *

@@ -241,11 +240,11 @@ public class Variable implements Serializable */ @JsonProperty("contains_data_until") @JsonPropertyDescription("The instance variable in the data set contains data up to and including this date. This can be useful information for data sets that contain many instance variables in addition to data for many periods/years. In many cases, it will then be the case that some of the instance variables in the data set are terminated (no longer updated) after a given point in time.") - private Date containsDataUntil; + private String containsDataUntil; @JsonIgnore @Valid private Map additionalProperties = new LinkedHashMap(); - private final static long serialVersionUID = 2841624760609543476L; + private final static long serialVersionUID = 1640768487711195113L; /** * No args constructor for use in serialization @@ -299,7 +298,7 @@ public Variable() { * @param invalidValueDescription * Invalid value(s) description. Invalid value(s) description used in addition (or as an alternative) to standard sentinel values. */ - public Variable(String shortName, String dataElementPath, List name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List populationDescription, List comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List invalidValueDescription, List customType, UUID id, Date containsDataFrom, Date containsDataUntil) { + public Variable(String shortName, String dataElementPath, List name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List populationDescription, List comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List invalidValueDescription, List customType, UUID id, String containsDataFrom, String containsDataUntil) { super(); this.shortName = shortName; this.dataElementPath = dataElementPath; @@ -745,7 +744,7 @@ public void setId(UUID id) { * */ @JsonProperty("contains_data_from") - public Date getContainsDataFrom() { + public String getContainsDataFrom() { return containsDataFrom; } @@ -756,7 +755,7 @@ public Date getContainsDataFrom() { * */ @JsonProperty("contains_data_from") - public void setContainsDataFrom(Date containsDataFrom) { + public void setContainsDataFrom(String containsDataFrom) { this.containsDataFrom = containsDataFrom; } @@ -767,7 +766,7 @@ public void setContainsDataFrom(Date containsDataFrom) { * */ @JsonProperty("contains_data_until") - public Date getContainsDataUntil() { + public String getContainsDataUntil() { return containsDataUntil; } @@ -778,7 +777,7 @@ public Date getContainsDataUntil() { * */ @JsonProperty("contains_data_until") - public void setContainsDataUntil(Date containsDataUntil) { + public void setContainsDataUntil(String containsDataUntil) { this.containsDataUntil = containsDataUntil; } @@ -992,7 +991,7 @@ public VariableBuilder() { super(); } - public VariableBuilder(String shortName, String dataElementPath, List name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List populationDescription, List comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List invalidValueDescription, List customType, UUID id, Date containsDataFrom, Date containsDataUntil) { + public VariableBuilder(String shortName, String dataElementPath, List name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List populationDescription, List comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List invalidValueDescription, List customType, UUID id, String containsDataFrom, String containsDataUntil) { super(shortName, dataElementPath, name, dataType, variableRole, definitionUri, directPersonIdentifying, dataSource, populationDescription, comment, temporalityType, measurementUnit, multiplicationFactor, format, classificationUri, specialValue, invalidValueDescription, customType, id, containsDataFrom, containsDataUntil); } @@ -1011,7 +1010,7 @@ public VariableBuilderBase() { } @SuppressWarnings("unchecked") - public VariableBuilderBase(String shortName, String dataElementPath, List name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List populationDescription, List comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List invalidValueDescription, List customType, UUID id, Date containsDataFrom, Date containsDataUntil) { + public VariableBuilderBase(String shortName, String dataElementPath, List name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List populationDescription, List comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List invalidValueDescription, List customType, UUID id, String containsDataFrom, String containsDataUntil) { // Skip initialization when called from subclass if (this.getClass().equals(Variable.VariableBuilder.class)) { this.instance = ((T) new Variable(shortName, dataElementPath, name, dataType, variableRole, definitionUri, directPersonIdentifying, dataSource, populationDescription, comment, temporalityType, measurementUnit, multiplicationFactor, format, classificationUri, specialValue, invalidValueDescription, customType, id, containsDataFrom, containsDataUntil)); @@ -1120,12 +1119,12 @@ public Variable.VariableBuilderBase withId(UUID id) { return this; } - public Variable.VariableBuilderBase withContainsDataFrom(Date containsDataFrom) { + public Variable.VariableBuilderBase withContainsDataFrom(String containsDataFrom) { ((Variable) this.instance).containsDataFrom = containsDataFrom; return this; } - public Variable.VariableBuilderBase withContainsDataUntil(Date containsDataUntil) { + public Variable.VariableBuilderBase withContainsDataUntil(String containsDataUntil) { ((Variable) this.instance).containsDataUntil = containsDataUntil; return this; } From 1b6be5fd307cb8bdf0fd32ea281b803094ee3e99 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:27:55 +0200 Subject: [PATCH 7/9] Bump document version --- src/datadoc/datadoc-json-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index a160c18..073f09b 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -10,7 +10,7 @@ }, "document_version": { "description": "Version of this model", - "const": "3.2.0" + "const": "3.3.0" }, "dataset": { "type": "object", From 4eb1de3a016f08bb375800b678009fecb421e75c Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:28:21 +0200 Subject: [PATCH 8/9] Bump version of datadoc model --- generated/python/datadoc_model/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/python/datadoc_model/pyproject.toml b/generated/python/datadoc_model/pyproject.toml index a1db1fa..a6c7d91 100644 --- a/generated/python/datadoc_model/pyproject.toml +++ b/generated/python/datadoc_model/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ssb-datadoc-model" -version = "5.2.0" +version = "5.3.0" description = "Data Model for use in Statistics Norway's Metadata system" authors = ["Statistics Norway "] license = "MIT" From 9bb42ce97edf0d40cb1ab26f636a482ea575c1a1 Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:29:06 +0000 Subject: [PATCH 9/9] [GENERATE] Pydantic models from JSON Schema --- generated/python/datadoc_model/datadoc_model/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index a055e5b..69f2681 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -# timestamp: 2024-04-25T13:24:36+00:00 +# timestamp: 2024-04-25T13:29:06+00:00 from __future__ import annotations @@ -439,8 +439,8 @@ class DatadocMetadata(DatadocBaseModel): percentage_complete: Optional[int] = Field( None, description="Percentage of obligatory metadata fields populated." ) - document_version: Literal["3.2.0"] = Field( - "3.2.0", description="Version of this model" + document_version: Literal["3.3.0"] = Field( + "3.3.0", description="Version of this model" ) dataset: Optional[Dataset] = None variables: Optional[list[Variable]] = None