openapi: 3.2.0
info:
title: organisation-data-terminology-api Organization Affiliation API
version: 1.0.1-alpha
contact:
name: ODS FHIR API Support
url: https://digital.nhs.uk/developer/help-and-support
email: api.management@nhs.net
description: "\n\n## Overview\nUse this API to access a dataset of health and social care organisations, such as trusts or GP practices, using the [Organisation Data Service (ODS)](https://digital.nhs.uk/services/organisation-data-service). \n\nThe FHIR API contains the majority of ODS Content, including Organisations, practitioners and geographic information. It contains all the content found within the [ODS ORD API](http://digital.nhs.uk/developer/api-catalogue/organisation-data-service-ord) and the [ODS STU3 API](https://digital.nhs.uk/developer/api-catalogue/organisation-data-service-fhir)\n\nODS holds information for many different types of organisation related to health and social care – mostly in England but also other countries depending on the type of Organisation. For the full scope of data coverage of the ODS APIs, see [Organisation Data Service - data coverage](https://digital.nhs.uk/services/organisation-data-service/ods-data-coverage). \n\nEvery organisation in ODS has a unique identifier called an ODS code. \n\nUsing this API, you can:\n\n - search for an organisation to find its ODS code \n - get organisation details for a given ODS code\n - get details of related organisations\n - search for a practitioner to find their ODS code \n - get practitioner details for a given ODS code \n - get geographic boundaries for a postcode \n - get details of recently deleted or partially deleted records \n\nYou can also limit the number of results returned, or just request a count of the number of search results.\n\nThis FHIR API makes use of the Organization and OrganizationAffiliation FHIR resources plus range of CodeSystems to deliver the full suite of data, which you will use will depend on your need. \n\n\n### Organisation Data\n\nWe have been able to align the majority of data we hold for an organisation into the FHIR resources Organization and OrganizationAffiliation, through the limited use of extensions, however some previously available information could not be included.\n\nTo access the Organisation attributes which are not included in the Organization resource use the ods-organization-code CodeSystem. The CodeSystem resource returns the following additional information:\n\n - organisation – Assigning Authority \n - related entities, the current related entity of any supported relationships \n - succession - any predecessors and/or successors and a flag to indicate the successor has also been succeeded \n - geographic - the appropriate mapping from the postcode dataset including Local Authority, Integrated Care Board or Lower Super Output Area (LSOA) \n\n### Practitioner Data\nODS publishes a limited set of prescribers held by the Business Services Authority, which includes General Practitioners and Nurse Prescribers, alongside Hospital and Dental Consultants provided by the workforce census returns.\n\nThese codes have not been made available within the Pracitioner Resource as it is felt thet they do not accurately represent an indindiual, but rather reflect their prescribing activities.\n\nTo access the Practitioner data you will need to use the practitioner CodeSystem in conjunction with the practitioner-relationship-instance CodeSystem which contians the relationship between a practitioner and the organisation at which they work. \n\n### Postcodes and geographic boundaries available\n\nFor every postcode within the NHS Postcode Directory, we have compiled a CodeSystem which contains the postcode along with its key Health and Social Care boundaries, including, Primary Care Organisations, Integrated Care Boards, Local Authority 2011 Lower Super Output Areas (LSOA11), Cancer Alliances and NHS England Regions \n\n### CodeSystems to support the full range of ODS Content\n\nIn Addition to the ods-organisation-code CodeSystem mentioned above, there are also CodeSystems for:\n\n- practitioner - includes details about related organisation (where a practitioner is based/works) and type of practitioner\n- postcode - contains various geographic values/boundaries for a postcode including which Lower Super Output Area, Parliamentary Constituency, Local Authority and Integrated Care Board boundary a postcode falls within\n- organization-relationship-instance – contains historic and current relationships\n- organization-role-instance – contains historic and current role instances \n- practitioner-role – contains the role a practitioner performs (currently limited to prescriber types/roles and consultants)\n- practitioner-relationship-instance – contains the associations between Prescribers (GPs) and GP Practices only \n- ODSOrganisationRole – reference Data for Primary and Non Primary Roles (Role ID, Role Name, and Primary/Non Primary indicator)\n- ODSRelationship – reference data for Relationships (Relationship Type ID and Relationship Name) \n- ODSRecordClass – reference data for record classes ie org or site \n- ODSRecordUseType – reference data for the type of use – Full for current records, refOnly for minimal records included for referential integrity\n- geography-name – reference data for ONS identifiers used within the Postcode CodeSystem \n\n\n\n
\n\n\n\n## Who can use this API\nThere are no particular restrictions on what this API can be used for. \n\nIt can be used free of charge by public sector organisations in England, Scotland and Wales, including the NHS. This includes use by software developers building software for the public sector.\n\n## Related APIs\nThe following APIs also gives access to the Organisation Data Service:\n- [ODS Organisation Reference Data (ORD) API](https://digital.nhs.uk/developer/api-catalogue/organisation-data-service-ord) - a richer version conforming to DCB000090 Standard, soon to be deprecated.\n- [ODS Organisation Reference Data (FHIR - STU3) API](https://digital.nhs.uk/developer/api-catalogue/organisation-data-service-fhir) - STU3 version contains a minimal organization record, soon to be deprecated.\n\n\n## API status and roadmap\nThis API is [in development](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#statuses).\n\nTo see our roadmap, or to suggest, comment or vote on features for this API, see our [interactive product backlog](https://nhs-digital-api-management.featureupvote.com/?order=popular&filter=allexceptdone&tag=ods-api#controls).\n\nIf you have any other queries, [contact us](https://digital.nhs.uk/developer/help-and-support).\n\n## Service level\nThis API is a bronze service, meaning it is operational and supported only during business hours (8am to 6pm), Monday to Friday excluding bank holidays.\n\nFor more details, see [service levels](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#service-levels).\n\n## Technology\nThis API is [RESTful](https://digital.nhs.uk/developer/guides-and-documentation/our-api-technologies#basic-rest).\n\nIt also conforms to the [FHIR](https://digital.nhs.uk/developer/guides-and-documentation/our-api-technologies#fhir) global standard for health care data exchange. Specifically to FHIR R4 (v4.0.1), we have been working closely with the Interoperability team to develop and publish [Implementation guidance](https://simplifier.net/guide/organisation-data-services).\n\nYou do not need to know much about FHIR to use this API - FHIR APIs are just RESTful APIs that follow specific rules. In particular:\n- resource names are capitalised, singular and in American English, for example `/Organization` not `/organisations`\n- array names are singular, for example `line` not `lines` for address lines\n- data items that are country-specific and thus not included in the FHIR global base resources are usually wrapped in an `extension` object\n\nThere are [libraries and SDKs available](https://digital.nhs.uk/developer/guides-and-documentation/api-technologies-at-nhs-digital#fhir-libraries-and-sdks) to help with FHIR API integration.\n\n## Network access\nThis API is available on the internet and, indirectly, on the [Health and Social Care Network (HSCN)](https://digital.nhs.uk/services/health-and-social-care-network).\n\nFor more details see [Network access for APIs](https://digital.nhs.uk/developer/guides-and-documentation/network-access-for-apis).\n\n## Security and authorisation\n### Application-restricted access\n#### still to be decided\nThis API is [application-restricted](https://digital.nhs.uk/developer/guides-and-documentation/security-and-authorisation#application-restricted-apis), meaning we authenticate the calling application but not the end user.\n\n## Errors\nWe use standard HTTP status codes to show whether an API request succeeded or not. They are usually in the range:\n- 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action\n- 400 to 499 if it failed because of a client error by your application\n- 500 to 599 if it failed because of an error on our server\n\nErrors specific to each API are shown in the Endpoints section, under Response. See our [reference guide](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#http-status-codes) for more on errors.\n\n\n## Environments and testing\n\n| Environments | Base URLs |\n| ----------------- | ---------------------------------------------------------------------- |\n| User acceptance test (UAT) |TBC |\n| Production |TBC |\n\nFor example:\n`TBC/fhir/Organization/RJY`\nreturns the dataset for the organisation whose ODS code is RJY.\n\n### Integration testing\nYou can use the UAT environment to perform your integration testing.\n\n## Onboarding\n\n\n#### still to be decided if we use the Term server\nIndividual users can access content on the NHS England Terminology Server(ODS Instance) with a registered account.\n\nShrimp is a terminology browser that is freely available on the internet, but it is only for browsing the content. The Terminology Server does not come with a built-in browser, so Shrimp is given as an example of a browsing tool, freely accessible on the internet. Other browsers can be used.\n\nIf you are interested in integrating a software application with the Terminology Server, or if you want to [syndicate content to your own Terminology Server](https://digital.nhs.uk/services/terminology-server#syndication), you will need to complete a [system-to-system request form]https://digital.nhs.uk/services/terminology-server/system-to-system-account-request-form.\n"
servers:
- url: https://beta.ods.dc4h.link/fhir/
description: User acceptance test (UAT) environment.
- url: https://jenkins.ods.dc4h.link/fhir/
description: Production environment.
tags:
- name: OrganizationAffiliation
paths:
/OrganizationAffiliation/{id}:
get:
summary: Get relationship details
operationId: get-single-organizationaffiliation
description: "## Overview\nUse this endpoint to a retrieve a single relationship record based on its unique identifier. This record describes a relationship between a pair of organisations. The types of relationships which an organisation may have will vary depending on the primary role of the organisation. In some case there may be multiple relationships between the same two organisations, each having a different relationship type. \n\nA FHIR OrganizationAffiliation Resource will be returned when a valid id is provided. \n"
parameters:
- in: path
name: id
description: 'The relationship ID.
'
required: true
schema:
type: string
example: '617400'
responses:
'200':
description: Valid request that returns a FHIR OrganizationAffiliation resource
content:
application/fhir+json:
example:
resourceType: OrganizationAffiliation
id: '617400'
meta:
versionId: '3'
lastUpdated: '2024-01-23T16:51:55.472+00:00'
source: '#25caee48b2ce3432'
profile:
- https://fhir.hl7.org.uk/StructureDefinition/UKCore-OrganizationAffiliation
- https://fhir.nhs.uk/England/StructureDefinition/England-OrganizationAffiliation-ODS
extension:
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Legal
display: Legal
- url: period
valuePeriod:
start: '2019-10-01'
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Operational
display: Operational
- url: period
valuePeriod:
start: '2019-10-01'
identifier:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/organization-relationship-instance
value: '617400'
active: true
period:
start: '2019-10-01'
organization:
reference: Organization/G81086
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: G81086
participatingOrganization:
reference: Organization/U36842
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: U36842
code:
- coding:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/ODSRelationship
code: RE8
display: IS PARTNER TO
application/xml:
example: "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"
'404':
description: 'Invalid ODS Code provided, will return a 404 Not Found error
'
content:
application/fhir+json:
example:
resourceType: OperationOutcome
text:
status: generated
div: '
Operation Outcome
ERROR
[]
HAPI-2001: Resource Organization/8J632648493 is not known
'
issue:
- severity: error
code: processing
diagnostics: 'HAPI-2001: Resource Organization/8J632648493 is not known'
tags:
- OrganizationAffiliation
/Organizationaffiliation:
get:
summary: Search for a relationship
operationId: get-organizationaffiliation-resources
description: "## Overview\nUse this endpoint to search for relationship records. Most commonly you would use this endpoint to get all the relationships for a given organisation, based on its ODS code. \n\nFor relationships, this API returns the following details: \n\n * related organisation ODS code \n * relationship type and relationship name \n * relationship legal start and end dates \n * relationship operational start and end dates\n \nyou can search using various combinations of:\n\n * Primary-Organisation - known within the ORD products as the Source Organisation\n * Participating-Organisation - known within the ORD products as the Target Organisation\n * relationship status \n \nIt is also possible to return the relevant Organization Resources in these searches using the `_include` parameter\n \n"
parameters:
- in: query
name: _id
description: 'The organisation''s ID - also known as its ODS code. If you already know the ODS code, consider using the ''Get organsiation details'' endpoint instead.
'
required: false
schema:
type: string
example: RTG
- in: query
name: primary-organisation
description: "The ‘source’ organisation which has a relationship. \n\nreferred to as the SourceOrganisation in the ORD schema \n\nMust be a valid Organisation code with relationships to return results\n"
required: false
schema:
type: string
example: G81086
- in: query
name: participating-organization
description: "The ‘Target’ or related organisation. \n\nReferred to as the Target Organisation in the ORD schema \nMust be a valid Organisation code with relationships to return results \n"
required: false
schema:
type: string
example: 97R
- in: query
name: active
description: Whether the organisation's relationship record is still in active use.
required: false
schema:
type: boolean
example: 'true'
- in: query
name: _count
description: Number of results to return.
required: false
schema:
type: string
example: '1000'
- in: query
name: _include
description: "Enables you return related resources. \n\nOrganizationAffiliation:primary-organization will include Organization resource records for the ‘Source’ Organisations in the search results \n\nOrganizationAffiliation:participating-organization will include Organization resource records for all the ‘Target’ Organisations in the search results \n\nyou can include both primary and participating organization resources by including multiple `_include` parameters\n"
required: false
schema:
type: string
examples:
primary-organization:
summary: Include primary-organization
value: OrganizationAffiliation:primary-organization
participating-Organization:
summary: Include participating-organization
value: OrganizationAffiliation:participating-organization
- in: query
name: _summary
description: Return a count of the matching resources, without returning the actual matches.
required: false
schema:
type: string
enum:
- count
responses:
'200':
description: Valid request that returns any FHIR OrganizationAffiliation resources that match the search criteria (which may be 0).
content:
application/fhir+json:
example:
resourceType: Bundle
id: 3a286c55-83c9-4869-aaf1-c69186656ade
meta:
lastUpdated: '2024-03-15T10:47:18.746+00:00'
type: searchset
total: 3
link:
- relation: self
url: https://jenkins.ods.dc4h.link/fhir/OrganizationAffiliation?primary-organization=FDC49
entry:
- fullUrl: https://jenkins.ods.dc4h.link/fhir/OrganizationAffiliation/383689
resource:
resourceType: OrganizationAffiliation
id: '383689'
meta:
versionId: '3'
lastUpdated: '2024-01-23T15:40:47.090+00:00'
source: '#72eb666ff3d30383'
profile:
- https://fhir.hl7.org.uk/StructureDefinition/UKCore-OrganizationAffiliation
- https://fhir.nhs.uk/England/StructureDefinition/England-OrganizationAffiliation-ODS
extension:
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Legal
display: Legal
- url: period
valuePeriod:
start: '2015-05-11'
end: '2020-03-31'
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Operational
display: Operational
- url: period
valuePeriod:
start: '2015-05-11'
end: '2020-03-31'
identifier:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/organization-relationship-instance
value: '383689'
active: false
period:
start: '2015-05-11'
end: '2020-03-31'
organization:
reference: Organization/FDC49
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: FDC49
participatingOrganization:
reference: Organization/Q72
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: Q72
code:
- coding:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/ODSRelationship
code: RE5
display: IS LOCATED IN THE GEOGRAPHY OF
search:
mode: match
- fullUrl: https://jenkins.ods.dc4h.link/fhir/OrganizationAffiliation/648449
resource:
resourceType: OrganizationAffiliation
id: '648449'
meta:
versionId: '3'
lastUpdated: '2024-01-23T17:00:12.326+00:00'
source: '#033821a3d00d51fe'
profile:
- https://fhir.hl7.org.uk/StructureDefinition/UKCore-OrganizationAffiliation
- https://fhir.nhs.uk/England/StructureDefinition/England-OrganizationAffiliation-ODS
extension:
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Legal
display: Legal
- url: period
valuePeriod:
start: '2020-04-01'
end: '2020-09-22'
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Operational
display: Operational
- url: period
valuePeriod:
start: '2020-04-01'
end: '2020-09-22'
identifier:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/organization-relationship-instance
value: '648449'
active: false
period:
start: '2020-04-01'
end: '2020-09-22'
organization:
reference: Organization/FDC49
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: FDC49
participatingOrganization:
reference: Organization/QWO
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: QWO
code:
- coding:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/ODSRelationship
code: RE5
display: IS LOCATED IN THE GEOGRAPHY OF
search:
mode: match
- fullUrl: https://jenkins.ods.dc4h.link/fhir/OrganizationAffiliation/716945
resource:
resourceType: OrganizationAffiliation
id: '716945'
meta:
versionId: '3'
lastUpdated: '2024-01-23T17:23:48.733+00:00'
source: '#8e8ca746678177d7'
profile:
- https://fhir.hl7.org.uk/StructureDefinition/UKCore-OrganizationAffiliation
- https://fhir.nhs.uk/England/StructureDefinition/England-OrganizationAffiliation-ODS
extension:
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Legal
display: Legal
- url: period
valuePeriod:
start: '2020-09-23'
- url: https://fhir.nhs.uk/England/StructureDefinition/Extension-England-TypedPeriod
extension:
- url: dateType
valueCoding:
system: https://fhir.nhs.uk/England/CodeSystem/England-PeriodType
code: Operational
display: Operational
- url: period
valuePeriod:
start: '2020-09-23'
identifier:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/organization-relationship-instance
value: '716945'
active: true
period:
start: '2020-09-23'
organization:
reference: Organization/FDC49
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: FDC49
participatingOrganization:
reference: Organization/QF7
identifier:
system: https://fhir.nhs.uk/Id/ods-organization-code
value: QF7
code:
- coding:
- system: https://digital.nhs.uk/services/organisation-data-service/CodeSystem/ODSRelationship
code: RE5
display: IS LOCATED IN THE GEOGRAPHY OF
search:
mode: match
4XX:
description: 'An error occurred as follows:
| HTTP Code | issue.severity | issue.code | issue.details.code | issue.details.display |
|------------ |----------------|---------------|---------------------|--------------------- |
|400 |error |invalid |HAPI-1940 |Invalid Date/Time/Quantity format |
|400 |error |invalid |HAPI-0524 |Unknown Search Parameter|
|404 |error |invalid |HAPI-2001 |Organization not found |
|405 |error |method not allowed|HAPI-0427 |Method Not Allowed |
'
content:
application/fhir+json:
example:
resourceType: OperationOutcome
id: 82c75580-1702-469e-aec1-43034b48f060
meta:
profile: https://fhir.nhs.uk/STU3/StructureDefinition/Spine-OperationOutcome-1
issue:
- severity: error
code: invalid
details:
coding:
system: https://fhir.nhs.uk/STU3/CodeSystem/Spine-ErrorOrWarningCode-1
code: INVALID_PARAMETER
display: Invalid parameter
diagnostics: Unknown argument found - nam
tags:
- OrganizationAffiliation