Skip to content

Commit bb4042d

Browse files
[CDAPI-55]: Minor peer review fixes
1 parent 62fca5b commit bb4042d

3 files changed

Lines changed: 13 additions & 17 deletions

File tree

.github/actions/start-local-lambda/action.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ inputs:
55
description: "Command to start local Lambda"
66
required: false
77
default: "make deploy"
8-
health-path:
9-
description: "Health probe path to POST"
10-
required: false
11-
default: "/"
128
max-seconds:
139
description: "Maximum seconds to wait for readiness"
1410
required: false

pathology-api/src/pathology_api/fhir/r4/elements.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ class Identifier(ABC):
4242
value: The value that is unique within the system.
4343
"""
4444

45-
__expected_system__: ClassVar[str] = "__unknown__"
45+
__expected_system: ClassVar[str] = "__unknown__"
4646

4747
value: str
4848
system: str
4949

5050
@model_validator(mode="after")
5151
def validate_system(self) -> "Identifier":
52-
if self.system != self.__expected_system__:
52+
if self.system != self.__expected_system:
5353
raise ValueError(
5454
f"Identifier system '{self.system}' does not match expected "
55-
f"system '{self.__expected_system__}'."
55+
f"system '{self.__expected_system}'."
5656
)
5757
return self
5858

5959
@classmethod
6060
def __init_subclass__(cls, expected_system: str) -> None:
61-
cls.__expected_system__ = expected_system
61+
cls.__expected_system = expected_system
6262

6363

6464
class UUIDIdentifier(Identifier, expected_system="https://tools.ietf.org/html/rfc4122"):
@@ -67,5 +67,5 @@ class UUIDIdentifier(Identifier, expected_system="https://tools.ietf.org/html/rf
6767
def __init__(self, value: uuid.UUID | None = None):
6868
super().__init__(
6969
value=str(value or uuid.uuid4()),
70-
system=self.__expected_system__,
70+
system=self.__expected_system,
7171
)

pathology-api/src/pathology_api/fhir/r4/resources.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ class Resource(BaseModel):
1616
"""A FHIR R4 Resource base class."""
1717

1818
# class variable to hold class mappings per resource_type
19-
__resource_types__: ClassVar[dict[str, type["Resource"]]] = {}
20-
__expected_resource_type__: ClassVar[dict[type["Resource"], str]] = {}
19+
__resource_types: ClassVar[dict[str, type["Resource"]]] = {}
20+
__expected_resource_type: ClassVar[dict[type["Resource"], str]] = {}
2121

2222
meta: Annotated[Meta | None, Field(alias="meta", frozen=True)] = None
2323
resource_type: str = Field(alias="resourceType", frozen=True)
2424

2525
def __init_subclass__(cls, resource_type: str, **kwargs: Any) -> None:
26-
cls.__resource_types__[resource_type] = cls
27-
cls.__expected_resource_type__[cls] = resource_type
26+
cls.__resource_types[resource_type] = cls
27+
cls.__expected_resource_type[cls] = resource_type
2828

2929
super().__init_subclass__(**kwargs)
3030

@@ -47,7 +47,7 @@ def validate_with_subtype(
4747

4848
resource_type = value["resourceType"]
4949

50-
subclass = cls.__resource_types__.get(resource_type)
50+
subclass = cls.__resource_types.get(resource_type)
5151
if subclass is None:
5252
raise TypeError(f"Unknown resource type: {resource_type}")
5353

@@ -57,12 +57,12 @@ def validate_with_subtype(
5757
@classmethod
5858
def create(cls, **kwargs: Any) -> Self:
5959
"""Create a Resource instance with the correct resourceType."""
60-
return cls(resourceType=cls.__expected_resource_type__[cls], **kwargs)
60+
return cls(resourceType=cls.__expected_resource_type[cls], **kwargs)
6161

6262
@field_validator("resource_type", mode="after")
6363
@classmethod
6464
def _validate_resource_type(cls, value: str) -> str:
65-
expected_resource_type = cls.__expected_resource_type__[cls]
65+
expected_resource_type = cls.__expected_resource_type[cls]
6666
if value != expected_resource_type:
6767
raise ValueError(
6868
f"Resource type '{value}' does not match expected "
@@ -115,7 +115,7 @@ class PatientIdentifier(
115115
"""A FHIR R4 Patient Identifier utilising the NHS Number system."""
116116

117117
def __init__(self, value: str):
118-
super().__init__(value=value, system=self.__expected_system__)
118+
super().__init__(value=value, system=self.__expected_system)
119119

120120
@classmethod
121121
def from_nhs_number(cls, nhs_number: str) -> "Patient.PatientIdentifier":

0 commit comments

Comments
 (0)