Skip to content

Commit cef4616

Browse files
committed
NRL-477 update model and error messages
1 parent 58a7408 commit cef4616

File tree

8 files changed

+13
-60
lines changed

8 files changed

+13
-60
lines changed

api/consumer/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ components:
788788
description: The status of this document reference.
789789
docStatus:
790790
type: string
791-
pattern: "^(entered-in-error|amended|preliminary|final)$"
791+
enum: ["entered-in-error", "amended", "preliminary", "final"]
792792
description: The status of the underlying document.
793793
type:
794794
$ref: "#/components/schemas/CodeableConcept"

api/producer/createDocumentReference/tests/test_create_document_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def test_create_document_reference_with_invalid_docStatus():
445445
}
446446
],
447447
},
448-
"diagnostics": "Request body could not be parsed (docStatus: String should match pattern '^(entered-in-error|amended|preliminary|final)$')",
448+
"diagnostics": "Request body could not be parsed (docStatus: Input should be 'entered-in-error', 'amended', 'preliminary' or 'final')",
449449
"expression": ["docStatus"],
450450
},
451451
],

api/producer/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ components:
13511351
description: The status of this document reference.
13521352
docStatus:
13531353
type: string
1354-
pattern: "^(entered-in-error|amended|preliminary|final)$"
1354+
enum: ["entered-in-error", "amended", "preliminary", "final"]
13551355
description: The status of the underlying document.
13561356
type:
13571357
$ref: "#/components/schemas/CodeableConcept"

api/producer/upsertDocumentReference/tests/test_upsert_document_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def test_upsert_document_reference_with_invalid_docStatus():
489489
}
490490
],
491491
},
492-
"diagnostics": "Request body could not be parsed (docStatus: String should match pattern '^(entered-in-error|amended|preliminary|final)$')",
492+
"diagnostics": "Request body could not be parsed (docStatus: Input should be 'entered-in-error', 'amended', 'preliminary' or 'final')",
493493
"expression": ["docStatus"],
494494
},
495495
],

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: swagger.yaml
3-
# timestamp: 2024-12-05T01:41:57+00:00
3+
# timestamp: 2024-12-11T14:01:43+00:00
44

55
from __future__ import annotations
66

@@ -577,11 +577,8 @@ class DocumentReference(BaseModel):
577577
),
578578
]
579579
docStatus: Annotated[
580-
Optional[str],
581-
Field(
582-
description="The status of the underlying document.",
583-
pattern="^(entered-in-error|amended|preliminary|final)$",
584-
),
580+
Optional[Literal["entered-in-error", "amended", "preliminary", "final"]],
581+
Field(description="The status of the underlying document."),
585582
] = None
586583
type: Annotated[
587584
Optional[CodeableConcept],

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: swagger.yaml
3-
# timestamp: 2024-12-05T01:41:53+00:00
3+
# timestamp: 2024-12-11T14:01:38+00:00
44

55
from __future__ import annotations
66

@@ -561,11 +561,8 @@ class DocumentReference(BaseModel):
561561
),
562562
]
563563
docStatus: Annotated[
564-
Optional[str],
565-
Field(
566-
description="The status of the underlying document.",
567-
pattern="^(entered-in-error|amended|preliminary|final)$",
568-
),
564+
Optional[Literal["entered-in-error", "amended", "preliminary", "final"]],
565+
Field(description="The status of the underlying document."),
569566
] = None
570567
type: Annotated[
571568
Optional[CodeableConcept],

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: swagger.yaml
3-
# timestamp: 2024-12-05T01:41:55+00:00
3+
# timestamp: 2024-12-11T14:01:41+00:00
44

55
from __future__ import annotations
66

@@ -491,7 +491,8 @@ class DocumentReference(BaseModel):
491491
StrictStr, Field(description="The status of this document reference.")
492492
]
493493
docStatus: Annotated[
494-
Optional[StrictStr], Field(description="The status of the underlying document.")
494+
Optional[Literal["entered-in-error", "amended", "preliminary", "final"]],
495+
Field(description="The status of the underlying document."),
495496
] = None
496497
type: Annotated[
497498
Optional[CodeableConcept],

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -499,48 +499,6 @@ Feature: Producer - createDocumentReference - Failure Scenarios
499499
}
500500
"""
501501

502-
# Invalid document reference - invalid Type
503-
# NRL-769 Known issue: Type display is not validated
504-
# Scenario: Invalid type (valid code but wrong display value)
505-
# Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
506-
# And the organisation 'TSTCUS' is authorised to access pointer types:
507-
# | system | value |
508-
# | http://snomed.info/sct | 1363501000000100 |
509-
# | http://snomed.info/sct | 736253002 |
510-
# When producer 'TSTCUS' requests creation of a DocumentReference with default test values except 'type' is:
511-
# """
512-
# "type": {
513-
# "coding": [
514-
# {
515-
# "system": "http://snomed.info/sct",
516-
# "code": "736253002",
517-
# "display": "Emergency Healthcare Plan"
518-
# }
519-
# ]
520-
# }
521-
# """
522-
# Then the response status code is 400
523-
# And the response is an OperationOutcome with 1 issue
524-
# And the OperationOutcome contains the issue:
525-
# """
526-
# {
527-
# "severity": "error",
528-
# "code": "invalid",
529-
# "details": {
530-
# "coding": [
531-
# {
532-
# "system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
533-
# "code": "BAD_REQUEST",
534-
# "display": "Bad request"
535-
# }
536-
# ]
537-
# },
538-
# "diagnostics": "The display does not match the expected value for this type",
539-
# "expression": [
540-
# "type.coding.display"
541-
# ]
542-
# }
543-
# """
544502
# Invalid document reference - empty content[0].attachment.url
545503
# Invalid document reference - create another producers document
546504
# Invalid document reference - bad JSON

0 commit comments

Comments
 (0)