From e07a92116c279e82ed77a5bb5c12a9c821db10e5 Mon Sep 17 00:00:00 2001 From: Eric Hoekstra Date: Tue, 30 Jul 2024 16:21:15 +0200 Subject: [PATCH] Authorisation added to population statistics API. --- paths/population_statistics.yaml | 9 +-- .../population_statistics_authorisation.yaml | 56 ++++++++++++++++++ ..._authorisation_{item}_caregroup_{tag}.yaml | 58 +++++++++++++++++++ ...tistics_authorisation_{item}_practice.yaml | 56 ++++++++++++++++++ paths/population_statistics_groupByItems.yaml | 15 +++-- schemas/StatisticsGroupBy-enum.yaml | 9 +++ schemas/tag.yaml | 3 + zoo-api.yaml | 12 ++-- 8 files changed, 199 insertions(+), 19 deletions(-) create mode 100644 paths/population_statistics_authorisation.yaml create mode 100644 paths/population_statistics_authorisation_{item}_caregroup_{tag}.yaml create mode 100644 paths/population_statistics_authorisation_{item}_practice.yaml create mode 100644 schemas/StatisticsGroupBy-enum.yaml create mode 100644 schemas/tag.yaml diff --git a/paths/population_statistics.yaml b/paths/population_statistics.yaml index 1f6a2f4..aaf5f30 100644 --- a/paths/population_statistics.yaml +++ b/paths/population_statistics.yaml @@ -2,7 +2,7 @@ get: tags: - Population statistics operationId: populationStatistics - summary: Population group-by + summary: Common statistics description: |- Groups the patient population by any combination of age, preferred doctor, etc. and calculates the count of each category. parameters: @@ -14,12 +14,7 @@ get: type: array minItems: 1 items: - type: string - enum: - - age - - preferredDoctor - - insurer - - gender + $ref: '../schemas/StatisticsGroupBy-enum.yaml' description: |- Several items can be added to the group by using a comma separated list, e.g. `groupByItems=gender,age`. If an item is twice or more repeated the first occurrence is used. diff --git a/paths/population_statistics_authorisation.yaml b/paths/population_statistics_authorisation.yaml new file mode 100644 index 0000000..f2d987e --- /dev/null +++ b/paths/population_statistics_authorisation.yaml @@ -0,0 +1,56 @@ +get: + tags: + - Population statistics + operationId: getStatisticsAuthorisation + summary: Authorisation + description: Reports the authorisations for group-by items for the specified practice(s). Care groups are allowed to query the authorisations of the underlying practices. Practices are allowed to query their own settings. + parameters: + - name: agbs + in: query + schema: + type: array + items: + $ref: ../schemas/agb.yaml + required: true + description: The agb of the practice(s) for which the authorisations should be reported. + responses: + 200: + description: An array with for each practice an object describing the authorisation settings for the practice and for the care groups. + content: + application/json: + schema: + type: array + items: + type: object + properties: + practice: + $ref: '../schemas/agb.yaml' + groupBy: + type: array + items: + type: object + properties: + item: + $ref: ../schemas/StatisticsGroupBy-enum.yaml + enddate: + $ref: ../schemas/date.yaml + active: + type: boolean + description: False if the end date is today or in the past. + caregroups: + type: array + items: + type: object + properties: + tag: + $ref: ../schemas/tag.yaml + agb: + $ref: '../schemas/agb.yaml' + groupBy: + $ref: '#/get/responses/200/content/application~1json/schema/items/properties/groupBy' + 400: + $ref: '../zoo-api.yaml#/components/responses/ReqFailure' + 401: + $ref: '../zoo-api.yaml#/components/responses/JwtFailure' + 404: + $ref: '../zoo-api.yaml#/components/responses/PatNotFound' \ No newline at end of file diff --git a/paths/population_statistics_authorisation_{item}_caregroup_{tag}.yaml b/paths/population_statistics_authorisation_{item}_caregroup_{tag}.yaml new file mode 100644 index 0000000..e3a4afa --- /dev/null +++ b/paths/population_statistics_authorisation_{item}_caregroup_{tag}.yaml @@ -0,0 +1,58 @@ +post: + tags: + - Population statistics + operationId: setGroupByItemCareGroup + summary: Authorisation of care groups + description: |- + Set the authorisation for statistic group-by items for care groups. This enables or disables the statistic for use by the care group. Only when authorized as the practice the settings may be changed. + parameters: + - name: item + in: path + schema: + $ref: '../schemas/StatisticsGroupBy-enum.yaml' + required: true + - name: tag + in: path + schema: + $ref: '../schemas/tag.yaml' + - name: agb + in: query + schema: + $ref: '../schemas/agb.yaml' + description: AGB of the practice for which the authorisation should be set. This should match the JWT-authorisation. + required: true + - name: enddate + in: query + schema: + $ref: ../schemas/date.yaml + description: End date of the authorisation (exclusive). If omitted no end date is applied, or the end date is removed of an existing authorisation. Setting an end date to today or in past, effectively removes the authorisation. + - name: employee + in: query + schema: + type: string + description: The employee that is adding the authorisation. Any string is accepted, but it is recommended to use a employee code derived from this API. + required: true + responses: + '200': + description: The response parrots the request, except for the `employee` and `timestamp` properties. If the authorisation is changed the `employee` and `timestamp` from the request are responded, but if the request didn't change the authorisation, then the `employee` and `timestamp` from the last change are in the payload. + content: + application/json: + schema: + type: object + properties: + employee: + type: string + timestamp: + $ref: ../schemas/dateTime.yaml + agb: + $ref: ../schemas/agb.yaml + authorizedFor: + $ref: '../schemas/StatisticsGroupBy-enum.yaml' + tag: + $ref: '../schemas/tag.yaml' + enddate: + $ref: '../schemas/date.yaml' + '401': + $ref: '../zoo-api.yaml/#/components/responses/NoAuth' + '403': + $ref: '../zoo-api.yaml/#/components/responses/NoAccess' diff --git a/paths/population_statistics_authorisation_{item}_practice.yaml b/paths/population_statistics_authorisation_{item}_practice.yaml new file mode 100644 index 0000000..7aeea76 --- /dev/null +++ b/paths/population_statistics_authorisation_{item}_practice.yaml @@ -0,0 +1,56 @@ +post: + tags: + - Population statistics + operationId: setGroupByItemPractice + summary: Authorisation of practice + description: |- + Set the authorisation for statistic group-by items for the practice. This enables or disables the statistic for all the employees of the practice at once. Only when authorized as the practice the settings may be changed. + parameters: + - name: 'item' + in: path + schema: + $ref: '../schemas/StatisticsGroupBy-enum.yaml' + required: true + - name: agb + in: query + schema: + $ref: '../schemas/agb.yaml' + description: AGB of the practice for which the authorisation should be set. This should match the JWT-authorisation. + required: true + - name: enddate + in: query + schema: + $ref: ../schemas/date.yaml + description: End date of the authorisation (exclusive). If omitted no end date is applied, or the end date is removed of an existing authorisation. Setting an end date to today or in past, effectively removes the authorisation. + - name: employee + in: query + schema: + type: string + description: The employee that is adding the authorisation. Any string is accepted, but it is recommended to use a employee code derived from this API. + required: true + responses: + '200': + description: The response parrots the request, except for the `employee` and `timestamp` properties. If the authorisation is changed the `employee` and `timestamp` from the request are responded, but if the request didn't change the authorisation, then the `employee` and `timestamp` from the last change are in the payload. + content: + application/json: + schema: + type: object + properties: + employee: + type: string + timestamp: + $ref: ../schemas/dateTime.yaml + agb: + $ref: ../schemas/agb.yaml + authorizedFor: + $ref: '../schemas/StatisticsGroupBy-enum.yaml' + tag: + $ref: '../schemas/tag.yaml' + example: "" + description: Always the empty tag. + enddate: + $ref: '../schemas/date.yaml' + '401': + $ref: '../zoo-api.yaml/#/components/responses/NoAuth' + '403': + $ref: '../zoo-api.yaml/#/components/responses/NoAccess' diff --git a/paths/population_statistics_groupByItems.yaml b/paths/population_statistics_groupByItems.yaml index 6da3b85..5e16aeb 100644 --- a/paths/population_statistics_groupByItems.yaml +++ b/paths/population_statistics_groupByItems.yaml @@ -3,22 +3,21 @@ get: - Population statistics operationId: groupByItems summary: Group-by items + parameters: + - name: agb + in: query + schema: + $ref: ../schemas/agb.yaml responses: 200: description: |- - Returns a list of all available group-by items for the _population group-by end point_, but only if the items are available for the selected customer. A customer is selected by a JWT-claim or the AGB header. The output of this end point should be the same as the documentation for the groupByItems-parameter of the mentioned end point. + Returns a list of all available group-by items for the _common statistics_ end point, but only if the items are available for the customer with `agb`. The output of this end point should be the same as the documentation below. content: application/json: schema: type: array items: - type: string - example: - - age - - preferredDoctor - - insurer - - gender - - deprivedNeighborhood + $ref: ../schemas/StatisticsGroupBy-enum.yaml 400: $ref: '../zoo-api.yaml#/components/responses/ReqFailure' 401: diff --git a/schemas/StatisticsGroupBy-enum.yaml b/schemas/StatisticsGroupBy-enum.yaml new file mode 100644 index 0000000..b46aa5f --- /dev/null +++ b/schemas/StatisticsGroupBy-enum.yaml @@ -0,0 +1,9 @@ +description: Represents an object on which population statistics can be generated. +type: string +enum: + - age + - preferredDoctor + - insurer + - gender + - deprivedNeighborhood +example: age \ No newline at end of file diff --git a/schemas/tag.yaml b/schemas/tag.yaml new file mode 100644 index 0000000..aacbcac --- /dev/null +++ b/schemas/tag.yaml @@ -0,0 +1,3 @@ +type: string +example: HZK +description: A tags represents some entity in which the practice can be classified, e.g. care group or district. The empty tag represents the practice itself. \ No newline at end of file diff --git a/zoo-api.yaml b/zoo-api.yaml index 31fbf44..cee88cf 100644 --- a/zoo-api.yaml +++ b/zoo-api.yaml @@ -55,8 +55,6 @@ paths: $ref: 'paths/patient_fundusByPractice.yaml' /population/statistics: $ref: 'paths/population_statistics.yaml' - /population/statistics/groupByItems: - $ref: 'paths/population_statistics_groupByItems.yaml' /population/statistics/deprivedNeighborhood: $ref: 'paths/population_statistics_deprived.yaml' /population/statistics/deprivedNeighborhood/{neighborhood}: @@ -69,6 +67,14 @@ paths: $ref: 'paths/population_frequentUser_patients.yaml' /population/frequentUser/patient: $ref: 'paths/population_frequentUser_patient.yaml' + /population/statistics/authorisation: + $ref: 'paths/population_statistics_authorisation.yaml' + /population/statistics/authorisation/{item}/practice: + $ref: 'paths/population_statistics_authorisation_{item}_practice.yaml' + /population/statistics/authorisation/{item}/caregroup/{tag}: + $ref: 'paths/population_statistics_authorisation_{item}_caregroup_{tag}.yaml' + /population/statistics/groupByItems: + $ref: 'paths/population_statistics_groupByItems.yaml' /qoc/careprogram: $ref: 'paths/qoc_careprogram.yaml' /qoc/checkupList/{setKey}: @@ -245,5 +251,3 @@ components: expExpires atOPTIONAL If included, the request must not be received after this time. May be up to 10 minutes in the future. The difference between the exp claim and the iat must be 20 minutes or less and iat < exp. nbfNot beforeOPTIONAL If included, the request must not be received before this time. Should not be set in the future. - -