Skip to content

Commit

Permalink
Merge pull request #50 from statisticsnorway/feat/change-type-for-dat…
Browse files Browse the repository at this point in the history
…asource

Change type for datasource
  • Loading branch information
Jorgen-5 authored Apr 23, 2024
2 parents 87810f5 + 195cfa2 commit bbb2726
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ public class Dataset implements Serializable
@NotNull
private List<Object> description = new ArrayList<Object>();
/**
* Reusableb langugage string type
* Data source
* <p>
* Data source. Set either for the data set or instance variable.
*
*/
@JsonProperty("data_source")
@Valid
private List<Object> dataSource = new ArrayList<Object>();
@JsonPropertyDescription("Data source. Set either for the data set or instance variable.")
private String dataSource;
/**
* Reusableb langugage string type
* (Required)
Expand Down Expand Up @@ -335,7 +337,7 @@ public class Dataset implements Serializable
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = 3214435550238803228L;
private final static long serialVersionUID = -226168508644193475L;

/**
* No args constructor for use in serialization
Expand Down Expand Up @@ -403,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<Object> name, List<Object> description, List<Object> dataSource, List<Object> populationDescription, String version, List<Object> versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List<String> keyword, List<Object> spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List<CustomType> 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<Object> name, List<Object> description, String dataSource, List<Object> populationDescription, String version, List<Object> versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List<String> keyword, List<Object> spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List<CustomType> 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;
Expand Down Expand Up @@ -576,20 +578,24 @@ public void setDescription(List<Object> description) {
}

/**
* Reusableb langugage string type
* Data source
* <p>
* Data source. Set either for the data set or instance variable.
*
*/
@JsonProperty("data_source")
public List<Object> getDataSource() {
public String getDataSource() {
return dataSource;
}

/**
* Reusableb langugage string type
* Data source
* <p>
* Data source. Set either for the data set or instance variable.
*
*/
@JsonProperty("data_source")
public void setDataSource(List<Object> dataSource) {
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}

Expand Down Expand Up @@ -1305,7 +1311,7 @@ public DatasetBuilder() {
super();
}

public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List<Object> name, List<Object> description, List<Object> dataSource, List<Object> populationDescription, String version, List<Object> versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List<String> keyword, List<Object> spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List<CustomType> 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<Object> name, List<Object> description, String dataSource, List<Object> populationDescription, String version, List<Object> versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List<String> keyword, List<Object> spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List<CustomType> 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);
}

Expand All @@ -1324,7 +1330,7 @@ public DatasetBuilderBase() {
}

@SuppressWarnings("unchecked")
public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, List<Object> name, List<Object> description, List<Object> dataSource, List<Object> populationDescription, String version, List<Object> versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List<String> keyword, List<Object> spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List<CustomType> 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<Object> name, List<Object> description, String dataSource, List<Object> populationDescription, String version, List<Object> versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, String subjectField, List<String> keyword, List<Object> spatialCoverageDescription, Boolean containsPersonalData, Dataset.UseRestriction useRestriction, Date useRestrictionDate, List<CustomType> 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));
Expand Down Expand Up @@ -1368,7 +1374,7 @@ public Dataset.DatasetBuilderBase withDescription(List<Object> description) {
return this;
}

public Dataset.DatasetBuilderBase withDataSource(List<Object> dataSource) {
public Dataset.DatasetBuilderBase withDataSource(String dataSource) {
((Dataset) this.instance).dataSource = dataSource;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@ public class Variable implements Serializable
@NotNull
private Boolean directPersonIdentifying;
/**
* Reusableb langugage string type
* Data source
* <p>
* Data source. Set at data set level, but can be overwritten at variable instance level.
*
*/
@JsonProperty("data_source")
@Valid
private List<Object> dataSource = new ArrayList<Object>();
@JsonPropertyDescription("Data source. Set at data set level, but can be overwritten at variable instance level.")
private String dataSource;
/**
* Reusableb langugage string type
*
Expand Down Expand Up @@ -243,7 +245,7 @@ public class Variable implements Serializable
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = 1019444275429139130L;
private final static long serialVersionUID = 2841624760609543476L;

/**
* No args constructor for use in serialization
Expand Down Expand Up @@ -297,7 +299,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<Object> name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, List<Object> dataSource, List<Object> populationDescription, List<Object> comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List<Object> invalidValueDescription, List<CustomType__1> customType, UUID id, Date containsDataFrom, Date containsDataUntil) {
public Variable(String shortName, String dataElementPath, List<Object> name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List<Object> populationDescription, List<Object> comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List<Object> invalidValueDescription, List<CustomType__1> customType, UUID id, Date containsDataFrom, Date containsDataUntil) {
super();
this.shortName = shortName;
this.dataElementPath = dataElementPath;
Expand Down Expand Up @@ -487,20 +489,24 @@ public void setDirectPersonIdentifying(Boolean directPersonIdentifying) {
}

/**
* Reusableb langugage string type
* Data source
* <p>
* Data source. Set at data set level, but can be overwritten at variable instance level.
*
*/
@JsonProperty("data_source")
public List<Object> getDataSource() {
public String getDataSource() {
return dataSource;
}

/**
* Reusableb langugage string type
* Data source
* <p>
* Data source. Set at data set level, but can be overwritten at variable instance level.
*
*/
@JsonProperty("data_source")
public void setDataSource(List<Object> dataSource) {
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}

Expand Down Expand Up @@ -986,7 +992,7 @@ public VariableBuilder() {
super();
}

public VariableBuilder(String shortName, String dataElementPath, List<Object> name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, List<Object> dataSource, List<Object> populationDescription, List<Object> comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List<Object> invalidValueDescription, List<CustomType__1> customType, UUID id, Date containsDataFrom, Date containsDataUntil) {
public VariableBuilder(String shortName, String dataElementPath, List<Object> name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List<Object> populationDescription, List<Object> comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List<Object> invalidValueDescription, List<CustomType__1> customType, UUID id, Date containsDataFrom, Date containsDataUntil) {
super(shortName, dataElementPath, name, dataType, variableRole, definitionUri, directPersonIdentifying, dataSource, populationDescription, comment, temporalityType, measurementUnit, multiplicationFactor, format, classificationUri, specialValue, invalidValueDescription, customType, id, containsDataFrom, containsDataUntil);
}

Expand All @@ -1005,7 +1011,7 @@ public VariableBuilderBase() {
}

@SuppressWarnings("unchecked")
public VariableBuilderBase(String shortName, String dataElementPath, List<Object> name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, List<Object> dataSource, List<Object> populationDescription, List<Object> comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List<Object> invalidValueDescription, List<CustomType__1> customType, UUID id, Date containsDataFrom, Date containsDataUntil) {
public VariableBuilderBase(String shortName, String dataElementPath, List<Object> name, Variable.DataType dataType, Variable.VariableRole variableRole, URI definitionUri, Boolean directPersonIdentifying, String dataSource, List<Object> populationDescription, List<Object> comment, no.ssb.dapla.metadata.datadoc.Dataset.TemporalityTypeType temporalityType, String measurementUnit, Integer multiplicationFactor, String format, URI classificationUri, SpecialValues specialValue, List<Object> invalidValueDescription, List<CustomType__1> customType, UUID id, Date containsDataFrom, Date 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));
Expand Down Expand Up @@ -1054,7 +1060,7 @@ public Variable.VariableBuilderBase withDirectPersonIdentifying(Boolean directPe
return this;
}

public Variable.VariableBuilderBase withDataSource(List<Object> dataSource) {
public Variable.VariableBuilderBase withDataSource(String dataSource) {
((Variable) this.instance).dataSource = dataSource;
return this;
}
Expand Down
10 changes: 5 additions & 5 deletions generated/python/datadoc_model/datadoc_model/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: metadata-container-json-schema.json
# timestamp: 2024-03-13T15:13:32+00:00
# timestamp: 2024-04-23T13:18:29+00:00

from __future__ import annotations

Expand Down Expand Up @@ -208,7 +208,7 @@ class Dataset(DatadocBaseModel):
description: Optional[LanguageStringType] = Field(
None, description="Free text description of the data set", title="Description"
)
data_source: Optional[LanguageStringType] = Field(
data_source: Optional[str] = Field(
None,
description="Data source. Set either for the data set or instance variable.",
title="Data source",
Expand Down Expand Up @@ -368,7 +368,7 @@ class Variable(DatadocBaseModel):
description="Direct Person identifying Information (DPI). Some of the values \u200b\u200bin an instance variable kan be DPI, others not. In this case, DPI is set equal to true. For example, the variable exporter where some of the values \u200b\u200bcan be organization number, others social security numbers (sole proprietorships).",
title="Direct Person identifying Information (DPI)",
)
data_source: Optional[LanguageStringType] = Field(
data_source: Optional[str] = Field(
None,
description="Data source. Set at data set level, but can be overwritten at variable instance level.",
title="Data source",
Expand Down Expand Up @@ -438,8 +438,8 @@ class DatadocMetadata(DatadocBaseModel):
percentage_complete: Optional[int] = Field(
None, description="Percentage of obligatory metadata fields populated."
)
document_version: Literal["3.1.0"] = Field(
"3.1.0", description="Version of this model"
document_version: Literal["3.2.0"] = Field(
"3.2.0", description="Version of this model"
)
dataset: Optional[Dataset] = None
variables: Optional[list[Variable]] = None
Expand Down
2 changes: 1 addition & 1 deletion generated/python/datadoc_model/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ssb-datadoc-model"
version = "5.1.0"
version = "5.2.0"
description = "Data Model for use in Statistics Norway's Metadata system"
authors = ["Statistics Norway <[email protected]>"]
license = "MIT"
Expand Down
6 changes: 3 additions & 3 deletions src/datadoc/datadoc-json-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"document_version": {
"description": "Version of this model",
"const": "3.1.0"
"const": "3.2.0"
},
"dataset": {
"type": "object",
Expand Down Expand Up @@ -67,7 +67,7 @@
"data_source": {
"title": "Data source",
"description": "Data source. Set either for the data set or instance variable.",
"$ref": "./languageStringType.json#/languageStringType"
"type": "string"
},
"population_description": {
"title": "Description of population",
Expand Down Expand Up @@ -294,7 +294,7 @@
"data_source": {
"title": "Data source",
"description": "Data source. Set at data set level, but can be overwritten at variable instance level.",
"$ref": "./languageStringType.json#/languageStringType"
"type": "string"
},
"population_description": {
"title": "Population description",
Expand Down

0 comments on commit bbb2726

Please sign in to comment.