Skip to content

Commit f3d47fd

Browse files
authored
Feature/pdct 1527 make schema migration to add event metadata into event sub (#68)
* Add event metadata field * Bump to 3.8.20 * Remove old code * Update _event sub taxonomy key * Bump to 3.8.21
1 parent a8ed441 commit f3d47fd

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

db_client/functions/metadata.py

+4-14
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,11 @@ def build_valid_taxonomy(
150150

151151
taxonomy_entries: Mapping[str, TaxonomyEntry] = {}
152152

153-
# TODO: Remove as part of PDCT-1435.
154-
if (
155-
all(
156-
k in ["allow_any", "allow_blanks", "allowed_values"]
157-
for k in list(taxonomy.keys())
158-
)
159-
and metadata is not None
160-
and list(metadata.keys()) == [EntitySpecificTaxonomyKeys.EVENT.value]
161-
):
162-
taxonomy_entries[EntitySpecificTaxonomyKeys.EVENT.value] = TaxonomyEntry(
163-
**taxonomy
164-
)
165-
return taxonomy_entries
166-
167153
for key, values in taxonomy.items():
154+
# TODO: Can we do extra validation of the taxonomy here - e.g., compare the
155+
# metadata datetime_event_name value against the list of allowed event types in
156+
# the taxonomy. In fact - split any conditionals under this for loop into a
157+
# separate validate_taxonomy function that we can isolate to test against.
168158
if not isinstance(values, dict):
169159
raise TypeError(f"Taxonomy entry for '{key}' is not a dictionary")
170160

db_client/models/dfce/taxonomy_entry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EntitySpecificTaxonomyKeys(str, Enum):
3030
"""The entity specific taxonomy keys."""
3131

3232
DOCUMENT = "_document"
33-
EVENT = "event_type"
33+
EVENT = "_event"
3434

3535

3636
@pydantic_dataclass(config=ConfigDict(validate_assignment=True, extra="forbid"))

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "db-client"
3-
version = "3.8.20"
3+
version = "3.8.21"
44
description = "All things to do with the datamodel and its storage. Including alembic migrations and datamodel code."
55
authors = ["CPR-dev-team <[email protected]>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)