Skip to content

Search logic

Jonny Rylands edited this page Oct 12, 2020 · 7 revisions

Appointment Checker Search Logic

STEP 1 - CHECK BOTH ODS CODES FOR VALIDITY

(Run once for each ODS code - provider, consumer)

  1. Is ODS empty or whitespace?

If yes, stop for this ODS code. If no, continue to next step.

  1. Is ODS code present in the Spine Directory? / Retrieve organisation details

Run LDAP query:

Search tree "ou=organisations, o=nhs"
Search query "(uniqueidentifier=ODS_CODE)"

If entry not present:

  • stop (for this ODS code).

If entry present:

  • save organisation details in organisation table
  • and validate next ODS code or continue to next step.

STEP 2 - VALIDATE PROVIDER ODS CODE IN SPINE DIRECTORY

(Run for just the provider ODS code)

  1. Is ODS code configured in Spine Directory as an GP Connect Appointments provider system? / Retrieve provider endpoint and party key from Spine Directory

"ou=services, o=nhs"
"(&(nhsIDCode=ODS_CODE)(objectClass=nhsMhs)(nhsMhsSvcIA=urn:nhs:names:services:gpconnect:structured:fhir:rest:read:metadata-1))"

If entry present:

  • Retrieve endpoint and party key from results
  • ODS code is a GP Connect Appointments provider system
  • Continue to next step

If entry not present:

  • ODS code is not a GP Connect Appointments provider system, return this information to the front end
  • Stop for this ODS code.
  1. Retrieve provider ASID from Spine Directory

Use party key retrieved from previous step.

"ou=services, o=nhs"
"(&(nhsIDCode=ODS_CODE)(objectClass=nhsAs)(nhsMhsPartyKey=PARTY_KEY))"

If entry present:

  • Retrieve provider ASID from results
  • Continue to next step

If entry not present:

  • ODS code is not fully configured as a GP Connect provider system, return this information to the front end
  • Stop for this ODS code.

STEP 3 - CALL PROVIDER METADATA ENDPOINT

  1. Send capability statement query (GET /metadata)

If error occured:

  • see GP Connect message error handling appendix

If metadata statement retrieved:

  • continue to next step.

STEP 4 - EXECUTE SEARCH

  1. Send search for free slots

If error occured:

  • See GP Connect message error handling appendix
    If results retrieved:
  • Display results.

APPENDIX - GPCONNECT MESSAGE ERROR HANDLING

  1. If timeout or other network related issue (allow for up to 31 seconds) display error message to user

  2. If error response received:

    https://developer.nhs.uk/apis/gpconnect-1-2-7/development_fhir_error_handling_guidance.html

    Display error message to user:

    An error occured when sending a message to the provider system.
    
    The error returned was "DISPLAY - DIAGNOSTICS (CODE)".
    

    Where DIAGNOSTICS, DISPLAY and CODE are taken from the OperationOutcome.