Skip to content

Commit 2112325

Browse files
authored
refactor: added reporting_period_start and end attribute to submission_info model (#28)
* refactor: added reporting_period_start and end attribute to submission_info model
1 parent c0553c3 commit 2112325

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

src/dve/core_engine/models.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,18 @@ class SubmissionInfo(AuditRecord):
5151
"""The name of the submitted file."""
5252
file_extension: str
5353
"""The extension of the file received."""
54-
submission_method: str = None # type: ignore
54+
submission_method: Optional[str] = None # type: ignore
5555
"""The method that the file was submitted"""
56-
submitting_org: str = None # type: ignore
56+
submitting_org: Optional[str] = None # type: ignore
5757
"""The organisation who submitted the file."""
58-
reporting_period: str = None # type: ignore
59-
"""The reporting period the submission relates to."""
60-
file_size: int = None # type: ignore
58+
reporting_period_start: Optional[str] = None # type: ignore
59+
"""The start of the reporting period the submission relates to."""
60+
reporting_period_end: Optional[str] = None # type: ignore
61+
"""The end of the reporting period the submission relates to."""
62+
file_size: Optional[int] = None # type: ignore
6163
"""The size (in bytes) of the file received."""
62-
datetime_received: dt.datetime = None # type: ignore
63-
"""The datetime the SEFT transfer finished."""
64+
datetime_received: Optional[dt.datetime] = None # type: ignore
65+
"""The datetime the file was received."""
6466

6567
@validator("file_name")
6668
def _ensure_metadata_extension_removed(cls, filename): # pylint: disable=no-self-argument

tests/features/steps/steps_pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ def submit_file_for_processing(context: Context, dataset: str, file_name: str):
225225
"dataset_id": dataset,
226226
"file_name": file_name,
227227
"file_extension": Path(file_name).suffix,
228+
"reporting_period_start": "2025-11-01 00:00:00",
229+
"reporting_period_end": "2025-11-30 23:59:59"
228230
}
229231
ctxt.set_submission_info(context, SubmissionInfo(**sub_info)) # type: ignore
230232
# add processing location

tests/test_core_engine/test_backends/test_implementations/test_duckdb/test_audit_ddb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ def dve_metadata_file() -> Iterator[Path]:
4040
"file_extension": "xml",
4141
"file_size": 123456789,
4242
"submitting_org": "TEST",
43-
"reporting_period": "FY2023-24_TEST",
43+
"reporting_period_start": "FY2023-24_START_TEST",
44+
"reporting_period_end": "FY2023-24_END_TEST",
4445
"dataset_id": "TEST_DATASET",
4546
"datetime_received": "2023-10-03T10:53:36.1231998Z"
4647
}"""

tests/test_core_engine/test_backends/test_implementations/test_spark/test_audit_spark.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def dve_metadata_file() -> Iterator[Path]:
4343
"file_extension": "xml",
4444
"file_size": 123456789,
4545
"submitting_org": "TEST",
46-
"reporting_period": "FY2023-24_TEST",
46+
"reporting_period_start": "FY2023-24_START_TEST",
47+
"reporting_period_end": "FY2023-24_END_TEST",
4748
"dataset_id": "TEST_DATASET",
4849
"datetime_received": "2023-10-03T10:53:36.1231998Z"
4950
}"""
@@ -147,7 +148,8 @@ def test_submission_info_from_metadata_file(dve_metadata_file):
147148
submitting_org="TEST",
148149
file_name="TESTFILE_TEST_20230323T084600",
149150
file_extension="xml",
150-
reporting_period="FY2023-24_TEST",
151+
reporting_period_start="FY2023-24_START_TEST",
152+
reporting_period_end="FY2023-24_END_TEST",
151153
file_size=123456789,
152154
datetime_received=datetime(2023, 10, 3, 10, 53, 36, 123199, tzinfo=timezone.utc),
153155
)

tests/test_core_engine/test_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def test_submission_info( # pylint: disable=missing-function-docstring
7373
"time_updated",
7474
"submission_method",
7575
"submitting_org",
76-
"reporting_period",
76+
"reporting_period_start",
77+
"reporting_period_end",
7778
"file_size",
7879
"datetime_received",
7980
]

0 commit comments

Comments
 (0)