From aead4ff13da4ee63bb773d12b66683983d57faa7 Mon Sep 17 00:00:00 2001 From: olaughter <51889566+olaughter@users.noreply.github.com> Date: Wed, 28 Aug 2024 12:13:07 +0100 Subject: [PATCH] Remove obsolete date field assignment (#81) * Remove obsolete date field assignment We no longer have opensearch, so this is not needed. I have looked in the backend and through the pipeline and can't find any instances of it still being used. I've also left the field itself so it can still be used if we have any more-legacy type code lying around * bump version * Add deprecated comment to obsolete field --- src/cpr_sdk/pipeline_general_models.py | 18 ++---------------- src/cpr_sdk/version.py | 2 +- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/cpr_sdk/pipeline_general_models.py b/src/cpr_sdk/pipeline_general_models.py index 0eb552b..ad1b3b2 100644 --- a/src/cpr_sdk/pipeline_general_models.py +++ b/src/cpr_sdk/pipeline_general_models.py @@ -2,7 +2,7 @@ from enum import Enum from typing import Mapping, Any, List, Optional, Sequence, Union -from pydantic import BaseModel, field_validator, model_validator +from pydantic import BaseModel, field_validator Json = dict[str, Any] @@ -29,7 +29,7 @@ class BackendDocument(BaseModel): family_import_id: str family_slug: str publication_ts: datetime - date: Optional[str] = None # Set on import by a validator + date: Optional[str] = None # Deprecated source_url: Optional[str] = None download_url: Optional[str] = None corpus_import_id: Optional[str] = None @@ -45,20 +45,6 @@ class BackendDocument(BaseModel): metadata: Json - @model_validator(mode="after") - def convert_publication_ts_to_date(self): - """ - Convert publication_ts to a datetime string. - - This is necessary as OpenSearch expects a date object. - - TODO: remove when no longer using Opensearch - """ - - self.date = self.publication_ts.strftime("%d/%m/%Y") - - return self - @field_validator("type", mode="before") @classmethod def none_to_empty_string(cls, value): diff --git a/src/cpr_sdk/version.py b/src/cpr_sdk/version.py index 9f91e53..2457b77 100644 --- a/src/cpr_sdk/version.py +++ b/src/cpr_sdk/version.py @@ -1,6 +1,6 @@ _MAJOR = "1" _MINOR = "3" -_PATCH = "10" +_PATCH = "11" _SUFFIX = "" VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)