From 7b74deb84380c9b24a967141ebb7ac4c0f4741a8 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:35:22 +0100 Subject: [PATCH] Add data_element_pattern field (#27) * Add data_element_pattern field * [GENERATE] Java classes from JSON Schema * [GENERATE] Pydantic models from JSON Schema --------- Co-authored-by: dapla-bot[bot] <143391972+dapla-bot[bot]@users.noreply.github.com> --- .../no/ssb/dapla/metadata/PseudoVariable.java | 303 ++++++++++++------ .../datadoc_model/datadoc_model/model.py | 11 +- .../pseudonymization-json-schema.json | 10 +- 3 files changed, 224 insertions(+), 100 deletions(-) diff --git a/generated/java/datadoc-model/src/no/ssb/dapla/metadata/PseudoVariable.java b/generated/java/datadoc-model/src/no/ssb/dapla/metadata/PseudoVariable.java index 6cc31b3d..6bf01a45 100644 --- a/generated/java/datadoc-model/src/no/ssb/dapla/metadata/PseudoVariable.java +++ b/generated/java/datadoc-model/src/no/ssb/dapla/metadata/PseudoVariable.java @@ -20,33 +20,34 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonValue; - /** * A pseudonymized variable in the dataset. - * + * */ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "short_name", - "data_element_path", - "stable_identifier_type", - "stable_identifier_version", - "encryption_algorithm", - "encryption_key_reference", - "encryption_algorithm_parameters", - "source_variable", - "source_variable_datatype" + "short_name", + "data_element_path", + "data_element_pattern", + "stable_identifier_type", + "stable_identifier_version", + "encryption_algorithm", + "encryption_key_reference", + "encryption_algorithm_parameters", + "source_variable", + "source_variable_datatype" }) @Generated("jsonschema2pojo") -public class PseudoVariable implements Serializable -{ +public class PseudoVariable implements Serializable { /** * Short name *
- * Physical name of the variable in the dataset. Should match the recommended short name. Alphanumeric. Limited to a-z, A-Z, 0-9, - (hyphen) and _ (underscore) + * Physical name of the variable in the dataset. Should match the recommended + * short name. Alphanumeric. Limited to a-z, A-Z, 0-9, - (hyphen) and _ + * (underscore) * (Required) - * + * */ @JsonProperty("short_name") @JsonPropertyDescription("Physical name of the variable in the dataset. Should match the recommended short name.") @@ -55,17 +56,30 @@ public class PseudoVariable implements Serializable /** * Data element path *
- * Path to one or multiple data element(s) in the dataset.Only for use in heirarchical datasets. Use JsonPath dot-notation to specify the path. - * + * Path to a single, concrete data element in the dataset.Only for use in + * heirarchical datasets. Use JsonPath dot-notation to specify the path. + * */ @JsonProperty("data_element_path") - @JsonPropertyDescription("Path to one or multiple data element(s) in the dataset.") + @JsonPropertyDescription("Path to a single, concrete data element in the dataset.") private String dataElementPath; + /** + * Data element pattern + *
+ * Pattern which matched this variable (if a pattern was used).Typically a glob + * pattern. + * + */ + @JsonProperty("data_element_pattern") + @JsonPropertyDescription("Pattern which matched this variable (if a pattern was used).") + private String dataElementPattern; /** * Stable identifier type *
- * Type of stable identifier the variable was mapped to prior to pseudonymization.Only relevant when the variable is mapped to a stable identifier. - * + * Type of stable identifier the variable was mapped to prior to + * pseudonymization.Only relevant when the variable is mapped to a stable + * identifier. + * */ @JsonProperty("stable_identifier_type") @JsonPropertyDescription("Type of stable identifier the variable was mapped to prior to pseudonymization.") @@ -73,8 +87,10 @@ public class PseudoVariable implements Serializable /** * Stable identifier version *
- * Version of stable identifier the variable was mapped to prior to pseudonymization.Only relevant when the variable is mapped to a stable identifier. - * + * Version of stable identifier the variable was mapped to prior to + * pseudonymization.Only relevant when the variable is mapped to a stable + * identifier. + * */ @JsonProperty("stable_identifier_version") @JsonPropertyDescription("Version of stable identifier the variable was mapped to prior to pseudonymization.") @@ -84,7 +100,7 @@ public class PseudoVariable implements Serializable *
* The encryption algorithm used to pseudonymize the variable. * (Required) - * + * */ @JsonProperty("encryption_algorithm") @JsonPropertyDescription("The encryption algorithm used to pseudonymize the variable.") @@ -95,7 +111,7 @@ public class PseudoVariable implements Serializable *
* Name of or reference to the encryption key used to pseudonymize the variable. * (Required) - * + * */ @JsonProperty("encryption_key_reference") @JsonPropertyDescription("Name of or reference to the encryption key used to pseudonymize the variable.") @@ -105,7 +121,7 @@ public class PseudoVariable implements Serializable * Encryption algorithm parameters *
* Parameters supplied to the encryption algorithm. - * + * */ @JsonProperty("encryption_algorithm_parameters") @JsonPropertyDescription("Parameters supplied to the encryption algorithm.") @@ -114,8 +130,9 @@ public class PseudoVariable implements Serializable /** * Source variable *
- * Short name of the source variable Only relevant when this differs from the short name of the variable. - * + * Short name of the source variable Only relevant when this differs from the + * short name of the variable. + * */ @JsonProperty("source_variable") @JsonPropertyDescription("Short name of the source variable") @@ -124,7 +141,7 @@ public class PseudoVariable implements Serializable * Source variable data type *
* Data type of the variable prior to pseudonymization.
- *
+ *
*/
@JsonProperty("source_variable_datatype")
@JsonPropertyDescription("Data type of the variable prior to pseudonymization.")
@@ -136,36 +153,59 @@ public class PseudoVariable implements Serializable
/**
* No args constructor for use in serialization
- *
+ *
*/
public PseudoVariable() {
}
/**
- *
+ *
* @param stableIdentifierType
- * Stable identifier type. Type of stable identifier the variable was mapped to prior to pseudonymization.
+ * Stable identifier type. Type of stable
+ * identifier the variable was mapped to
+ * prior to pseudonymization.
* @param encryptionKeyReference
- * Encryption key reference. Name of or reference to the encryption key used to pseudonymize the variable.
+ * Encryption key reference. Name of or
+ * reference to the encryption key used to
+ * pseudonymize the variable.
* @param dataElementPath
- * Data element path. Path to one or multiple data element(s) in the dataset.
+ * Data element path. Path to a single,
+ * concrete data element in the dataset.
* @param sourceVariable
- * Source variable. Short name of the source variable.
+ * Source variable. Short name of the
+ * source variable.
* @param sourceVariableDatatype
- * Source variable data type. Data type of the variable prior to pseudonymization.
+ * Source variable data type. Data type of
+ * the variable prior to pseudonymization.
* @param encryptionAlgorithmParameters
- * Encryption algorithm parameters. Parameters supplied to the encryption algorithm.
+ * Encryption algorithm parameters.
+ * Parameters supplied to the encryption
+ * algorithm.
+ * @param dataElementPattern
+ * Data element pattern. Pattern which
+ * matched this variable (if a pattern was
+ * used).
* @param stableIdentifierVersion
- * Stable identifier version. Version of stable identifier the variable was mapped to prior to pseudonymization.
+ * Stable identifier version. Version of
+ * stable identifier the variable was
+ * mapped to prior to pseudonymization.
* @param shortName
- * Short name. Physical name of the variable in the dataset. Should match the recommended short name.
+ * Short name. Physical name of the
+ * variable in the dataset. Should match
+ * the recommended short name.
* @param encryptionAlgorithm
- * Encryption algorithm. The encryption algorithm used to pseudonymize the variable.
+ * Encryption algorithm. The encryption
+ * algorithm used to pseudonymize the
+ * variable.
*/
- public PseudoVariable(String shortName, String dataElementPath, String stableIdentifierType, String stableIdentifierVersion, String encryptionAlgorithm, String encryptionKeyReference, List
- * Physical name of the variable in the dataset. Should match the recommended short name. Alphanumeric. Limited to a-z, A-Z, 0-9, - (hyphen) and _ (underscore)
+ * Physical name of the variable in the dataset. Should match the recommended
+ * short name. Alphanumeric. Limited to a-z, A-Z, 0-9, - (hyphen) and _
+ * (underscore)
* (Required)
- *
+ *
*/
@JsonProperty("short_name")
public String getShortName() {
@@ -190,9 +232,11 @@ public String getShortName() {
/**
* Short name
*
- * Physical name of the variable in the dataset. Should match the recommended short name. Alphanumeric. Limited to a-z, A-Z, 0-9, - (hyphen) and _ (underscore)
+ * Physical name of the variable in the dataset. Should match the recommended
+ * short name. Alphanumeric. Limited to a-z, A-Z, 0-9, - (hyphen) and _
+ * (underscore)
* (Required)
- *
+ *
*/
@JsonProperty("short_name")
public void setShortName(String shortName) {
@@ -202,8 +246,9 @@ public void setShortName(String shortName) {
/**
* Data element path
*
- * Path to one or multiple data element(s) in the dataset.Only for use in heirarchical datasets. Use JsonPath dot-notation to specify the path.
- *
+ * Path to a single, concrete data element in the dataset.Only for use in
+ * heirarchical datasets. Use JsonPath dot-notation to specify the path.
+ *
*/
@JsonProperty("data_element_path")
public String getDataElementPath() {
@@ -213,19 +258,46 @@ public String getDataElementPath() {
/**
* Data element path
*
- * Path to one or multiple data element(s) in the dataset.Only for use in heirarchical datasets. Use JsonPath dot-notation to specify the path.
- *
+ * Path to a single, concrete data element in the dataset.Only for use in
+ * heirarchical datasets. Use JsonPath dot-notation to specify the path.
+ *
*/
@JsonProperty("data_element_path")
public void setDataElementPath(String dataElementPath) {
this.dataElementPath = dataElementPath;
}
+ /**
+ * Data element pattern
+ *
+ * Pattern which matched this variable (if a pattern was used).Typically a glob
+ * pattern.
+ *
+ */
+ @JsonProperty("data_element_pattern")
+ public String getDataElementPattern() {
+ return dataElementPattern;
+ }
+
+ /**
+ * Data element pattern
+ *
+ * Pattern which matched this variable (if a pattern was used).Typically a glob
+ * pattern.
+ *
+ */
+ @JsonProperty("data_element_pattern")
+ public void setDataElementPattern(String dataElementPattern) {
+ this.dataElementPattern = dataElementPattern;
+ }
+
/**
* Stable identifier type
*
- * Type of stable identifier the variable was mapped to prior to pseudonymization.Only relevant when the variable is mapped to a stable identifier.
- *
+ * Type of stable identifier the variable was mapped to prior to
+ * pseudonymization.Only relevant when the variable is mapped to a stable
+ * identifier.
+ *
*/
@JsonProperty("stable_identifier_type")
public String getStableIdentifierType() {
@@ -235,8 +307,10 @@ public String getStableIdentifierType() {
/**
* Stable identifier type
*
- * Type of stable identifier the variable was mapped to prior to pseudonymization.Only relevant when the variable is mapped to a stable identifier.
- *
+ * Type of stable identifier the variable was mapped to prior to
+ * pseudonymization.Only relevant when the variable is mapped to a stable
+ * identifier.
+ *
*/
@JsonProperty("stable_identifier_type")
public void setStableIdentifierType(String stableIdentifierType) {
@@ -246,8 +320,10 @@ public void setStableIdentifierType(String stableIdentifierType) {
/**
* Stable identifier version
*
- * Version of stable identifier the variable was mapped to prior to pseudonymization.Only relevant when the variable is mapped to a stable identifier.
- *
+ * Version of stable identifier the variable was mapped to prior to
+ * pseudonymization.Only relevant when the variable is mapped to a stable
+ * identifier.
+ *
*/
@JsonProperty("stable_identifier_version")
public String getStableIdentifierVersion() {
@@ -257,8 +333,10 @@ public String getStableIdentifierVersion() {
/**
* Stable identifier version
*
- * Version of stable identifier the variable was mapped to prior to pseudonymization.Only relevant when the variable is mapped to a stable identifier.
- *
+ * Version of stable identifier the variable was mapped to prior to
+ * pseudonymization.Only relevant when the variable is mapped to a stable
+ * identifier.
+ *
*/
@JsonProperty("stable_identifier_version")
public void setStableIdentifierVersion(String stableIdentifierVersion) {
@@ -270,7 +348,7 @@ public void setStableIdentifierVersion(String stableIdentifierVersion) {
*
* The encryption algorithm used to pseudonymize the variable.
* (Required)
- *
+ *
*/
@JsonProperty("encryption_algorithm")
public String getEncryptionAlgorithm() {
@@ -282,7 +360,7 @@ public String getEncryptionAlgorithm() {
*
* The encryption algorithm used to pseudonymize the variable.
* (Required)
- *
+ *
*/
@JsonProperty("encryption_algorithm")
public void setEncryptionAlgorithm(String encryptionAlgorithm) {
@@ -294,7 +372,7 @@ public void setEncryptionAlgorithm(String encryptionAlgorithm) {
*
* Name of or reference to the encryption key used to pseudonymize the variable.
* (Required)
- *
+ *
*/
@JsonProperty("encryption_key_reference")
public String getEncryptionKeyReference() {
@@ -306,7 +384,7 @@ public String getEncryptionKeyReference() {
*
* Name of or reference to the encryption key used to pseudonymize the variable.
* (Required)
- *
+ *
*/
@JsonProperty("encryption_key_reference")
public void setEncryptionKeyReference(String encryptionKeyReference) {
@@ -317,7 +395,7 @@ public void setEncryptionKeyReference(String encryptionKeyReference) {
* Encryption algorithm parameters
*
* Parameters supplied to the encryption algorithm.
- *
+ *
*/
@JsonProperty("encryption_algorithm_parameters")
public List
* Parameters supplied to the encryption algorithm.
- *
+ *
*/
@JsonProperty("encryption_algorithm_parameters")
public void setEncryptionAlgorithmParameters(List
- * Short name of the source variable Only relevant when this differs from the short name of the variable.
- *
+ * Short name of the source variable Only relevant when this differs from the
+ * short name of the variable.
+ *
*/
@JsonProperty("source_variable")
public String getSourceVariable() {
@@ -349,8 +428,9 @@ public String getSourceVariable() {
/**
* Source variable
*
- * Short name of the source variable Only relevant when this differs from the short name of the variable.
- *
+ * Short name of the source variable Only relevant when this differs from the
+ * short name of the variable.
+ *
*/
@JsonProperty("source_variable")
public void setSourceVariable(String sourceVariable) {
@@ -361,7 +441,7 @@ public void setSourceVariable(String sourceVariable) {
* Source variable data type
*
* Data type of the variable prior to pseudonymization.
- *
+ *
*/
@JsonProperty("source_variable_datatype")
public PseudoVariable.SourceVariableDataType getSourceVariableDatatype() {
@@ -372,7 +452,7 @@ public PseudoVariable.SourceVariableDataType getSourceVariableDatatype() {
* Source variable data type
*
* Data type of the variable prior to pseudonymization.
- *
+ *
*/
@JsonProperty("source_variable_datatype")
public void setSourceVariableDatatype(PseudoVariable.SourceVariableDataType sourceVariableDatatype) {
@@ -392,49 +472,54 @@ public void setAdditionalProperty(String name, Object value) {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append(PseudoVariable.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append(PseudoVariable.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this)))
+ .append('[');
sb.append("shortName");
sb.append('=');
- sb.append(((this.shortName == null)?"
* Data type of the variable prior to pseudonymization.
- *
+ *
*/
@Generated("jsonschema2pojo")
public enum SourceVariableDataType {
@@ -483,11 +595,12 @@ public enum SourceVariableDataType {
INTEGER("INTEGER"),
FLOAT("FLOAT"),
DATETIME("DATETIME");
+
private final String value;
private final static Map