ALISS

Introduction to ALISS🔗︎ click to copy

Mydex Data Services CIC provides an API known as the 'Master Reference Data Services' or MRD. This API provides access to a variety of non-personal, general purpose datasets that may be of use when integrating with the rest of the Mydex platform.

One of these services or datasets is the ALISS (A Local Information System for Scotland), which itself is also offered to the public (see https://www.aliss.org) . ALISS is a service designed to help citizens find help and support close to you when you need it most. ALISS is maintained and published by the Health and Social Care Alliance Scotland (the ALLIANCE) and is funded by the Scottish Government.

Mydex consumes the ALISS API from the upstream source.

The upstream ALISS API lists all individual services. Within each service record there may exist a set of 'location', 'organisation' and 'category' data (thereby, each service record holds duplicate information for these subsets of data).

Mydex's MRD API adds mapping tables that split out locations, service areas, organisations and categories into separate tables. This allows more complex joining of services to those other attributes, or the ability to search by location, category or service area to find services (rather than having to search for the services first). Mydex's API also allows more complex filtering and combinations in the search, along with sorting options.

To find out how to authenticate to the MRD to access this service, please visit the MRD Authentication instructions.

This guide explains:

If you encounter issues either getting authenticated to or using the MRD API, please contact support@mydex.org . Our team is ready and always happy to help you with any issues.

Getting ALISS data🔗︎ click to copy

There are two types of request that can be made: Generic search and requesting services by their id. The basic routes for those requests are as follows:

Using the search route 🔗︎ click to copy

Please Note: Mydex also offers a Cross-Service search capability for unified search results across the different MRD services you are subscribed to. Click here to find out more.

A call to the base route aliss/get-services/search will return unfiltered services (note: default parameters are applied as detailed below).

Results can be filtered by specifying which filters to apply in the filters query parameter.

A request result can be further organised through ordering and pagination.

  • Filtering results
  • Ordering and pagination
  • Example requests

Filtering results is achieved by adding a filters query parameter.

The filters query parameter is an array that defines the filter parameters dataset, field, value, operator and condition for each filter. In other words: what part of the data to filter on, the value to filter on, if the results returned should be equal to, like or in a group of this value and, if multiple filters are passed, should the results satisfy as per AND or OR conditions?

Here's an example of a request that applies filters:

            https://api-mrd.mydex.org/aliss/get-services/search
            ?filters[service_areas][0][field]=name
            &filters[service_areas][0][operator]==
            &filters[service_areas][0][value]=Dumfries and Galloway
            &filters[service_areas][0][condition]=OR
            &filters[locations][0][field]=postal_code
            &filters[locations][0][operator]=LIKE
            &filters[locations][0][value]=EH3
            &filters[locations][0][condition]=AND
            &filters[locations][1][field]=postal_code
            &filters[locations][1][operator]=LIKE
            &filters[locations][1][value]=EH9
        

Click below for more detail on valid values that can be added to a filtered query:

Filter structure and their valid values

Each filter is structured as follows: filters[dataset][index][filter parameter]=value

The following table details each element of a filter and what the acceptable values are:

Filter element Description Validation Example
[dataset] The dataset we want to filter on. See all valid datasets in the table below. 'categories'
[index] The position in the dataset array of the filter. Note that each dataset filter is an array of filters. This enables adding multiple filters for a single dataset. The index, 0, 1, 2, ... and so on, determines the position of each filter for the given dataset. It's important to remember to increment the indexes for filters on the same dataset. If you forget to do this, only the last filter for that dataset will be applied. Must be numerical '2'
[filter parameter] Each filter indexed by a valid dataset must contain the keys field, operator, value. A further condition key is required for each additional filter (not required where a request contains only 1 filter or it is the last filter added). 'field', 'operator', 'value' see the table outlining these filter parameters for more on what values can be assigned to each of them. 'operator'

Valid filter parameters and their values

The following table outlines the filter parameters required for each filter and the valid values that can be assigned in each case.

Parameter Description Validation Example
[field] The field we want to filter on. See all valid fields in the table below. 'slug'
[operator] The operator we want to filter on i.e. should the field value be equal to, partially equal to or match with one or more of a group of values?. The only valid operators are IN, LIKE and = 'IN'
[value] The value to use to filter the results. Must be alphanumeric and can include commas, hyphens, underscores, and spaces. 'children,families,rights'
[condition] The condition we want to apply between filters: do we only want results where both filters exist in each result, or do we want results where either filter exists in each result? AND or OR. This should only be added if there is a subsequent filter. 'OR'

Valid dataset / fields

The following table outlines the valid dataset / fields that can be filtered on.

Dataset Fields Description
services id, name, description The id or name of the service
organisations name The name of the service's organisation
categories name, slug The name or the slug appearing in the service's categories
service_areas name, type, code The name, type or code appearing in the service's service areas
locations name, locality, postal_code The name, locality or post code appearing in the service's locations
accessibility_features name, slug The name, or slug appearing in the service's accessibility features
community_groups name, slug The name, or slug appearing in the service's community groups

Request results can be organised by adding the following query parameters in any combination:

Query Parameter Description Validation Example
order_by The order_by parameter specifies which dataset/field to order the results on. Must be a valid dataset, field combination in the format {dataset}.{field}. Acceptable values are: 'services.id', 'services.name' or 'organisations.name'. If this parameter is not included in the request, the default value is 'services.id'. order_by='organisations.name'
order The order parameter specfies the order the results should be returned in, either ascending (ASC) or descending (DESC). Either 'ASC' or 'DESC'. If this parameter is not included in the request, the default value is 'ASC'. order='DESC'
after The after parameter specifies results to be returned after this value. This is linked to the order_by and order values e.g. if we are ordering on services.name in ascending order, and after is set to 'GZ', then only results where the services.name comes after 'GZ' will be returned. Must be alphanumeric and can include commas, hyphens, underscores, and spaces. There is no default value for this parameter. after='0fd16520-99a5-4d68-bf76-6df585109134'
before The before parameter specifies results to be returned before this value. This is linked to the order_by and order values e.g. if we are ordering on services.name in ascending order, and before is set to 'H', then only results where the services.name comes before 'H' will be returned. Must be alphanumeric and can include commas, hyphens, underscores, and spaces. There is no default value for this parameter. before='0fd16520-99a5-4d68-bf76-6df585109134'
limit The limit parameter specifies the maximum number of results to return. Must be assigned a numerical value e.g. '5'. The default value for this is 20 and the maximum that can be requested is 100. limit='50'
format The format parameter specifies how the results are to be formatted: either JSON or XML. Must be either 'JSON' or 'XML'. Default value is 'JSON'. format='XML'
geojson The geojson parameter specifies if 'geojson' data is to be included in the results. The 'geojson' element forms part of each service_area, however this is not returned by default. If the 'geojson' element is required, it can be requested by passing this query parameter and setting it to true. Either 'true' or 'false' geojson='true'

The following examples are designed to help in thinking about the types of scenarios and requests you might want to make. They should also go some way to further helping in understanding how a filter request is constructed.

Filtering services alphabetically

Scenario: You want to arrange the entire ALISS directory alphabetically by service name.

At its most basic, this request makes use of the key-set pagination query parameters after and before.

Summary of requests

Return unfiltered ALISS results. By default, only 20 items are returned (use limit query parameter to increase up to 100 results). Example:
aliss/get-services/search
If we want to return only services with a name beginning with the letter 'A' then we might consider requesting only results with a service name that comes before the letter 'B'. This will work by making sure that the results are ordered by the services names and we only get results before names equalling 'B' i.e. names beginning with 'A'. Note that the default order of the results is ascending so we don't need to pass the order query parameter. Example:
aliss/get-services/search?order_by=services.name&before=B
Now let's say we want the names starting with the next letter in the alphabet 'B'. It makes sense that these names (in ascending order) would be > 'AZ' and < 'C'. Example:
aliss/get-services/search?order_by=services.name&after=AZ&before=C
Perhaps we only want 5 results per page. Applying the limit parameter will define the maximum number of results returned, in this case 5. We would then want to capture the last service name and add it to the query to get the next 5 (max) results. Examples:
aliss/get-services/search?order_by=services.name&after=AZ&before=C&limit=5
aliss/get-services/search?order_by=services.name&after=Baby Bee Massage and Yoga Classes&before=C&limit=5

Filtering services by location

Scenario: You want to return only results for a specific location or locations.

This request will require a filters parameter to be added

Summary of requests

Return any services where the service has a locations.locality that is equal to 'Edinburgh'. Note the default limit is 20 results, so unless a limit query parameter is set, the number of results will be max 20. Example:
aliss/get-services/search?filters[locations][0][field]=locality
&filters[locations][0][operator]==
&filters[locations][0][value]=Edinburgh
Same as above, but requesting the maximum number of results permitted: 100. Example:
aliss/get-services/search?filters[locations][0][field]=locality
&filters[locations][0][operator]==
&filters[locations][0][value]=Edinburgh
&limit=100
Now we want to include results for 'Glasgow' too. This works using the OR condition between the 2 filters. Remember to correctly index your filters if you are applying more than one per dataset. In this case we have 2 filters for the dataset 'locations'. Example:
aliss/get-services/search?filters[locations][0][field]=locality
&filters[locations][0][operator]==
&filters[locations][0][value]=Edinburgh
&filters[locations][0][condition]=OR
&filters[locations][1][field]=locality
&filters[locations][1][operator]==
&filters[locations][1][value]=Glasgow
This time we want results for Edinburgh, but we have specified a partial postcode 'EH9'. Using the AND condition between the 2 filters means that a service must have the locality equal to 'Edinburgh' AND the postal_code like 'EH9' in order to be returned. Example:
aliss/get-services/search?filters[locations][0][field]=locality
&filters[locations][0][operator]==
&filters[locations][0][value]=Edinburgh
&filters[locations][0][condition]=AND
&filters[locations][1][field]=postal_code
&filters[locations][1][operator]=LIKE
&filters[locations][1][value]=EH9

Filtering services by location and category

Scenario: You want to return only results for a specific location or locations for a given category.

This request will require a filters parameter to be added

Summary of requests

Get services in Edinburgh for children. This is achieved by building filters that stipulate: the locations.locality for each service must be 'Edinburgh' AND the categories.slug must contain the word 'children'. Example:
aliss/get-services/search?filters[locations][0][field]=locality
&filters[locations][0][operator]==
&filters[locations][0][value]=Edinburgh
&filters[locations][0][condition]=AND
&filters[categories][0][field]=slug
&filters[categories][0][operator]=LIKE
&filters[categories][0][value]=children
The same request as above, but this time we are organising our results alphabetically and we only want results with a service name beginning with 'A'. Example:
aliss/get-services/search?filters[locations][0][field]=locality
&filters[locations][0][operator]==
&filters[locations][0][value]=Edinburgh
&filters[locations][0][condition]=AND
&filters[categories][0][field]=slug
&filters[categories][0][operator]=LIKE
&filters[categories][0][value]=children
&order_by=services.name
&before=B

Using the service-ids route 🔗︎ click to copy

Where you know the id of the specific service/s you want to return, it is possible to make a request in the format:

aliss/get-services/{service-ids}

Where service-ids is a list of one or more service ids delineated by a comma “,”. For example, we can pass 3 service-ids like so:

aliss/get-services/2d29f1ab-d617-45d7-83b5-b755dd6658a4,25525a5e-a405-4ddb-bf50-3a32fe005151,259ea6be-6861-4e45-82ee-5a3ff6eeb6a1

Adding query parameters🔗︎ click to copy

Request results can be organised by adding the following query parameters in any combination:

Query Parameter Description Validation Example
order_by The order_by parameter specifies which dataset/field to order the results on. Must be a valid dataset, field combination in the format {dataset}.{field}. Acceptable values are: 'services.id', 'services.name' or 'organisations.name'. If this parameter is not included in the request, the default value is 'services.id'. order_by='organisations.name'
order The order parameter specfies the order the results should be returned in, either ascending (ASC) or descending (DESC). Either 'ASC' or 'DESC'. If this parameter is not included in the request, the default value is 'ASC'. order='DESC'
format The format parameter specifies how the results are to be formatted: either JSON or XML. Must be either 'JSON' or 'XML'. Default value is 'JSON'. format='XML'
geojson The geojson parameter specifies if 'geojson' data is to be included in the results. The 'geojson' element forms part of each service_area, however this is not returned by default. If the 'geojson' element is required, it can be requested by passing this query parameter and setting it to true. Either 'true' or 'false' geojson='true'

Example responses

See below response examples, showing only the first service returned (as data can be quite long to insert the full example). This will provide an idea of the structure of the data in the response.

Example Response JSON🔗︎ click to copy

    [
        {
        "id": "040e47b5-0d9f-4883-8c29-c271ad3f80b7",
        "name": "Branching Out Argyll",
        "description": "Branching Out Argyll runs innovative programmes of woodland based activities for people with poor mental health. \r\nWith Argyll and the Isles being a large location and all the central areas of population being geographically far apart, loneliness can be a major risk of cognitive decline.\r\n\r\nBy getting people back to nature, Branching Out helps to tackle the problems people face with anxiety, depression and isolation. People overcome their problems together with support and teamwork out in the woods. Whether it’s cooking food on a camp fire, building a shelter, walking, tai-chi or mindfulness.",
        "url": "http://www.act-now.org.uk/en/what-we-do/233-branching-out",
        "email": "branchingout@act-now.org.uk",
        "slug": "branching-out-argyll-0",
        "last_updated": "2018-12-06T10:00:08.82",
        "phone": "01546 602755",
        "organisation": [
            "id": "c9d78550-77f8-496b-8a0e-6bd6b7f8475f",
            "name": "Argyll and the Isles Coast and Countryside Trust",
            "slug": "argyll-and-the-isles-coast-and-countryside-trust-0",
            "is_claimed": "0"
        ],
        "categories": [
            {
                "name": "Mental Health",
                "slug": "mental-health"
            },
            {
                "name": "Physical Activity",
                "slug": "physical-activity"
            },
            {
                "name": "Outdoor Pursuits",
                "slug": "outdoor-pursuits"
            },
            {
                "name": "Conditions",
                "slug": "conditions"
            },
            {
                "name": "Health & Social Care Services",
                "slug": "health-social-care-services"
            },
            {
                "name": "Support Network",
                "slug": "support-network"
            },
            {
                "name": "Activity",
                "slug": "activity"
            }
        ],
        "service_areas": [
            {
                "code": "S12000035",
                "name": "Argyll and Bute",
                "type": "Local Authority"
            }
        ],
        "locations": [
            {
                "formatted_address": "1 Kilmory Industrial Estate, Lochgilphead, PA31 8RR",
                "name": "",
                "description": null,
                "street_address": "1 Kilmory Industrial Estate",
                "locality": "Lochgilphead",
                "region": null,
                "state": null,
                "postal_code": "PA31 8RR",
                "country": "GB",
                "latitude": "56.0267332",
                "longitude": "-5.4256996",
                "id": "d9286637-4b6b-4eca-99d1-77deb25f2973"
            }
        ]
        }
    ]

Example Response XML🔗︎ click to copy

Adding &format=xml to the above example API request, will see the data returned as XML:

    <?xml version="1.0"?>
    <Services>
        <Service>
            <id>040e47b5-0d9f-4883-8c29-c271ad3f80b7</id>
            <name>Branching Out Argyll</name>
            <description>Branching Out Argyll runs innovative programmes of woodland based activities for people with poor mental health. &#xD;
            With Argyll and the Isles being a large location and all the central areas of population being
            geographically far apart, loneliness can be a major risk of cognitive decline.&#xD;
            By getting people back to nature, Branching Out helps to tackle the problems people face with anxiety,
            depression and isolation. People overcome their problems together with support and teamwork out in the
            woods. Whether it&#x2019;s cooking food on a camp fire, building a shelter, walking, tai-chi or mindfulness.
            </description>
            <url>http://www.act-now.org.uk/en/what-we-do/233-branching-out</url>
            <email>branchingout@act-now.org.uk</email>
            <slug>branching-out-argyll-0</slug>
            <last_updated>2018-12-06T10:00:08.82</last_updated>
            <phone>01546 602755</phone>
            <organisation>
                <id>c9d78550-77f8-496b-8a0e-6bd6b7f8475f</id>
                <name>Argyll and the Isles Coast and Countryside Trust</name>
                <slug>argyll-and-the-isles-coast-and-countryside-trust-0</slug>
                <is_claimed>0</is_claimed>
            </organisation>
            <categories>
                <name>Mental Health</name>
                <slug>mental-health</slug>
                <name>Physical Activity</name>
                <slug>physical-activity</slug>
                <name>Outdoor Pursuits</name>
                <slug>outdoor-pursuits</slug>
                <name>Conditions</name>
                <slug>conditions</slug>
                <name>Health &amp; Social Care Services</name>
                <slug>health-social-care-services</slug>
                <name>Support Network</name>
                <slug>support-network</slug>
                <name>Activity</name>
                <slug>activity</slug>
            </categories>
            <service_areas>
                <node>
                    <code>S12000035</code>
                    <name>Argyll and Bute</name>
                    <type>Local Authority</type>
                </node>
            </service_areas>
            <locations>
                <node>
                    <formatted_address>1 Kilmory Industrial Estate, Lochgilphead, PA31 8RR</formatted_address>
                    <name/>
                    <description/>
                    <street_address>1 Kilmory Industrial Estate</street_address>
                    <locality>Lochgilphead</locality>
                    <region/>
                    <state/>
                    <postal_code>PA31 8RR</postal_code>
                    <country>GB</country>
                    <latitude>56.0267332</latitude>
                    <longitude>-5.4256996</longitude>
                    <id>d9286637-4b6b-4eca-99d1-77deb25f2973</id>
                </node>
            </locations>
            <organisation>
                <id>c9d78550-77f8-496b-8a0e-6bd6b7f8475f</id>
                <name>Argyll and the Isles Coast and Countryside Trust</name>
                <slug>argyll-and-the-isles-coast-and-countryside-trust-0</slug>
                <is_claimed>0</is_claimed>
            </organisation>
            </Service>
            <Service>
                <id>c13d575e-a929-4e06-bdcf-1bbbe67042aa</id>
                <name>Buddy dog</name>
                <description>Our bud………..
                &#xD;
                By getting people back to nature, Branching Out helps to tackle the problems people face with anxiety,
                depression and isolation. People overcome their problems together with support and teamwork out in the
                woods. Whether it&#x2019;s cooking food on a camp fire, building a shelter, walking, tai-chi or mindfulness.
            </description>
            <url>http://www.act-now.org.uk/en/what-we-do/233-branching-out</url>
            <email>branchingout@act-now.org.uk</email>
            <slug>branching-out-argyll-0</slug>
            <last_updated>2018-12-06T10:00:08.82</last_updated>
            <phone>01546 602755</phone>
            <categories>
                <name>Mental Health</name>
                <slug>mental-health</slug>
                <name>Physical Activity</name>
                <slug>physical-activity</slug>
                <name>Outdoor Pursuits</name>
                <slug>outdoor-pursuits</slug>
                <name>Conditions</name>
                <slug>conditions</slug>
                <name>Health &amp; Social Care Services</name>
                <slug>health-social-care-services</slug>
                <name>Support Network</name>
                <slug>support-network</slug>
                <name>Activity</name>
                <slug>activity</slug>
            </categories>
            <service_areas>
                <node>
                    <code>S12000035</code>
                    <name>Argyll and Bute</name>
                    <type>Local Authority</type>
                </node>
            </service_areas>
            <locations>
                <node>
                    <formatted_address>1 Kilmory Industrial Estate, Lochgilphead, PA31 8RR</formatted_address>
                    <name/>
                    <description/>
                    <street_address>1 Kilmory Industrial Estate</street_address>
                    <locality>Lochgilphead</locality>
                    <region/>
                    <state/>
                    <postal_code>PA31 8RR</postal_code>
                    <country>GB</country>
                    <latitude>56.0267332</latitude>
                    <longitude>-5.4256996</longitude>
                    <id>d9286637-4b6b-4eca-99d1-77deb25f2973</id>
                </node>
            </locations>
        </Service>
        <Service>
            <id>c13d575e-a929-4e06-bdcf-1bbbe67042aa</id>
            <name>Buddy dog</name>
            <description>Our bud………..