Hi, I am trying to obtain all active relationships with a value of RE4 using the URL: https://sandbox.api.service.nhs.uk/organisation-data-terminology-api/fhir/OrganizationAffiliation?role=RE4&_count=1000&active=true.
Is it possible to just obtain these RE4 relationships with GP practices as the organization (roleCode RO76 in the /organization codesystem), rather than bringing back every single RE4 relationship in the /Organizationaffiliation codesystem?
Hi
You will need to query the organization-relationship-instance codesystem and use a POST request to this URL:
’ https://sandbox.api.service.nhs.uk/organisation-data-terminology-api/fhir/ValueSet/$expand
with this JSON body:
{
“resourceType”: “Parameters”,
“parameter”: [
{
“name”: “valueSet”,
“resource”: {
“resourceType”: “ValueSet”,
“compose”: {
“inactive”: false,
“include”: [
{
“system”: “https://digital.nhs.uk/services/organisation-data-service/CodeSystem/organization-relationship-instance”,
“filter”: [
{
“property”: “relationshipTypeCode”,
“op”: “=”,
“value”: “RE4”
},
{
“property”: “sourceOrgRole”,
“op”: “=”,
“value”: “RO76”
}
]
}
]
}
}
},
{
“name”: “activeOnly”,
“valueBoolean”: false
},
{
“name”: “property”,
“valueString”: “*”
},
{
“name”: “count”,
“valueInteger”: 1000
}
]
}
That will return the first 1000 records from the search results. To get the next 1000, make another call and include an offset property in the JSON body like this:
{
“name”: “offset”,
“valueInteger”: 1000
}
Then repeat the call, incrementing the offset each time (1000, 2000, 3000, etc), until you have all of the records.
The response will contain a total which you can use to know how many subsequent calls are needed to get all the results, i.e.:
“total”: 6765,
Thanks, ODS
Thank you, that’s exactly what I needed