@@ -25,26 +25,25 @@ class FHIRIssueCode(str, Enum):
2525
2626
2727class FHIRSpineErrorCode (str , Enum ):
28- INVALID_NHS_NUMBER = "INVALID_NHS_NUMBER "
28+ ACCESS_DENIED = "ACCESS_DENIED "
2929 INVALID_PARAMETER = "INVALID_PARAMETER"
3030 INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR"
3131 REFERENCE_NOT_FOUND = "REFERENCE_NOT_FOUND"
3232
3333
3434class APIErrorResponse :
35- def __init__ ( # noqa: PLR0913
35+ def __init__ (
3636 self ,
3737 status_code : HTTPStatus ,
3838 fhir_issue_code : FHIRIssueCode ,
3939 fhir_issue_severity : FHIRIssueSeverity ,
40- fhir_coding_system : str ,
4140 fhir_error_code : str ,
4241 fhir_display_message : str ,
4342 ) -> None :
4443 self .status_code = status_code
4544 self .fhir_issue_code = fhir_issue_code
4645 self .fhir_issue_severity = fhir_issue_severity
47- self .fhir_coding_system = fhir_coding_system
46+ self .fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"
4847 self .fhir_error_code = fhir_error_code
4948 self .fhir_display_message = fhir_display_message
5049
@@ -94,7 +93,6 @@ def log_and_generate_response(
9493 status_code = HTTPStatus .UNPROCESSABLE_ENTITY ,
9594 fhir_issue_code = FHIRIssueCode .VALUE ,
9695 fhir_issue_severity = FHIRIssueSeverity .ERROR ,
97- fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
9896 fhir_error_code = FHIRSpineErrorCode .INVALID_PARAMETER ,
9997 fhir_display_message = "The supplied value was not recognised by the API." ,
10098)
@@ -103,7 +101,6 @@ def log_and_generate_response(
103101 status_code = HTTPStatus .UNPROCESSABLE_ENTITY ,
104102 fhir_issue_code = FHIRIssueCode .VALUE ,
105103 fhir_issue_severity = FHIRIssueSeverity .ERROR ,
106- fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
107104 fhir_error_code = FHIRSpineErrorCode .INVALID_PARAMETER ,
108105 fhir_display_message = "The supplied category was not recognised by the API." ,
109106)
@@ -112,7 +109,6 @@ def log_and_generate_response(
112109 status_code = HTTPStatus .BAD_REQUEST ,
113110 fhir_issue_code = FHIRIssueCode .VALUE ,
114111 fhir_issue_severity = FHIRIssueSeverity .ERROR ,
115- fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
116112 fhir_error_code = FHIRSpineErrorCode .INVALID_PARAMETER ,
117113 fhir_display_message = "The given conditions were not in the expected format." ,
118114)
@@ -121,7 +117,6 @@ def log_and_generate_response(
121117 status_code = HTTPStatus .NOT_FOUND ,
122118 fhir_issue_code = FHIRIssueCode .PROCESSING ,
123119 fhir_issue_severity = FHIRIssueSeverity .ERROR ,
124- fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
125120 fhir_error_code = FHIRSpineErrorCode .REFERENCE_NOT_FOUND ,
126121 fhir_display_message = "The given NHS number was not found in our datasets. "
127122 "This could be because the number is incorrect or "
@@ -132,7 +127,6 @@ def log_and_generate_response(
132127 status_code = HTTPStatus .INTERNAL_SERVER_ERROR ,
133128 fhir_issue_code = FHIRIssueCode .PROCESSING ,
134129 fhir_issue_severity = FHIRIssueSeverity .ERROR ,
135- fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
136130 fhir_error_code = FHIRSpineErrorCode .INTERNAL_SERVER_ERROR ,
137131 fhir_display_message = "An unexpected internal server error occurred." ,
138132)
@@ -141,7 +135,6 @@ def log_and_generate_response(
141135 status_code = HTTPStatus .FORBIDDEN ,
142136 fhir_issue_code = FHIRIssueCode .FORBIDDEN ,
143137 fhir_issue_severity = FHIRIssueSeverity .ERROR ,
144- fhir_coding_system = "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
145- fhir_error_code = FHIRSpineErrorCode .INVALID_NHS_NUMBER ,
146- fhir_display_message = "The provided NHS number does not match the record." ,
138+ fhir_error_code = FHIRSpineErrorCode .ACCESS_DENIED ,
139+ fhir_display_message = "Access has been denied to process this request." ,
147140)
0 commit comments