OpeningHoursFilter extends FilterBase
OpeningHoursFilter is a filter type that can be used to filter Medical Services by opening hours.
OpeningHoursFilter type describes a filter list, where subfilters should be rendered for the user to be able to filter opening hour sections for each day of the week.
|
Property name |
Property type |
Property description |
|---|---|---|
|
text |
string |
Localised text of the Filter |
|
type |
FilterType = ‘FILTER_LIST’ |
Type of the Filter |
|
filters |
|
Filters to render |
See DayFilterKey type and DayFilter for the contained filters property’s filters.
When using the filter, the top-level key of it will be openingHours, followed by keys of the filters property: mon, tue, wed, thu, fri, sat, sun. User selected values should be added under these keys. See detailed instructions below – but a simple example of a monday forenoon opening filter request body would simply be:
{
"openingHours": {
"mon": ["9f609b60-ab5a-42f9-8038-b1b8291f54db"]
}
}
Example response
An example of an OpeningHoursFilter retrieved from GET /v1/services/filters endpoint looks like this:
{
"openingHours": {
"text": "Opening Hours",
"type": "FILTER_LIST",
"filters": {
"mon": {
"text": "Monday",
"type": "MULTISELECT",
"shortText": "Mon",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
},
"tue": {
"text": "Tuesday",
"type": "MULTISELECT",
"shortText": "Tue",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
},
"wed": {
"text": "Wednesday",
"type": "MULTISELECT",
"shortText": "Wed",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
},
"thu": {
"text": "Thursday",
"type": "MULTISELECT",
"shortText": "Thu",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
},
"fri": {
"text": "Friday",
"type": "MULTISELECT",
"shortText": "Fri",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
},
"sat": {
"text": "Saturday",
"type": "MULTISELECT",
"shortText": "Sat",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
},
"sun": {
"text": "Sunday",
"type": "MULTISELECT",
"shortText": "Sun",
"values": [
{
"text": "Forenoon",
"value": "9f609b60-ab5a-42f9-8038-b1b8291f54db",
"code": "FORENOON"
},
{
"text": "Afternoon",
"value": "a806eb0f-8746-4b9c-a930-98e10efa7dfd",
"code": "AFTERNOON"
}
]
}
}
}
}
Example request
After the filter was rendered, filled and submitted by the user, its value should be sent to POST /v1/services/filters/apply endpoint.
Location filter is always mandatory
The request body would look like this:
{
"openingHours": {
"mon": ["9f609b60-ab5a-42f9-8038-b1b8291f54db"]
},
"location": {
"latitude": 48.218323,
"longitude": 16.324020
}
}
The opening hour value sent is the value of Monday forenoon in the response above.
This will return the Medical Services that are open sometime before noon on Monday, restricted by the endpoint’s limits.
When multiple values are sent, they are interpreted with OR relation. The user will see every service that is open at any of the selected opening sections.