Skip to content

Commit 89cca53

Browse files
mattdean3-nhsaxelkrastek1-nhs
authored andcommitted
Merge pull request #658 from NHSDigital/feature/made14-NRL-784-dynamo-struct
[NRL-784] Fixups from first PR. Add doc comments. Add log message on unknown system id
2 parents 2cead54 + 6049dc3 commit 89cca53

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

layer/nrlf/core/dynamodb/model.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def get_id_for_system(system: str, attr_placement: str) -> str | None:
2727
Get the id for a given system
2828
"""
2929
if system not in SYSTEM_SHORT_IDS:
30-
# TODO-NOW - Log this -logger.log(LogReference.DOCPOINTER006, system=system)
30+
logger.log(
31+
LogReference.DOCPOINTER006, system=system, attr_placement=attr_placement
32+
)
3133
raise ValueError(f"Unsupported system defined in {attr_placement}")
3234

3335
return SYSTEM_SHORT_IDS.get(system)
@@ -350,15 +352,17 @@ def sk(self) -> str:
350352
def patient_key(self) -> str:
351353
"""
352354
Returns the patient gsi pk (partition key) for the DocumentPointer
353-
TODO-NOW: Add docs
355+
356+
Example: P#<nhs_number>
354357
"""
355358
return "#".join([DBPrefix.Patient.value, self.nhs_number])
356359

357360
@property
358361
def patient_sort(self) -> str:
359362
"""
360363
Returns the patient gsi sk (sort key) for the DocumentPointer
361-
TODO-NOW: Add docs
364+
365+
Example: C#<category_id>#T#<type_id>#CO#<created_on>#D#<document_id>
362366
"""
363367
return "#".join(
364368
[
@@ -377,7 +381,8 @@ def patient_sort(self) -> str:
377381
def masterid_key(self) -> str | None:
378382
"""
379383
Returns the doc_key for the DocumentPointer
380-
TODO-NOW: Add docs
384+
385+
Example: O#<ods_code>#MI#<master_identifier>
381386
"""
382387
if not self.master_identifier:
383388
return None

layer/nrlf/core/log_references.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class LogReference(Enum):
123123
DOCPOINTER005 = _Reference(
124124
"INFO", "Constructed DocumentPointer from DocumentReference resource"
125125
)
126+
DOCPOINTER006 = _Reference(
127+
"EXCEPTION", "Unsupported system defined for document reference"
128+
)
126129

127130
# Consumer - CountDocumentReference
128131
CONCOUNT000 = _Reference(

0 commit comments

Comments
 (0)