From 5422d28067857b37abb517ea91fae79a7407e3ba Mon Sep 17 00:00:00 2001 From: Barbara Hui Date: Tue, 5 Nov 2024 11:01:46 -0800 Subject: [PATCH] Add validation to contentdm for is_shown_at and by --- .../oai/content_dm/contentdm_mapper.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/metadata_mapper/mappers/oai/content_dm/contentdm_mapper.py b/metadata_mapper/mappers/oai/content_dm/contentdm_mapper.py index dc70ff9d..5f47c860 100644 --- a/metadata_mapper/mappers/oai/content_dm/contentdm_mapper.py +++ b/metadata_mapper/mappers/oai/content_dm/contentdm_mapper.py @@ -3,6 +3,7 @@ import requests from requests.adapters import HTTPAdapter, Retry +from ...mapper import Validator from ..oai_mapper import OaiRecord, OaiVernacular @@ -173,6 +174,24 @@ def get_matching_identifier(self, last=False): return identifiers[-1] return identifiers[0] +class ContentdmValidator(Validator): + + def setup(self): + self.add_validatable_fields([ + { + "field": "is_shown_by", + "validations": [ + Validator.content_match + ] + }, + { + "field": "is_shown_at", + "validations": [ + Validator.content_match + ] + } + ]) class ContentdmVernacular(OaiVernacular): record_cls = ContentdmRecord + validator = ContentdmValidator