Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIAD-2785: Add timeout section to operating doc #339

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions OPERATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,45 @@ yyyy-mm-dd HH:mm:ss.SSS Level=DEBUG Logger=u.n.a.p.t.s.BundleMapperService Conve

## Timeout functionality

The Adaptor conforms to the GP2GP large messaging specification (NPFIT-PC-BLOD-0170.03 v1.1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NPFIT-PC-BLOD-0170.03 v1.1 doesn't return any google results 😭. Is there a more "user facing" name for that spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document is just called Handling Large Messages. I think it might not be available publicly, so I'll remove the reference to it.

by timing out in-progress transfers (section 2.3.6). This ensures transfers are ended gracefully
in the scenario a GP2GP message has not been received.

The timeout
datetime is calculated using the following formula and the *Persist Duration* (the minium time a message is persisted by spine) of the expected GP2GP messages.
benhession marked this conversation as resolved.
Show resolved Hide resolved

```text

Timeout [secs] = (A x persistDuration contract property of EHR Response
[secs]) + (B x Number of COPC Common Point to Point EHR messages x
persistDuration contract property of COPC Common Point to Point messages
[secs])

```
benhession marked this conversation as resolved.
Show resolved Hide resolved
The formula includes adjustable weightings (A and B) to offset potential transmission delays.

From the documentation:

> A & B are weighting factors associated with general message transmission delays and volume based
throughput times to allow adjustment if required ....

The *Persist Duration* of each message is unique to the sending organisation and is obtained from the Spine Directory Service (SDS) FHIR API. Responses for an organisations message type are cached by default.
benhession marked this conversation as resolved.
Show resolved Hide resolved
benhession marked this conversation as resolved.
Show resolved Hide resolved

The adaptor checks for transfers periodically, the default is every six hours. However, this is configurable via the environment variables.
benhession marked this conversation as resolved.
Show resolved Hide resolved

Required environment variables:

- `SDS_API_KEY`: Your SDS FHIR API Key

Optional environment variables:

- `SDS_BASE_URL`: The SDS FHIR API Base URL (default is production) - default = `https://api.service.nhs.uk/spine-directory/FHIR/R4`
- `TIMEOUT_CRON_TIME`: The frequency of the timeout check specified as a Cron expression (default is every six hours).
format = `<second> <minute> <hour> <day of month> <month> <day of week>` - default = `0 0 */6 * * * `
- `TIMEOUT_SDS_POLL_FREQUENCY`: The frequency the persist duration cache is updated (default 3) i.e. 1 = send request to SDS everytime, 3 = send request to SDS on the third call - default = `3`
- `TIMEOUT_EHR_EXTRACT_WEIGHTING`: The weighting factor A (as described above) - default = `1`
- `TIMEOUT_COPC_WEIGHTING`: The weighting factor B (as described above) - default = `1`

## Database requirements

* The adaptor requires a [PostgreSQL] database
Expand Down