Skip to content

Commit 8c8bb84

Browse files
authored
Merge branch 'main' into task/FTRS-3183-add-copilot-instructuions-per-guidance
2 parents e769431 + 0b3baa1 commit 8c8bb84

File tree

12 files changed

+101
-180
lines changed

12 files changed

+101
-180
lines changed

.github/workflows/pipeline-build-release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
workspace: "rc"
155155
release_tag: ${{ needs.tag-release.outputs.release_tag }}
156156
ref: ${{ needs.tag-release.outputs.release_tag }}
157-
workflow_timeout: 30
157+
workflow_timeout: 60
158158
secrets:
159159
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
160160
MGMT_ACCOUNT_ID: ${{ secrets.MGMT_ACCOUNT_ID }}
@@ -255,6 +255,7 @@ jobs:
255255
commit_hash: ${{ needs.metadata.outputs.commit_hash }}
256256
test_tag: ${{ matrix.tag }}
257257
test_type: ${{ matrix.type }}
258+
api_name: ${{ matrix.api_name || '' }}
258259
type: app
259260
deployment_type: "release-candidate"
260261
secrets:

.github/workflows/pipeline-deploy-application.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ jobs:
191191
environment: ${{ needs.metadata.outputs.environment }}
192192
workspace: ${{ needs.metadata.outputs.workspace }}
193193
ref: ${{ inputs.ref }}
194-
workflow_timeout: 30
194+
workflow_timeout: 60
195195
stacks: "['database', 'crud_apis', 'data_migration', 'read_only_viewer', 'opensearch', 'etl_ods', 'dos_search', 'is_performance', 'ui', 'athena']"
196196
secrets:
197197
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
@@ -404,6 +404,7 @@ jobs:
404404

405405
stage-prerelease-artefacts:
406406
name: "Stage artefacts for prerelease ${{ needs.generate-prerelease.outputs.prerelease_tag }}"
407+
if: always() && needs.generate-prerelease.result == 'success'
407408
needs:
408409
- metadata
409410
- generate-prerelease

.github/workflows/pipeline-deploy-release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
workspace: default
116116
release_tag: ${{ inputs.release_tag }}
117117
ref: ${{ inputs.release_tag }}
118-
workflow_timeout: 30
118+
workflow_timeout: 60
119119
secrets:
120120
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
121121
MGMT_ACCOUNT_ID: ${{ secrets.MGMT_ACCOUNT_ID }}
@@ -172,6 +172,7 @@ jobs:
172172
ref: ${{ inputs.release_tag }}
173173
test_tag: ${{ matrix.tag }}
174174
test_type: ${{ matrix.type }}
175+
api_name: ${{ matrix.api_name || '' }}
175176
type: app
176177
deployment_type: "release-candidate"
177178
secrets:

docs/specification/dos-ingest.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,12 @@ paths:
140140
Retrieve an organization identified by an ODS code, or all organizations if no identifier is provided.
141141
142142
## Request requirements
143-
- if the `identifier` query parameter is provided, it must be in the format `odsOrganisationCode|{CODE}` (minimum 1, maximum 12 alphanumeric characters).
144-
- if the `identifier` parameter is omitted, all organizations will be returned.
143+
- The `identifier` query parameter is required and it must be in the format `odsOrganisationCode|{CODE}` (minimum 1, maximum 12 alphanumeric characters).
145144
146145
The search is performed using the FHIR-compliant identifier parameter:
147146
- identifier=odsOrganisationCode|{CODE}
148147
149148
Example: /Organization?identifier=odsOrganisationCode|ABC123
150-
Example (all): /Organization
151149
152150
operationId: searchOrganizations
153151
parameters:
@@ -182,10 +180,8 @@ paths:
182180
example: 7b2f8d3a-9e5c-4f1b-8a6d-2c4e9f1a3b5d
183181
- in: query
184182
name: identifier
185-
description: >
186-
ODS code in the format "odsOrganisationCode|{CODE}" (FHIR identifier search).
187-
If omitted, all organizations will be returned.
188-
required: false
183+
description: ODS code in the format "odsOrganisationCode|{CODE}" (FHIR identifier search).
184+
required: true
189185
schema:
190186
type: string
191187
pattern: '^odsOrganisationCode\|[A-Za-z0-9]{1,12}$'

scripts/workflow/derive-workspace.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [[ "$TRIGGER" == "tag" ]] ; then
1515
echo -e "\nTag detected - using default workspace"
1616
echo "Workspace: $WORKSPACE"
1717
export WORKSPACE
18-
exit 0
18+
return 0
1919
fi
2020

2121
# Determine branch name based on trigger

services/crud-apis/organisations/app/models/organisation.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ class OrganisationUpdatePayload(BaseModel):
135135
]
136136
},
137137
)
138-
identifier: list[Identifier] = Field(..., description="Organization identifiers")
138+
identifier: list[Identifier] = Field(
139+
..., description="Organization identifiers", min_length=1
140+
)
139141
name: str = Field(max_length=100, example="GP Practice Name")
140142
active: bool = Field(..., example=True)
141143
telecom: Optional[list[ContactPoint]] = []
@@ -146,31 +148,48 @@ class OrganisationUpdatePayload(BaseModel):
146148
@field_validator("identifier", mode="before")
147149
@classmethod
148150
def validate_identifier_list(cls, v: list[dict]) -> list[dict]:
149-
if not v:
150-
raise ValueError(ERROR_IDENTIFIER_EMPTY)
151+
if v is None or not v:
152+
outcome = OperationOutcomeHandler.build(
153+
diagnostics=ERROR_IDENTIFIER_EMPTY,
154+
code="invalid",
155+
severity="error",
156+
)
157+
raise OperationOutcomeException(outcome)
151158

152159
ods_identifiers = [
153160
identifier
154161
for identifier in v
155162
if isinstance(identifier, dict)
156-
and identifier.get("system")
157-
== "https://fhir.nhs.uk/Id/ods-organization-code"
163+
and identifier.get("system") == ODS_SYSTEM_URL
158164
]
159165

160166
if not ods_identifiers:
161-
raise ValueError(ERROR_IDENTIFIER_NO_ODS_SYSTEM)
167+
outcome = OperationOutcomeHandler.build(
168+
diagnostics=ERROR_IDENTIFIER_NO_ODS_SYSTEM,
169+
code="invalid",
170+
severity="error",
171+
)
172+
raise OperationOutcomeException(outcome)
162173

163174
for identifier in ods_identifiers:
164175
if not identifier.get("value") or not identifier.get("value").strip():
165-
raise ValueError(ERROR_IDENTIFIER_EMPTY_VALUE)
176+
outcome = OperationOutcomeHandler.build(
177+
diagnostics=ERROR_IDENTIFIER_EMPTY_VALUE,
178+
code="invalid",
179+
severity="error",
180+
)
181+
raise OperationOutcomeException(outcome)
166182

167183
ods_code = identifier.get("value", "").strip()
168184
if not re.match(ODS_REGEX, ods_code):
169-
raise ValueError(
170-
ERROR_IDENTIFIER_INVALID_FORMAT.format(
185+
outcome = OperationOutcomeHandler.build(
186+
diagnostics=ERROR_IDENTIFIER_INVALID_FORMAT.format(
171187
ods_code=ods_code, ODS_REGEX=ODS_REGEX
172-
)
188+
),
189+
code="invalid",
190+
severity="error",
173191
)
192+
raise OperationOutcomeException(outcome)
174193

175194
return v
176195

services/crud-apis/organisations/app/router/organisation.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@
4646

4747
def _get_organization_query_params(
4848
identifier: str = Query(
49-
None,
49+
...,
5050
description="Organization identifier in format 'odsOrganisationCode|{code}'",
5151
),
5252
) -> OrganizationQueryParams | None:
53-
if identifier is None:
54-
return None
5553
return OrganizationQueryParams(identifier=identifier)
5654

5755

@@ -64,7 +62,7 @@ def get_status() -> Response:
6462

6563
@router.get(
6664
"/Organization",
67-
summary="Get organisation uuid by ods_code or read all organisations",
65+
summary="Get organisation by ods_code",
6866
response_class=JSONResponse,
6967
)
7068
async def get_handle_organisation_requests(
@@ -78,11 +76,9 @@ async def get_handle_organisation_requests(
7876
"""
7977
try:
8078
organisation_service.check_organisation_params(request.query_params)
81-
if organization_query_params and organization_query_params.identifier:
82-
ods_code = organization_query_params.ods_code
83-
result = organisation_service.get_by_ods_code(ods_code)
84-
else:
85-
result = organisation_service.get_all_organisations()
79+
80+
ods_code = organization_query_params.ods_code
81+
result = organisation_service.get_by_ods_code(ods_code)
8682
bundle = organisation_mapper.to_fhir_bundle(result)
8783
return JSONResponse(
8884
content=bundle.model_dump(mode="json"), media_type=FHIR_MEDIA_TYPE

services/crud-apis/organisations/app/services/organisation_service.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,6 @@ def check_organisation_params(self, params: dict) -> None:
235235
)
236236
raise OperationOutcomeException(outcome)
237237

238-
def get_all_organisations(self, limit: int = 10) -> list[Organisation]:
239-
"""
240-
Returns all Organisation objects from the repository.
241-
"""
242-
self.logger.log(
243-
CrudApisLogBase.ORGANISATION_004,
244-
)
245-
organisations = list(self.org_repository.iter_records(max_results=limit))
246-
organisations = [
247-
org if isinstance(org, Organisation) else Organisation(**org)
248-
for org in organisations
249-
]
250-
return organisations
251-
252238
def _get_outdated_fields(
253239
self, organisation: Organisation, payload: Organisation
254240
) -> dict:

0 commit comments

Comments
 (0)