Skip to content

Commit 91eaa40

Browse files
committed
NRL-476 validate status as current
1 parent 03ed227 commit 91eaa40

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

api/producer/updateDocumentReference/tests/test_update_document_reference.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
handler,
1010
)
1111
from nrlf.core.dynamodb.repository import DocumentPointer, DocumentPointerRepository
12-
from nrlf.producer.fhir.r4.model import DocumentReference
12+
from nrlf.producer.fhir.r4.model import CodeableConcept, Coding, DocumentReference
1313
from nrlf.tests.data import load_document_reference
1414
from nrlf.tests.dynamodb import mock_repository
1515
from nrlf.tests.events import (
@@ -478,7 +478,22 @@ def test_update_document_reference_immutable_fields(repository):
478478
doc_pointer = DocumentPointer.from_document_reference(doc_ref)
479479
repository.create(doc_pointer)
480480

481-
doc_ref.status = "draft"
481+
doc_ref.type = CodeableConcept(
482+
id=None,
483+
coding=[
484+
Coding(
485+
id=None,
486+
system="http://snomed.info/sct",
487+
version=None,
488+
code="1213324",
489+
display="Some Code",
490+
userSelected=None,
491+
)
492+
],
493+
text=None,
494+
extension=None,
495+
)
496+
482497
event = create_test_api_gateway_event(
483498
headers=create_headers(),
484499
path_parameters={"id": "Y05868-99999-99999-999999"},
@@ -511,8 +526,8 @@ def test_update_document_reference_immutable_fields(repository):
511526
}
512527
]
513528
},
514-
"diagnostics": "The field 'status' is immutable and cannot be updated",
515-
"expression": ["status"],
529+
"diagnostics": "The field 'type' is immutable and cannot be updated",
530+
"expression": ["type"],
516531
}
517532
],
518533
}
@@ -821,8 +836,6 @@ def test_update_document_reference_existing_invalid_json(
821836
doc_pointer.document = "invalid json"
822837
repository.create(doc_pointer)
823838

824-
doc_ref.status = "draft"
825-
826839
event = create_test_api_gateway_event(
827840
headers=create_headers(),
828841
path_parameters={"id": "Y05868-99999-99999-999999"},

layer/nrlf/consumer/fhir/r4/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ class DocumentReference(BaseModel):
569569
str,
570570
Field(
571571
description="The status of this document reference.",
572-
pattern="[^\\s]+(\\s[^\\s]+)*",
572+
pattern="^current$",
573573
),
574574
]
575575
docStatus: Annotated[

layer/nrlf/producer/fhir/r4/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class DocumentReference(BaseModel):
553553
str,
554554
Field(
555555
description="The status of this document reference.",
556-
pattern="[^\\s]+(\\s[^\\s]+)*",
556+
pattern="^current$",
557557
),
558558
]
559559
docStatus: Annotated[

0 commit comments

Comments
 (0)