dapla-toolbelt-metadata 0.4.2__py3-none-any.whl → 0.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dapla-toolbelt-metadata might be problematic. Click here for more details.

Files changed (81) hide show
  1. dapla_metadata/__init__.py +7 -0
  2. dapla_metadata/dapla/__init__.py +1 -0
  3. dapla_metadata/{_shared → dapla}/user_info.py +55 -8
  4. dapla_metadata/datasets/code_list.py +1 -1
  5. dapla_metadata/datasets/core.py +1 -1
  6. dapla_metadata/datasets/dataset_parser.py +1 -1
  7. dapla_metadata/datasets/model_backwards_compatibility.py +6 -6
  8. dapla_metadata/datasets/model_validation.py +2 -2
  9. dapla_metadata/datasets/utility/constants.py +1 -0
  10. dapla_metadata/datasets/utility/enums.py +1 -1
  11. dapla_metadata/datasets/utility/utils.py +7 -11
  12. dapla_metadata/variable_definitions/__init__.py +5 -3
  13. dapla_metadata/variable_definitions/{generated → _generated}/.openapi-generator/FILES +0 -5
  14. dapla_metadata/variable_definitions/_generated/.openapi-generator/VERSION +1 -0
  15. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/__init__.py +0 -5
  16. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/__init__.py +0 -1
  17. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/data_migration_api.py +2 -2
  18. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/draft_variable_definitions_api.py +14 -14
  19. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/patches_api.py +15 -15
  20. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/validity_periods_api.py +8 -281
  21. dapla_metadata/variable_definitions/{generated/vardef_client/api/public_api.py → _generated/vardef_client/api/variable_definitions_api.py} +73 -358
  22. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/__init__.py +2 -6
  23. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/complete_response.py +8 -32
  24. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/contact.py +2 -2
  25. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/draft.py +8 -23
  26. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/language_string_type.py +7 -6
  27. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/owner.py +2 -2
  28. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/patch.py +16 -61
  29. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/problem.py +2 -2
  30. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/update_draft.py +22 -55
  31. dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/validity_period.py +14 -48
  32. dapla_metadata/variable_definitions/_generated/vardef_client/models/variable_status.py +33 -0
  33. dapla_metadata/variable_definitions/_utils/__init__.py +1 -0
  34. dapla_metadata/variable_definitions/{_client.py → _utils/_client.py} +5 -3
  35. dapla_metadata/variable_definitions/{config.py → _utils/config.py} +25 -1
  36. dapla_metadata/variable_definitions/_utils/constants.py +41 -0
  37. dapla_metadata/variable_definitions/_utils/descriptions.py +86 -0
  38. dapla_metadata/variable_definitions/_utils/files.py +273 -0
  39. dapla_metadata/variable_definitions/_utils/template_files.py +112 -0
  40. dapla_metadata/variable_definitions/_utils/variable_definition_files.py +93 -0
  41. dapla_metadata/variable_definitions/exceptions.py +141 -11
  42. dapla_metadata/variable_definitions/resources/vardef_model_descriptions_nb.yaml +63 -0
  43. dapla_metadata/variable_definitions/vardef.py +131 -10
  44. dapla_metadata/variable_definitions/variable_definition.py +241 -43
  45. {dapla_toolbelt_metadata-0.4.2.dist-info → dapla_toolbelt_metadata-0.5.0.dist-info}/METADATA +5 -7
  46. dapla_toolbelt_metadata-0.5.0.dist-info/RECORD +84 -0
  47. {dapla_toolbelt_metadata-0.4.2.dist-info → dapla_toolbelt_metadata-0.5.0.dist-info}/WHEEL +1 -1
  48. dapla_metadata/variable_definitions/generated/.openapi-generator/VERSION +0 -1
  49. dapla_metadata/variable_definitions/generated/vardef_client/api/variable_definitions_api.py +0 -1205
  50. dapla_metadata/variable_definitions/generated/vardef_client/models/klass_reference.py +0 -99
  51. dapla_metadata/variable_definitions/generated/vardef_client/models/rendered_contact.py +0 -92
  52. dapla_metadata/variable_definitions/generated/vardef_client/models/rendered_variable_definition.py +0 -235
  53. dapla_metadata/variable_definitions/generated/vardef_client/models/supported_languages.py +0 -33
  54. dapla_metadata/variable_definitions/generated/vardef_client/models/variable_status.py +0 -33
  55. dapla_toolbelt_metadata-0.4.2.dist-info/RECORD +0 -81
  56. /dapla_metadata/variable_definitions/{generated → _generated}/.openapi-generator-ignore +0 -0
  57. /dapla_metadata/variable_definitions/{generated → _generated}/README.md +0 -0
  58. /dapla_metadata/variable_definitions/{generated → _generated}/__init__.py +0 -0
  59. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api_client.py +0 -0
  60. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api_response.py +0 -0
  61. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/configuration.py +0 -0
  62. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/CompleteResponse.md +0 -0
  63. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Contact.md +0 -0
  64. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/DataMigrationApi.md +0 -0
  65. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Draft.md +0 -0
  66. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/DraftVariableDefinitionsApi.md +0 -0
  67. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/LanguageStringType.md +0 -0
  68. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Owner.md +0 -0
  69. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Patch.md +0 -0
  70. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/PatchesApi.md +0 -0
  71. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/PublicApi.md +0 -0
  72. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/SupportedLanguages.md +0 -0
  73. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/UpdateDraft.md +0 -0
  74. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/ValidityPeriod.md +0 -0
  75. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/ValidityPeriodsApi.md +0 -0
  76. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/VariableDefinitionsApi.md +0 -0
  77. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/VariableStatus.md +0 -0
  78. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/exceptions.py +0 -0
  79. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/py.typed +0 -0
  80. /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/rest.py +0 -0
  81. {dapla_toolbelt_metadata-0.4.2.dist-info → dapla_toolbelt_metadata-0.5.0.dist-info}/LICENSE +0 -0
@@ -2,9 +2,9 @@
2
2
 
3
3
  # flake8: noqa
4
4
  """
5
- Variable Definitions
5
+ Internal Variable Definitions Administration API
6
6
 
7
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
7
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
8
8
 
9
9
  The version of the OpenAPI document: 0.1
10
10
  Contact: metadata@ssb.no
@@ -17,14 +17,10 @@ Do not edit the class manually.
17
17
  from ..models.complete_response import CompleteResponse
18
18
  from ..models.contact import Contact
19
19
  from ..models.draft import Draft
20
- from ..models.klass_reference import KlassReference
21
20
  from ..models.language_string_type import LanguageStringType
22
21
  from ..models.owner import Owner
23
22
  from ..models.patch import Patch
24
23
  from ..models.problem import Problem
25
- from ..models.rendered_contact import RenderedContact
26
- from ..models.rendered_variable_definition import RenderedVariableDefinition
27
- from ..models.supported_languages import SupportedLanguages
28
24
  from ..models.update_draft import UpdateDraft
29
25
  from ..models.validity_period import ValidityPeriod
30
26
  from ..models.variable_status import VariableStatus
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no
@@ -40,13 +40,11 @@ class CompleteResponse(BaseModel):
40
40
  patch_id: StrictInt = Field(
41
41
  description="Integer identifying a patch of a variable definition."
42
42
  )
43
- name: LanguageStringType = Field(
44
- description="Name of the variable. Must be unique for a given Unit Type and Owner combination."
45
- )
43
+ name: LanguageStringType
46
44
  short_name: StrictStr = Field(
47
45
  description="Recommended short name. Must be unique within an organization."
48
46
  )
49
- definition: LanguageStringType = Field(description="Definition of the variable.")
47
+ definition: LanguageStringType
50
48
  classification_reference: StrictStr | None = Field(
51
49
  default=None,
52
50
  description="ID of a classification or code list from Klass. The given classification defines all possible values for the defined variable.",
@@ -60,9 +58,7 @@ class CompleteResponse(BaseModel):
60
58
  contains_special_categories_of_personal_data: StrictBool = Field(
61
59
  description="True if variable instances contain particularly sensitive information. Applies even if the information or identifiers are pseudonymized. Information within the following categories are regarded as particularly sensitive: Ethnicity, Political alignment, Religion, Philosophical beliefs, Union membership, Genetics, Biometrics, Health, Sexual relations, Sexual orientation"
62
60
  )
63
- variable_status: VariableStatus | None = Field(
64
- default=None, description="Status of the life cycle of the variable"
65
- )
61
+ variable_status: VariableStatus | None = None
66
62
  measurement_type: StrictStr | None = Field(
67
63
  default=None,
68
64
  description="Type of measurement for the variable, e.g. length, volume, currency. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/303",
@@ -77,18 +73,13 @@ class CompleteResponse(BaseModel):
77
73
  external_reference_uri: StrictStr | None = Field(
78
74
  default=None, description="A link (URI) to an external definition/documentation"
79
75
  )
80
- comment: LanguageStringType | None = Field(
81
- default=None,
82
- description="Optional comment to explain the definition or communicate potential changes.",
83
- )
76
+ comment: LanguageStringType | None = None
84
77
  related_variable_definition_uris: list[StrictStr] | None = Field(
85
78
  default=None,
86
79
  description="Link(s) to related definitions of variables - a list of one or more definitions. For example for a variable after-tax income it could be relevant to link to definitions of income from work, property income etc.",
87
80
  )
88
- owner: Owner = Field(
89
- description="Owner of the definition, i.e. responsible Dapla team (statistics team) and information about access management groups."
90
- )
91
- contact: Contact | None = Field(default=None, description="Contact details")
81
+ owner: Owner
82
+ contact: Contact
92
83
  created_at: datetime = Field(
93
84
  description="The timestamp at which this variable definition was first created."
94
85
  )
@@ -186,11 +177,6 @@ class CompleteResponse(BaseModel):
186
177
  ):
187
178
  _dict["classification_reference"] = None
188
179
 
189
- # set to None if variable_status (nullable) is None
190
- # and model_fields_set contains the field
191
- if self.variable_status is None and "variable_status" in self.model_fields_set:
192
- _dict["variable_status"] = None
193
-
194
180
  # set to None if measurement_type (nullable) is None
195
181
  # and model_fields_set contains the field
196
182
  if (
@@ -212,11 +198,6 @@ class CompleteResponse(BaseModel):
212
198
  ):
213
199
  _dict["external_reference_uri"] = None
214
200
 
215
- # set to None if comment (nullable) is None
216
- # and model_fields_set contains the field
217
- if self.comment is None and "comment" in self.model_fields_set:
218
- _dict["comment"] = None
219
-
220
201
  # set to None if related_variable_definition_uris (nullable) is None
221
202
  # and model_fields_set contains the field
222
203
  if (
@@ -225,11 +206,6 @@ class CompleteResponse(BaseModel):
225
206
  ):
226
207
  _dict["related_variable_definition_uris"] = None
227
208
 
228
- # set to None if contact (nullable) is None
229
- # and model_fields_set contains the field
230
- if self.contact is None and "contact" in self.model_fields_set:
231
- _dict["contact"] = None
232
-
233
209
  return _dict
234
210
 
235
211
  @classmethod
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no
@@ -34,21 +34,19 @@ from ..models.language_string_type import LanguageStringType
34
34
  class Draft(BaseModel):
35
35
  """Create a Draft Variable Definition"""
36
36
 
37
- name: LanguageStringType = Field(
38
- description="Name of the variable. Must be unique for a given Unit Type and Owner combination."
39
- )
37
+ name: LanguageStringType
40
38
  short_name: Annotated[str, Field(strict=True)] = Field(
41
39
  description="Recommended short name. Must be unique within an organization."
42
40
  )
43
- definition: LanguageStringType = Field(description="Definition of the variable.")
41
+ definition: LanguageStringType
44
42
  classification_reference: StrictStr | None = Field(
45
43
  default=None,
46
44
  description="ID of a classification or code list from Klass. The given classification defines all possible values for the defined variable.",
47
45
  )
48
- unit_types: list[StrictStr] = Field(
46
+ unit_types: list[Annotated[str, Field(min_length=1, strict=True)]] = Field(
49
47
  description="A list of one or more unit types, e.g. person, vehicle, household. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/702."
50
48
  )
51
- subject_fields: list[StrictStr] = Field(
49
+ subject_fields: list[Annotated[str, Field(min_length=1, strict=True)]] = Field(
52
50
  description="A list of subject fields that the variable is used in. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/618."
53
51
  )
54
52
  contains_special_categories_of_personal_data: StrictBool = Field(
@@ -68,15 +66,12 @@ class Draft(BaseModel):
68
66
  external_reference_uri: StrictStr | None = Field(
69
67
  default=None, description="A link (URI) to an external definition/documentation"
70
68
  )
71
- comment: LanguageStringType | None = Field(
72
- default=None,
73
- description="Optional comment to explain the definition or communicate potential changes.",
74
- )
69
+ comment: LanguageStringType | None = None
75
70
  related_variable_definition_uris: list[StrictStr] | None = Field(
76
71
  default=None,
77
72
  description="Link(s) to related definitions of variables - a list of one or more definitions. For example for a variable after-tax income it could be relevant to link to definitions of income from work, property income etc.",
78
73
  )
79
- contact: Contact | None = Field(default=None, description="Contact details")
74
+ contact: Contact
80
75
  __properties: ClassVar[list[str]] = [
81
76
  "name",
82
77
  "short_name",
@@ -179,11 +174,6 @@ class Draft(BaseModel):
179
174
  ):
180
175
  _dict["external_reference_uri"] = None
181
176
 
182
- # set to None if comment (nullable) is None
183
- # and model_fields_set contains the field
184
- if self.comment is None and "comment" in self.model_fields_set:
185
- _dict["comment"] = None
186
-
187
177
  # set to None if related_variable_definition_uris (nullable) is None
188
178
  # and model_fields_set contains the field
189
179
  if (
@@ -192,11 +182,6 @@ class Draft(BaseModel):
192
182
  ):
193
183
  _dict["related_variable_definition_uris"] = None
194
184
 
195
- # set to None if contact (nullable) is None
196
- # and model_fields_set contains the field
197
- if self.contact is None and "contact" in self.model_fields_set:
198
- _dict["contact"] = None
199
-
200
185
  return _dict
201
186
 
202
187
  @classmethod
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no
@@ -19,16 +19,17 @@ from typing import ClassVar
19
19
 
20
20
  from pydantic import BaseModel
21
21
  from pydantic import ConfigDict
22
+ from pydantic import Field
22
23
  from pydantic import StrictStr
23
24
  from typing_extensions import Self
24
25
 
25
26
 
26
27
  class LanguageStringType(BaseModel):
27
- """LanguageStringType"""
28
+ """Language string type Represents one text, with translations for the languages in \\[SupportedLanguages\\]. All fields are nullable to allow for flexibility for maintainers."""
28
29
 
29
- nb: StrictStr | None = None
30
- nn: StrictStr | None = None
31
- en: StrictStr | None = None
30
+ nb: StrictStr | None = Field(default=None, description="Norwegian Bokmål")
31
+ nn: StrictStr | None = Field(default=None, description="Norwegian Nynorsk")
32
+ en: StrictStr | None = Field(default=None, description="English")
32
33
  __properties: ClassVar[list[str]] = ["nb", "nn", "en"]
33
34
 
34
35
  model_config = ConfigDict(
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no
@@ -15,6 +15,7 @@ import json
15
15
  import pprint
16
16
  import re # noqa: F401
17
17
  from datetime import date
18
+ from typing import Annotated
18
19
  from typing import Any
19
20
  from typing import ClassVar
20
21
 
@@ -34,32 +35,27 @@ from ..models.variable_status import VariableStatus
34
35
  class Patch(BaseModel):
35
36
  """Create a new Patch version on a Published Variable Definition."""
36
37
 
37
- name: LanguageStringType | None = Field(
38
- default=None,
39
- description="Name of the variable. Must be unique for a given Unit Type and Owner combination.",
40
- )
41
- definition: LanguageStringType | None = Field(
42
- default=None, description="Definition of the variable."
43
- )
38
+ name: LanguageStringType | None = None
39
+ definition: LanguageStringType | None = None
44
40
  classification_reference: StrictStr | None = Field(
45
41
  default=None,
46
42
  description="ID of a classification or code list from Klass. The given classification defines all possible values for the defined variable.",
47
43
  )
48
- unit_types: list[StrictStr] | None = Field(
44
+ unit_types: list[Annotated[str, Field(min_length=1, strict=True)]] | None = Field(
49
45
  default=None,
50
46
  description="A list of one or more unit types, e.g. person, vehicle, household. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/702.",
51
47
  )
52
- subject_fields: list[StrictStr] | None = Field(
53
- default=None,
54
- description="A list of subject fields that the variable is used in. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/618.",
48
+ subject_fields: list[Annotated[str, Field(min_length=1, strict=True)]] | None = (
49
+ Field(
50
+ default=None,
51
+ description="A list of subject fields that the variable is used in. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/618.",
52
+ )
55
53
  )
56
54
  contains_special_categories_of_personal_data: StrictBool | None = Field(
57
55
  default=None,
58
56
  description="True if variable instances contain particularly sensitive information. Applies even if the information or identifiers are pseudonymized. Information within the following categories are regarded as particularly sensitive: Ethnicity, Political alignment, Religion, Philosophical beliefs, Union membership, Genetics, Biometrics, Health, Sexual relations, Sexual orientation",
59
57
  )
60
- variable_status: VariableStatus | None = Field(
61
- default=None, description="Status of the life cycle of the variable"
62
- )
58
+ variable_status: VariableStatus | None = None
63
59
  measurement_type: StrictStr | None = Field(
64
60
  default=None,
65
61
  description="Type of measurement for the variable, e.g. length, volume, currency. Must be defined as codes from https://www.ssb.no/klass/klassifikasjoner/303",
@@ -71,19 +67,13 @@ class Patch(BaseModel):
71
67
  external_reference_uri: StrictStr | None = Field(
72
68
  default=None, description="A link (URI) to an external definition/documentation"
73
69
  )
74
- comment: LanguageStringType | None = Field(
75
- default=None,
76
- description="Optional comment to explain the definition or communicate potential changes.",
77
- )
70
+ comment: LanguageStringType | None = None
78
71
  related_variable_definition_uris: list[StrictStr] | None = Field(
79
72
  default=None,
80
73
  description="Link(s) to related definitions of variables - a list of one or more definitions. For example for a variable after-tax income it could be relevant to link to definitions of income from work, property income etc.",
81
74
  )
82
- owner: Owner | None = Field(
83
- default=None,
84
- description="Owner of the definition, i.e. responsible Dapla team (statistics team) and information about access management groups.",
85
- )
86
- contact: Contact | None = Field(default=None, description="Contact details")
75
+ owner: Owner | None = None
76
+ contact: Contact | None = None
87
77
  __properties: ClassVar[list[str]] = [
88
78
  "name",
89
79
  "definition",
@@ -130,13 +120,8 @@ class Patch(BaseModel):
130
120
  * `None` is only added to the output dict for nullable fields that
131
121
  were set at model initialization. Other fields with value `None`
132
122
  are ignored.
133
- * OpenAPI `readOnly` fields are excluded.
134
123
  """
135
- excluded_fields: set[str] = set(
136
- [
137
- "variable_status",
138
- ]
139
- )
124
+ excluded_fields: set[str] = set([])
140
125
 
141
126
  _dict = self.model_dump(
142
127
  by_alias=True,
@@ -158,16 +143,6 @@ class Patch(BaseModel):
158
143
  # override the default output from pydantic by calling `to_dict()` of contact
159
144
  if self.contact:
160
145
  _dict["contact"] = self.contact.to_dict()
161
- # set to None if name (nullable) is None
162
- # and model_fields_set contains the field
163
- if self.name is None and "name" in self.model_fields_set:
164
- _dict["name"] = None
165
-
166
- # set to None if definition (nullable) is None
167
- # and model_fields_set contains the field
168
- if self.definition is None and "definition" in self.model_fields_set:
169
- _dict["definition"] = None
170
-
171
146
  # set to None if classification_reference (nullable) is None
172
147
  # and model_fields_set contains the field
173
148
  if (
@@ -194,11 +169,6 @@ class Patch(BaseModel):
194
169
  ):
195
170
  _dict["contains_special_categories_of_personal_data"] = None
196
171
 
197
- # set to None if variable_status (nullable) is None
198
- # and model_fields_set contains the field
199
- if self.variable_status is None and "variable_status" in self.model_fields_set:
200
- _dict["variable_status"] = None
201
-
202
172
  # set to None if measurement_type (nullable) is None
203
173
  # and model_fields_set contains the field
204
174
  if (
@@ -220,11 +190,6 @@ class Patch(BaseModel):
220
190
  ):
221
191
  _dict["external_reference_uri"] = None
222
192
 
223
- # set to None if comment (nullable) is None
224
- # and model_fields_set contains the field
225
- if self.comment is None and "comment" in self.model_fields_set:
226
- _dict["comment"] = None
227
-
228
193
  # set to None if related_variable_definition_uris (nullable) is None
229
194
  # and model_fields_set contains the field
230
195
  if (
@@ -233,16 +198,6 @@ class Patch(BaseModel):
233
198
  ):
234
199
  _dict["related_variable_definition_uris"] = None
235
200
 
236
- # set to None if owner (nullable) is None
237
- # and model_fields_set contains the field
238
- if self.owner is None and "owner" in self.model_fields_set:
239
- _dict["owner"] = None
240
-
241
- # set to None if contact (nullable) is None
242
- # and model_fields_set contains the field
243
- if self.contact is None and "contact" in self.model_fields_set:
244
- _dict["contact"] = None
245
-
246
201
  return _dict
247
202
 
248
203
  @classmethod
@@ -1,6 +1,6 @@
1
- """Variable Definitions
1
+ """Internal Variable Definitions Administration API
2
2
 
3
- ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
3
+ ## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
4
4
 
5
5
  The version of the OpenAPI document: 0.1
6
6
  Contact: metadata@ssb.no