From df49b4a65fe066bad27a72ce97e8a3d6d86b1c16 Mon Sep 17 00:00:00 2001 From: Max Chis Date: Fri, 26 Sep 2025 08:45:45 -0400 Subject: [PATCH 1/3] Relax requirements for some URL types --- .../annotate/all/post/models/request.py | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/api/endpoints/annotate/all/post/models/request.py b/src/api/endpoints/annotate/all/post/models/request.py index 3480f346..939eafab 100644 --- a/src/api/endpoints/annotate/all/post/models/request.py +++ b/src/api/endpoints/annotate/all/post/models/request.py @@ -24,36 +24,6 @@ def forbid_record_type_if_meta_url_or_individual_record(self): raise FailedValidationException("record_type must be None if suggested_status is META_URL") return self - @model_validator(mode="after") - def require_record_type_if_data_source(self): - if self.suggested_status == URLType.DATA_SOURCE and self.record_type is None: - raise FailedValidationException("record_type must be provided if suggested_status is DATA_SOURCE") - return self - - @model_validator(mode="after") - def require_location_if_relevant(self): - if self.suggested_status not in [ - URLType.META_URL, - URLType.DATA_SOURCE, - URLType.INDIVIDUAL_RECORD, - ]: - return self - if len(self.location_ids) == 0: - raise FailedValidationException("location_ids must be provided if suggested_status is META_URL or DATA_SOURCE") - return self - - @model_validator(mode="after") - def require_agency_id_if_relevant(self): - if self.suggested_status not in [ - URLType.META_URL, - URLType.DATA_SOURCE, - URLType.INDIVIDUAL_RECORD, - ]: - return self - if len(self.agency_ids) == 0: - raise FailedValidationException("agencies must be provided if suggested_status is META_URL or DATA_SOURCE") - return self - @model_validator(mode="after") def forbid_all_else_if_not_relevant(self): if self.suggested_status != URLType.NOT_RELEVANT: From 89fec422c360297f8cac0ebb2a1a9229d7de4742 Mon Sep 17 00:00:00 2001 From: Max Chis Date: Fri, 26 Sep 2025 08:49:12 -0400 Subject: [PATCH 2/3] Fix tests --- .../unit/api/test_all_annotation_post_info.py | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/tests/automated/unit/api/test_all_annotation_post_info.py b/tests/automated/unit/api/test_all_annotation_post_info.py index c3b7a526..5d619970 100644 --- a/tests/automated/unit/api/test_all_annotation_post_info.py +++ b/tests/automated/unit/api/test_all_annotation_post_info.py @@ -54,42 +54,6 @@ class TestAllAnnotationPostInfoParams(BaseModel): location_ids=[3, 4], raise_exception=True ), - TestAllAnnotationPostInfoParams( - suggested_status=URLType.META_URL, - record_type=None, - agency_ids=[], # No agency IDs - location_ids=[3, 4], - raise_exception=True - ), - TestAllAnnotationPostInfoParams( - suggested_status=URLType.META_URL, - record_type=None, - agency_ids=[1, 2], - location_ids=[], # No Location IDs - raise_exception=True - ), - # Error Paths - Data Source - TestAllAnnotationPostInfoParams( - suggested_status=URLType.DATA_SOURCE, - record_type=None, # No record type - agency_ids=[1, 2], - location_ids=[3, 4], - raise_exception=True - ), - TestAllAnnotationPostInfoParams( - suggested_status=URLType.DATA_SOURCE, - record_type=RecordType.ACCIDENT_REPORTS, - agency_ids=[], # No Agency IDs - location_ids=[3, 4], - raise_exception=True - ), - TestAllAnnotationPostInfoParams( - suggested_status=URLType.DATA_SOURCE, - record_type=RecordType.ACCIDENT_REPORTS, - agency_ids=[1, 2], - location_ids=[], # No Location IDs - raise_exception=True - ), # Error Paths - Not Relevant TestAllAnnotationPostInfoParams( suggested_status=URLType.NOT_RELEVANT, From a2e8c1631d3fc43c1cb0bf3eb89b50ec758b43d4 Mon Sep 17 00:00:00 2001 From: Max Chis Date: Fri, 26 Sep 2025 08:52:04 -0400 Subject: [PATCH 3/3] Fix tests --- .../unit/api/test_all_annotation_post_info.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/automated/unit/api/test_all_annotation_post_info.py b/tests/automated/unit/api/test_all_annotation_post_info.py index 5d619970..4649c655 100644 --- a/tests/automated/unit/api/test_all_annotation_post_info.py +++ b/tests/automated/unit/api/test_all_annotation_post_info.py @@ -84,20 +84,6 @@ class TestAllAnnotationPostInfoParams(BaseModel): location_ids=[], raise_exception=True ), - TestAllAnnotationPostInfoParams( - suggested_status=URLType.INDIVIDUAL_RECORD, - record_type=None, - agency_ids=[1, 2], # Agency IDs Included - location_ids=[], - raise_exception=True - ), - TestAllAnnotationPostInfoParams( - suggested_status=URLType.INDIVIDUAL_RECORD, - record_type=None, - agency_ids=[], - location_ids=[1, 2], # Location IDs included - raise_exception=True - ) ] ) def test_all_annotation_post_info(