From ccc3b970e2ee5e091f7b010a79ebf4a169cca6a1 Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 24 May 2023 17:26:22 +1200 Subject: [PATCH 01/18] export report endpoint wip --- reference/export.v1.yaml | 100 ++++++++++++------ reference/export/models/newreport.v1.yaml | 19 ++++ reference/export/models/queryAGP.v1.yaml | 36 +++++++ reference/export/models/queryBGLog.v1.yaml | 36 +++++++ reference/export/models/queryBasics.v1.yaml | 42 ++++++++ reference/export/models/queryDaily.v1.yaml | 39 +++++++ reference/export/models/querySettings.v1.yaml | 14 +++ reference/export/models/reportBGPrefs.v1.yaml | 45 ++++++++ .../export/models/reportBGSource.v1.yaml | 7 ++ .../export/models/reportEndpoints.v1.yaml | 9 ++ .../reportExcludeDaysWithoutBolus.v1.yaml | 3 + .../models/reportExcludedDevices.v1.yaml | 5 + .../export/models/reportMetaData.v1.yaml | 3 + reference/export/models/reportStats.v1.yaml | 17 +++ .../export/models/reportTimePrefs.v1.yaml | 8 ++ reference/export/models/reportTypes.v1.yaml | 28 +++++ 16 files changed, 378 insertions(+), 33 deletions(-) create mode 100644 reference/export/models/newreport.v1.yaml create mode 100644 reference/export/models/queryAGP.v1.yaml create mode 100644 reference/export/models/queryBGLog.v1.yaml create mode 100644 reference/export/models/queryBasics.v1.yaml create mode 100644 reference/export/models/queryDaily.v1.yaml create mode 100644 reference/export/models/querySettings.v1.yaml create mode 100644 reference/export/models/reportBGPrefs.v1.yaml create mode 100644 reference/export/models/reportBGSource.v1.yaml create mode 100644 reference/export/models/reportEndpoints.v1.yaml create mode 100644 reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml create mode 100644 reference/export/models/reportExcludedDevices.v1.yaml create mode 100644 reference/export/models/reportMetaData.v1.yaml create mode 100644 reference/export/models/reportStats.v1.yaml create mode 100644 reference/export/models/reportTimePrefs.v1.yaml create mode 100644 reference/export/models/reportTypes.v1.yaml diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index 09c65df3..71c6aa54 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Export API - version: '1.0' + version: "1.0" description: |- The Tidepool API is an HTTP REST API used by Tidepool clients use to communicate with the Tidepool Platform. @@ -17,15 +17,15 @@ info: x-tidepool-service: https://github.com/tidepool-org/export servers: - - url: 'https://external.integration.tidepool.org' + - url: "https://external.integration.tidepool.org" description: integration - - url: 'https://api.tidepool.org' + - url: "https://api.tidepool.org" description: production - - url: 'https://dev1.dev.tidepool.org' + - url: "https://dev1.dev.tidepool.org" description: dev1 - - url: 'https://qa1.development.tidepool.org' + - url: "https://qa1.development.tidepool.org" description: qa1 - - url: 'https://qa2.development.tidepool.org' + - url: "https://qa2.development.tidepool.org" description: qa2 tags: @@ -37,9 +37,9 @@ tags: Enable bulk export of diabetes data from user's Tidepool account. paths: - '/export/{userId}': + "/export/{userId}": parameters: - - $ref: './common/parameters/tidepooluserid.yaml' + - $ref: "./common/parameters/tidepooluserid.yaml" get: operationId: ExportUserData summary: Export user data @@ -47,56 +47,90 @@ paths: Exports the diabetes data from user identified by `userId`, from `startDate` to `endDate`, in the requested `format`. Either a Tidepool session token, or a restricted token must be supplied. parameters: - - $ref: './export/parameters/startdate.v1.yaml' - - $ref: './export/parameters/enddate.v1.yaml' - - $ref: './export/parameters/format.v1.yaml' - - $ref: './export/parameters/glucoseunits.v1.yaml' + - $ref: "./export/parameters/startdate.v1.yaml" + - $ref: "./export/parameters/enddate.v1.yaml" + - $ref: "./export/parameters/format.v1.yaml" + - $ref: "./export/parameters/glucoseunits.v1.yaml" responses: - '200': + "200": description: >- User data exported in the requested `format`. headers: Content-Disposition: - $ref: './common/headers/contentdisposition.v1.yaml' + $ref: "./common/headers/contentdisposition.v1.yaml" content: - 'application/json': + "application/json": schema: - $ref: './export/models/json.v1.yaml' - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': + $ref: "./export/models/json.v1.yaml" + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": schema: - $ref: './export/models/excel.v1.yaml' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '403': - $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/ServerError' + $ref: "./export/models/excel.v1.yaml" + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/ServerError" + security: + - sessionToken: [] + - restrictedToken: [] + tags: + - Export + - Internal + "/export/report/{userId}": + parameters: + - $ref: "./common/parameters/tidepooluserid.yaml" + post: + operationId: ExportUserReport + summary: Export user report + description: >- + User report exported in with the requested options. + requestBody: + content: + application/json: + schema: + $ref: "./export/models/newreport.v1.yaml" + responses: + "200": + description: A PDF report for the given user + content: + application/pdf: + schema: + type: string + format: binary + "400": + $ref: "#/components/responses/BadRequest" + "401": + $ref: "#/components/responses/Unauthorized" + "403": + $ref: "#/components/responses/Forbidden" + "500": + $ref: "#/components/responses/ServerError" security: - sessionToken: [] - restrictedToken: [] tags: - Export - Internal - components: securitySchemes: sessionToken: - $ref: './common/security/tidepoolsessiontoken.v1.yaml' + $ref: "./common/security/tidepoolsessiontoken.v1.yaml" restrictedToken: - $ref: './common/security/tidepoolrestrictedtoken.v1.yaml' + $ref: "./common/security/tidepoolrestrictedtoken.v1.yaml" responses: BadRequest: - description: 'Bad Request' + description: "Bad Request" Unauthorized: - description: 'Unauthorized' + description: "Unauthorized" Forbidden: - description: 'Forbidden' + description: "Forbidden" ServerError: - description: 'Server Error' + description: "Server Error" diff --git a/reference/export/models/newreport.v1.yaml b/reference/export/models/newreport.v1.yaml new file mode 100644 index 00000000..a921c15b --- /dev/null +++ b/reference/export/models/newreport.v1.yaml @@ -0,0 +1,19 @@ +title: New Report +description: >- + User report +type: object +properties: + queries: + type: object + minProperties: 1 + properties: + agp: + - $ref: "./queryAGP.v1.yaml" + daily: + - $ref: "./queryDaily.v1.yaml" + settings: + - $ref: "./querySettings.v1.yaml" + bgLog: + - $ref: "./queryBGLog.v1.yaml" + basics: + - $ref: "./queryBasics.v1.yaml" diff --git a/reference/export/models/queryAGP.v1.yaml b/reference/export/models/queryAGP.v1.yaml new file mode 100644 index 00000000..1827a03a --- /dev/null +++ b/reference/export/models/queryAGP.v1.yaml @@ -0,0 +1,36 @@ +title: AGP Report Query +type: object +properties: + endpoints: + - $ref: "./reportEndpoints.v1.yaml" + aggregationsByDate: + type: string + value: 'dataByDate, statsByDate' + bgPrefs: + - $ref: "./reportBGPrefs.v1.yaml" + bgSource: + - $ref: "./reportBGSource.v1.yaml" + excludedDevices: + - $ref: "./reportExcludedDevices.v1.yaml" + timePrefs: + - $ref: "./reportTimePrefs.v1.yaml" + metaData: + - $ref: "./reportMetaData.v1.yaml" + types: + - $ref: "./reportTypes.v1.yaml" + value: { cbg } + stats: + - $ref: "./reportStats.v1.yaml" + value: + [ + "timeInRange", + "averageGlucose", + "sensorUsage", + "glucoseManagementIndicator", + "coefficientOfVariation", + ] +required: + - endpoints + - timePrefs + - bgPrefs + - bgSource diff --git a/reference/export/models/queryBGLog.v1.yaml b/reference/export/models/queryBGLog.v1.yaml new file mode 100644 index 00000000..64f8ccf5 --- /dev/null +++ b/reference/export/models/queryBGLog.v1.yaml @@ -0,0 +1,36 @@ +title: BG Log Report Query +type: object +properties: + endpoints: + - $ref: "./reportEndpoints.v1.yaml" + aggregationsByDate: + type: string + value: 'basals, boluses, fingersticks, siteChanges' + bgSource: + - $ref: './reportBGSource.v1.yaml' + value: smbg + bgPrefs: + - $ref: "./reportBGPrefs.v1.yaml" + timePrefs: + - $ref: "./reportTimePrefs.v1.yaml" + stats: + - $ref: "./reportStats.v1.yaml" + value: + [ + "readingsInRange", + "averageGlucose", + "standardDev", + "coefficientOfVariation", + ] + excludedDevices: + - $ref: "./reportExcludedDevices.v1.yaml" + metaData: + - $ref: "./reportMetaData.v1.yaml" + types: + - $ref: "./reportTypes.v1.yaml" + value: { smbg } +required: + - endpoints + - aggregationsByDate + - stats + - excludeDaysWithoutBolus diff --git a/reference/export/models/queryBasics.v1.yaml b/reference/export/models/queryBasics.v1.yaml new file mode 100644 index 00000000..a82ff40e --- /dev/null +++ b/reference/export/models/queryBasics.v1.yaml @@ -0,0 +1,42 @@ +title: Basics Report Query +type: object +properties: + endpoints: + - $ref: "./reportEndpoints.v1.yaml" + aggregationsByDate: + type: string + value: "basals, boluses, fingersticks, siteChanges" + bgPrefs: + - $ref: "./reportBGPrefs.v1.yaml" + bgSource: + - $ref: "./reportBGSource.v1.yaml" + stats: + - $ref: "./reportStats.v1.yaml" + value: + [ + "timeInRange", + "averageGlucose", + "sensorUsage", + "totalInsulin", + "timeInAuto", + "timeInOverride", + "carbs", + "averageDailyDose", + "glucoseManagementIndicator", + "standardDev", + "coefficientOfVariation", + "bgExtents", + ] + timePrefs: + - $ref: "./reportTimePrefs.v1.yaml" + excludeDaysWithoutBolus: + - $ref: "./reportExcludeDaysWithoutBolus.v1.yaml" + excludedDevices: + - $ref: "./reportExcludedDevices.v1.yaml" + metaData: + - $ref: "./reportMetaData.v1.yaml" +required: + - endpoints + - timePrefs + - bgPrefs + - bgSource diff --git a/reference/export/models/queryDaily.v1.yaml b/reference/export/models/queryDaily.v1.yaml new file mode 100644 index 00000000..1df68854 --- /dev/null +++ b/reference/export/models/queryDaily.v1.yaml @@ -0,0 +1,39 @@ +title: Daily Charts Report Query +type: object +properties: + endpoints: + - $ref: "./reportEndpoints.v1.yaml" + aggregationsByDate: + type: string + value: "dataByDate, statsByDate" + bgPrefs: + - $ref: "./reportBGPrefs.v1.yaml" + bgSource: + - $ref: "./reportBGSource.v1.yaml" + stats: + - $ref: "./reportStats.v1.yaml" + value: + [ + "timeInRange", + "averageGlucose", + "totalInsulin", + "timeInAuto", + "timeInOverride", + "carbs", + "standardDev", + "coefficientOfVariation", + ] + excludedDevices: + - $ref: "./reportExcludedDevices.v1.yaml" + metaData: + - $ref: "./reportMetaData.v1.yaml" + timePrefs: + - $ref: "./reportTimePrefs.v1.yaml" + types: + - $ref: "./reportTypes.v1.yaml" + value: { basal, bolus, cbg, deviceEvent, food, message, smbg, wizard } +required: + - endpoints + - bgPrefs + - timePrefs + - bgSource diff --git a/reference/export/models/querySettings.v1.yaml b/reference/export/models/querySettings.v1.yaml new file mode 100644 index 00000000..5864e471 --- /dev/null +++ b/reference/export/models/querySettings.v1.yaml @@ -0,0 +1,14 @@ +title: Settings Report Query +type: object +properties: + bgPrefs: + - $ref: "./reportBGPrefs.v1.yaml" + timePrefs: + - $ref: "./reportTimePrefs.v1.yaml" + excludedDevices: + - $ref: "./reportExcludedDevices.v1.yaml" + metaData: + - $ref: "./reportMetaData.v1.yaml" +required: + - bgPrefs + - timePrefs diff --git a/reference/export/models/reportBGPrefs.v1.yaml b/reference/export/models/reportBGPrefs.v1.yaml new file mode 100644 index 00000000..46bfbcc2 --- /dev/null +++ b/reference/export/models/reportBGPrefs.v1.yaml @@ -0,0 +1,45 @@ +title: Report BG Preferences +type: object +properties: + bgBounds: + type: object + properties: + clampThreshold: + type: number + targetLowerBound: + type: number + targetUpperBound: + type: number + veryHighThreshold: + type: number + veryLowThreshold: + type: number + bgClasses: + type: object + properties: + high: + type: object + properties: + boundary: + type: number + example: 13.9 + low: + type: object + properties: + boundary: + type: number + example: 3.9 + target: + type: object + properties: + boundary: + type: number + example: 10 + very-low: + type: object + properties: + boundary: + type: number + example: 3 + bgUnits: + - $ref: "./glucoseunits.v1.yaml" diff --git a/reference/export/models/reportBGSource.v1.yaml b/reference/export/models/reportBGSource.v1.yaml new file mode 100644 index 00000000..e01df8e9 --- /dev/null +++ b/reference/export/models/reportBGSource.v1.yaml @@ -0,0 +1,7 @@ +title: BG source type +type: string +enum: + - smbg + - cbg +default: cbg +example: cbg diff --git a/reference/export/models/reportEndpoints.v1.yaml b/reference/export/models/reportEndpoints.v1.yaml new file mode 100644 index 00000000..10435405 --- /dev/null +++ b/reference/export/models/reportEndpoints.v1.yaml @@ -0,0 +1,9 @@ +title: Report endpoint dates +description: Start and end dates in hammertime format +type: array +minItems: 2 +maxItems: 2 +items: + type: interger + format: hammertime + description: unix-time in milliseconds instead of seconds diff --git a/reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml b/reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml new file mode 100644 index 00000000..68d30fe0 --- /dev/null +++ b/reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml @@ -0,0 +1,3 @@ +title: exclude days without bolus? +type: bool +default: false diff --git a/reference/export/models/reportExcludedDevices.v1.yaml b/reference/export/models/reportExcludedDevices.v1.yaml new file mode 100644 index 00000000..eff02e2f --- /dev/null +++ b/reference/export/models/reportExcludedDevices.v1.yaml @@ -0,0 +1,5 @@ +title: Excluded devices +type: array +items: + type: string +default: [] diff --git a/reference/export/models/reportMetaData.v1.yaml b/reference/export/models/reportMetaData.v1.yaml new file mode 100644 index 00000000..49b56f10 --- /dev/null +++ b/reference/export/models/reportMetaData.v1.yaml @@ -0,0 +1,3 @@ +title: Report Metadata +type: string +value: "latestPumpUpload, bgSources" \ No newline at end of file diff --git a/reference/export/models/reportStats.v1.yaml b/reference/export/models/reportStats.v1.yaml new file mode 100644 index 00000000..73c5460e --- /dev/null +++ b/reference/export/models/reportStats.v1.yaml @@ -0,0 +1,17 @@ +title: Report stats +type: array +items: + type: string + anyOf: + - "timeInRange" + - "averageGlucose" + - "sensorUsage" + - "totalInsulin" + - "timeInAuto" + - "timeInOverride" + - "carbs" + - "averageDailyDose" + - "glucoseManagementIndicator" + - "standardDev" + - "coefficientOfVariation" + - "bgExtents" diff --git a/reference/export/models/reportTimePrefs.v1.yaml b/reference/export/models/reportTimePrefs.v1.yaml new file mode 100644 index 00000000..53a9db3e --- /dev/null +++ b/reference/export/models/reportTimePrefs.v1.yaml @@ -0,0 +1,8 @@ +title: Report Time Preferences +type: object +properties: + timezoneAware: + type: boolean + timezoneName: + type: string + example: "NZ" diff --git a/reference/export/models/reportTypes.v1.yaml b/reference/export/models/reportTypes.v1.yaml new file mode 100644 index 00000000..8f7adc55 --- /dev/null +++ b/reference/export/models/reportTypes.v1.yaml @@ -0,0 +1,28 @@ +title: Report data types +type: object +minProperties: 1 +properties: + basal: + type: object + default: {} + bolus: + type: object + default: {} + cbg: + type: object + default: {} + deviceEvent: + type: object + default: {} + food: + type: object + default: {} + message: + type: object + default: {} + smbg: + type: object + default: {} + wizard: + type: object + default: {} From c2d6c45e9caddbbd2d84f76ca5405eb7e509c53d Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 30 May 2023 12:40:47 +1200 Subject: [PATCH 02/18] wip v2 --- reference/export.v1.yaml | 2 +- reference/export/models/newreport.v1.yaml | 19 ---- reference/export/models/queryAGP.v1.yaml | 14 ++- reference/export/models/queryBGLog.v1.yaml | 14 ++- reference/export/models/queryBasics.v1.yaml | 26 +++--- reference/export/models/queryDaily.v1.yaml | 18 ++-- reference/export/models/reportBGPrefs.v1.yaml | 89 ++++++++++--------- ...points.v1.yaml => reportDateRange.v1.yaml} | 2 +- reference/export/models/reportRequest.v1.yaml | 23 +++++ reference/export/models/reports.v1.yaml | 13 +++ 10 files changed, 118 insertions(+), 102 deletions(-) delete mode 100644 reference/export/models/newreport.v1.yaml rename reference/export/models/{reportEndpoints.v1.yaml => reportDateRange.v1.yaml} (92%) create mode 100644 reference/export/models/reportRequest.v1.yaml create mode 100644 reference/export/models/reports.v1.yaml diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index 71c6aa54..2f3e5ae5 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -91,7 +91,7 @@ paths: content: application/json: schema: - $ref: "./export/models/newreport.v1.yaml" + $ref: "./export/models/reportRequest.v1.yaml" responses: "200": description: A PDF report for the given user diff --git a/reference/export/models/newreport.v1.yaml b/reference/export/models/newreport.v1.yaml deleted file mode 100644 index a921c15b..00000000 --- a/reference/export/models/newreport.v1.yaml +++ /dev/null @@ -1,19 +0,0 @@ -title: New Report -description: >- - User report -type: object -properties: - queries: - type: object - minProperties: 1 - properties: - agp: - - $ref: "./queryAGP.v1.yaml" - daily: - - $ref: "./queryDaily.v1.yaml" - settings: - - $ref: "./querySettings.v1.yaml" - bgLog: - - $ref: "./queryBGLog.v1.yaml" - basics: - - $ref: "./queryBasics.v1.yaml" diff --git a/reference/export/models/queryAGP.v1.yaml b/reference/export/models/queryAGP.v1.yaml index 1827a03a..825f1107 100644 --- a/reference/export/models/queryAGP.v1.yaml +++ b/reference/export/models/queryAGP.v1.yaml @@ -5,7 +5,7 @@ properties: - $ref: "./reportEndpoints.v1.yaml" aggregationsByDate: type: string - value: 'dataByDate, statsByDate' + value: "dataByDate, statsByDate" bgPrefs: - $ref: "./reportBGPrefs.v1.yaml" bgSource: @@ -22,13 +22,11 @@ properties: stats: - $ref: "./reportStats.v1.yaml" value: - [ - "timeInRange", - "averageGlucose", - "sensorUsage", - "glucoseManagementIndicator", - "coefficientOfVariation", - ] + - "timeInRange" + - "averageGlucose" + - "sensorUsage" + - "glucoseManagementIndicator" + - "coefficientOfVariation" required: - endpoints - timePrefs diff --git a/reference/export/models/queryBGLog.v1.yaml b/reference/export/models/queryBGLog.v1.yaml index 64f8ccf5..9e788d2e 100644 --- a/reference/export/models/queryBGLog.v1.yaml +++ b/reference/export/models/queryBGLog.v1.yaml @@ -5,9 +5,9 @@ properties: - $ref: "./reportEndpoints.v1.yaml" aggregationsByDate: type: string - value: 'basals, boluses, fingersticks, siteChanges' + value: "basals, boluses, fingersticks, siteChanges" bgSource: - - $ref: './reportBGSource.v1.yaml' + - $ref: "./reportBGSource.v1.yaml" value: smbg bgPrefs: - $ref: "./reportBGPrefs.v1.yaml" @@ -16,12 +16,10 @@ properties: stats: - $ref: "./reportStats.v1.yaml" value: - [ - "readingsInRange", - "averageGlucose", - "standardDev", - "coefficientOfVariation", - ] + - "readingsInRange" + - "averageGlucose" + - "standardDev" + - "coefficientOfVariation" excludedDevices: - $ref: "./reportExcludedDevices.v1.yaml" metaData: diff --git a/reference/export/models/queryBasics.v1.yaml b/reference/export/models/queryBasics.v1.yaml index a82ff40e..e7183c4d 100644 --- a/reference/export/models/queryBasics.v1.yaml +++ b/reference/export/models/queryBasics.v1.yaml @@ -13,20 +13,18 @@ properties: stats: - $ref: "./reportStats.v1.yaml" value: - [ - "timeInRange", - "averageGlucose", - "sensorUsage", - "totalInsulin", - "timeInAuto", - "timeInOverride", - "carbs", - "averageDailyDose", - "glucoseManagementIndicator", - "standardDev", - "coefficientOfVariation", - "bgExtents", - ] + - "timeInRange" + - "averageGlucose" + - "sensorUsage" + - "totalInsulin" + - "timeInAuto" + - "timeInOverride" + - "carbs" + - "averageDailyDose" + - "glucoseManagementIndicator" + - "standardDev" + - "coefficientOfVariation" + - "bgExtents" timePrefs: - $ref: "./reportTimePrefs.v1.yaml" excludeDaysWithoutBolus: diff --git a/reference/export/models/queryDaily.v1.yaml b/reference/export/models/queryDaily.v1.yaml index 1df68854..d3831e9c 100644 --- a/reference/export/models/queryDaily.v1.yaml +++ b/reference/export/models/queryDaily.v1.yaml @@ -13,16 +13,14 @@ properties: stats: - $ref: "./reportStats.v1.yaml" value: - [ - "timeInRange", - "averageGlucose", - "totalInsulin", - "timeInAuto", - "timeInOverride", - "carbs", - "standardDev", - "coefficientOfVariation", - ] + - "timeInRange" + - "averageGlucose" + - "totalInsulin" + - "timeInAuto" + - "timeInOverride" + - "carbs" + - "standardDev" + - "coefficientOfVariation" excludedDevices: - $ref: "./reportExcludedDevices.v1.yaml" metaData: diff --git a/reference/export/models/reportBGPrefs.v1.yaml b/reference/export/models/reportBGPrefs.v1.yaml index 46bfbcc2..7bd5d8a7 100644 --- a/reference/export/models/reportBGPrefs.v1.yaml +++ b/reference/export/models/reportBGPrefs.v1.yaml @@ -1,45 +1,52 @@ title: Report BG Preferences type: object properties: - bgBounds: - type: object - properties: - clampThreshold: - type: number - targetLowerBound: - type: number - targetUpperBound: - type: number - veryHighThreshold: - type: number - veryLowThreshold: - type: number - bgClasses: - type: object - properties: - high: - type: object - properties: - boundary: - type: number - example: 13.9 - low: - type: object - properties: - boundary: - type: number - example: 3.9 - target: - type: object - properties: - boundary: - type: number - example: 10 - very-low: - type: object - properties: - boundary: - type: number - example: 3 - bgUnits: + # bgBounds: + # type: object + # properties: + # clampThreshold: + # type: number + # targetLowerBound: + # type: number + # targetUpperBound: + # type: number + # veryHighThreshold: + # type: number + # veryLowThreshold: + # type: number + # bgClasses: + # type: object + # properties: + # high: + # type: object + # properties: + # boundary: + # type: number + # example: 13.9 + # low: + # type: object + # properties: + # boundary: + # type: number + # example: 3.9 + # target: + # type: object + # properties: + # boundary: + # type: number + # example: 10 + # very-low: + # type: object + # properties: + # boundary: + # type: number + # example: 3 + units: - $ref: "./glucoseunits.v1.yaml" + source: + - type: string + enum: + - smbg + - cbg + default: cbg + example: cbg diff --git a/reference/export/models/reportEndpoints.v1.yaml b/reference/export/models/reportDateRange.v1.yaml similarity index 92% rename from reference/export/models/reportEndpoints.v1.yaml rename to reference/export/models/reportDateRange.v1.yaml index 10435405..64750c2a 100644 --- a/reference/export/models/reportEndpoints.v1.yaml +++ b/reference/export/models/reportDateRange.v1.yaml @@ -4,6 +4,6 @@ type: array minItems: 2 maxItems: 2 items: - type: interger + type: integer format: hammertime description: unix-time in milliseconds instead of seconds diff --git a/reference/export/models/reportRequest.v1.yaml b/reference/export/models/reportRequest.v1.yaml new file mode 100644 index 00000000..1b7c2032 --- /dev/null +++ b/reference/export/models/reportRequest.v1.yaml @@ -0,0 +1,23 @@ +title: New Report +description: >- + User report +type: object +required: [reports, dateRange, timePrefs] +properties: + reports: + $ref: "./reports.v1.yaml" + dateRange: + $ref: "./reportDateRange.v1.yaml" + timePrefs: + $ref: "./reportTimePrefs.v1.yaml" + bgPrefs: + $ref: "./reportBGPrefs.v1.yaml" +example: + reports: [agp, basics, daily] + dateRange: [1684272720, 1685482320] + timePrefs: + timezoneAware: true + timezoneName: "NZ" + bgPrefs: + source: cbg + units: mmol/L diff --git a/reference/export/models/reports.v1.yaml b/reference/export/models/reports.v1.yaml new file mode 100644 index 00000000..d765e1c7 --- /dev/null +++ b/reference/export/models/reports.v1.yaml @@ -0,0 +1,13 @@ +title: Reports +type: array +minItems: 1 +maxItems: 5 +items: + type: string + enum: + - daily + - bgLog + - basics + - agp + - settings +example: [daily, agp] From 3e3caa3f93bb6c107b275e29a4dfa186ced46c54 Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 30 May 2023 12:58:01 +1200 Subject: [PATCH 03/18] initial report(s) request schema --- reference/export/models/queryAGP.v1.yaml | 34 ------------ reference/export/models/queryBGLog.v1.yaml | 34 ------------ reference/export/models/queryBasics.v1.yaml | 40 -------------- reference/export/models/queryDaily.v1.yaml | 37 ------------- reference/export/models/querySettings.v1.yaml | 14 ----- reference/export/models/reportBGPrefs.v1.yaml | 53 +++---------------- .../export/models/reportBGSource.v1.yaml | 7 --- .../export/models/reportDateRange.v1.yaml | 17 +++--- .../reportExcludeDaysWithoutBolus.v1.yaml | 3 -- .../models/reportExcludedDevices.v1.yaml | 5 -- .../export/models/reportMetaData.v1.yaml | 3 -- reference/export/models/reportRequest.v1.yaml | 10 ++-- reference/export/models/reportStats.v1.yaml | 17 ------ reference/export/models/reportTypes.v1.yaml | 41 +++++--------- reference/export/models/reports.v1.yaml | 13 ----- 15 files changed, 35 insertions(+), 293 deletions(-) delete mode 100644 reference/export/models/queryAGP.v1.yaml delete mode 100644 reference/export/models/queryBGLog.v1.yaml delete mode 100644 reference/export/models/queryBasics.v1.yaml delete mode 100644 reference/export/models/queryDaily.v1.yaml delete mode 100644 reference/export/models/querySettings.v1.yaml delete mode 100644 reference/export/models/reportBGSource.v1.yaml delete mode 100644 reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml delete mode 100644 reference/export/models/reportExcludedDevices.v1.yaml delete mode 100644 reference/export/models/reportMetaData.v1.yaml delete mode 100644 reference/export/models/reportStats.v1.yaml delete mode 100644 reference/export/models/reports.v1.yaml diff --git a/reference/export/models/queryAGP.v1.yaml b/reference/export/models/queryAGP.v1.yaml deleted file mode 100644 index 825f1107..00000000 --- a/reference/export/models/queryAGP.v1.yaml +++ /dev/null @@ -1,34 +0,0 @@ -title: AGP Report Query -type: object -properties: - endpoints: - - $ref: "./reportEndpoints.v1.yaml" - aggregationsByDate: - type: string - value: "dataByDate, statsByDate" - bgPrefs: - - $ref: "./reportBGPrefs.v1.yaml" - bgSource: - - $ref: "./reportBGSource.v1.yaml" - excludedDevices: - - $ref: "./reportExcludedDevices.v1.yaml" - timePrefs: - - $ref: "./reportTimePrefs.v1.yaml" - metaData: - - $ref: "./reportMetaData.v1.yaml" - types: - - $ref: "./reportTypes.v1.yaml" - value: { cbg } - stats: - - $ref: "./reportStats.v1.yaml" - value: - - "timeInRange" - - "averageGlucose" - - "sensorUsage" - - "glucoseManagementIndicator" - - "coefficientOfVariation" -required: - - endpoints - - timePrefs - - bgPrefs - - bgSource diff --git a/reference/export/models/queryBGLog.v1.yaml b/reference/export/models/queryBGLog.v1.yaml deleted file mode 100644 index 9e788d2e..00000000 --- a/reference/export/models/queryBGLog.v1.yaml +++ /dev/null @@ -1,34 +0,0 @@ -title: BG Log Report Query -type: object -properties: - endpoints: - - $ref: "./reportEndpoints.v1.yaml" - aggregationsByDate: - type: string - value: "basals, boluses, fingersticks, siteChanges" - bgSource: - - $ref: "./reportBGSource.v1.yaml" - value: smbg - bgPrefs: - - $ref: "./reportBGPrefs.v1.yaml" - timePrefs: - - $ref: "./reportTimePrefs.v1.yaml" - stats: - - $ref: "./reportStats.v1.yaml" - value: - - "readingsInRange" - - "averageGlucose" - - "standardDev" - - "coefficientOfVariation" - excludedDevices: - - $ref: "./reportExcludedDevices.v1.yaml" - metaData: - - $ref: "./reportMetaData.v1.yaml" - types: - - $ref: "./reportTypes.v1.yaml" - value: { smbg } -required: - - endpoints - - aggregationsByDate - - stats - - excludeDaysWithoutBolus diff --git a/reference/export/models/queryBasics.v1.yaml b/reference/export/models/queryBasics.v1.yaml deleted file mode 100644 index e7183c4d..00000000 --- a/reference/export/models/queryBasics.v1.yaml +++ /dev/null @@ -1,40 +0,0 @@ -title: Basics Report Query -type: object -properties: - endpoints: - - $ref: "./reportEndpoints.v1.yaml" - aggregationsByDate: - type: string - value: "basals, boluses, fingersticks, siteChanges" - bgPrefs: - - $ref: "./reportBGPrefs.v1.yaml" - bgSource: - - $ref: "./reportBGSource.v1.yaml" - stats: - - $ref: "./reportStats.v1.yaml" - value: - - "timeInRange" - - "averageGlucose" - - "sensorUsage" - - "totalInsulin" - - "timeInAuto" - - "timeInOverride" - - "carbs" - - "averageDailyDose" - - "glucoseManagementIndicator" - - "standardDev" - - "coefficientOfVariation" - - "bgExtents" - timePrefs: - - $ref: "./reportTimePrefs.v1.yaml" - excludeDaysWithoutBolus: - - $ref: "./reportExcludeDaysWithoutBolus.v1.yaml" - excludedDevices: - - $ref: "./reportExcludedDevices.v1.yaml" - metaData: - - $ref: "./reportMetaData.v1.yaml" -required: - - endpoints - - timePrefs - - bgPrefs - - bgSource diff --git a/reference/export/models/queryDaily.v1.yaml b/reference/export/models/queryDaily.v1.yaml deleted file mode 100644 index d3831e9c..00000000 --- a/reference/export/models/queryDaily.v1.yaml +++ /dev/null @@ -1,37 +0,0 @@ -title: Daily Charts Report Query -type: object -properties: - endpoints: - - $ref: "./reportEndpoints.v1.yaml" - aggregationsByDate: - type: string - value: "dataByDate, statsByDate" - bgPrefs: - - $ref: "./reportBGPrefs.v1.yaml" - bgSource: - - $ref: "./reportBGSource.v1.yaml" - stats: - - $ref: "./reportStats.v1.yaml" - value: - - "timeInRange" - - "averageGlucose" - - "totalInsulin" - - "timeInAuto" - - "timeInOverride" - - "carbs" - - "standardDev" - - "coefficientOfVariation" - excludedDevices: - - $ref: "./reportExcludedDevices.v1.yaml" - metaData: - - $ref: "./reportMetaData.v1.yaml" - timePrefs: - - $ref: "./reportTimePrefs.v1.yaml" - types: - - $ref: "./reportTypes.v1.yaml" - value: { basal, bolus, cbg, deviceEvent, food, message, smbg, wizard } -required: - - endpoints - - bgPrefs - - timePrefs - - bgSource diff --git a/reference/export/models/querySettings.v1.yaml b/reference/export/models/querySettings.v1.yaml deleted file mode 100644 index 5864e471..00000000 --- a/reference/export/models/querySettings.v1.yaml +++ /dev/null @@ -1,14 +0,0 @@ -title: Settings Report Query -type: object -properties: - bgPrefs: - - $ref: "./reportBGPrefs.v1.yaml" - timePrefs: - - $ref: "./reportTimePrefs.v1.yaml" - excludedDevices: - - $ref: "./reportExcludedDevices.v1.yaml" - metaData: - - $ref: "./reportMetaData.v1.yaml" -required: - - bgPrefs - - timePrefs diff --git a/reference/export/models/reportBGPrefs.v1.yaml b/reference/export/models/reportBGPrefs.v1.yaml index 7bd5d8a7..e78d4c8e 100644 --- a/reference/export/models/reportBGPrefs.v1.yaml +++ b/reference/export/models/reportBGPrefs.v1.yaml @@ -1,52 +1,11 @@ title: Report BG Preferences type: object properties: - # bgBounds: - # type: object - # properties: - # clampThreshold: - # type: number - # targetLowerBound: - # type: number - # targetUpperBound: - # type: number - # veryHighThreshold: - # type: number - # veryLowThreshold: - # type: number - # bgClasses: - # type: object - # properties: - # high: - # type: object - # properties: - # boundary: - # type: number - # example: 13.9 - # low: - # type: object - # properties: - # boundary: - # type: number - # example: 3.9 - # target: - # type: object - # properties: - # boundary: - # type: number - # example: 10 - # very-low: - # type: object - # properties: - # boundary: - # type: number - # example: 3 units: - - $ref: "./glucoseunits.v1.yaml" + $ref: "./glucoseunits.v1.yaml" source: - - type: string - enum: - - smbg - - cbg - default: cbg - example: cbg + type: string + enum: + - smbg + - cbg + default: cbg diff --git a/reference/export/models/reportBGSource.v1.yaml b/reference/export/models/reportBGSource.v1.yaml deleted file mode 100644 index e01df8e9..00000000 --- a/reference/export/models/reportBGSource.v1.yaml +++ /dev/null @@ -1,7 +0,0 @@ -title: BG source type -type: string -enum: - - smbg - - cbg -default: cbg -example: cbg diff --git a/reference/export/models/reportDateRange.v1.yaml b/reference/export/models/reportDateRange.v1.yaml index 64750c2a..c8dcbdef 100644 --- a/reference/export/models/reportDateRange.v1.yaml +++ b/reference/export/models/reportDateRange.v1.yaml @@ -1,9 +1,12 @@ title: Report endpoint dates description: Start and end dates in hammertime format -type: array -minItems: 2 -maxItems: 2 -items: - type: integer - format: hammertime - description: unix-time in milliseconds instead of seconds +type: object +properties: + startDate: + type: integer + format: hammertime + description: unix-time in milliseconds instead of seconds + endDate: + type: integer + format: hammertime + description: unix-time in milliseconds instead of seconds diff --git a/reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml b/reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml deleted file mode 100644 index 68d30fe0..00000000 --- a/reference/export/models/reportExcludeDaysWithoutBolus.v1.yaml +++ /dev/null @@ -1,3 +0,0 @@ -title: exclude days without bolus? -type: bool -default: false diff --git a/reference/export/models/reportExcludedDevices.v1.yaml b/reference/export/models/reportExcludedDevices.v1.yaml deleted file mode 100644 index eff02e2f..00000000 --- a/reference/export/models/reportExcludedDevices.v1.yaml +++ /dev/null @@ -1,5 +0,0 @@ -title: Excluded devices -type: array -items: - type: string -default: [] diff --git a/reference/export/models/reportMetaData.v1.yaml b/reference/export/models/reportMetaData.v1.yaml deleted file mode 100644 index 49b56f10..00000000 --- a/reference/export/models/reportMetaData.v1.yaml +++ /dev/null @@ -1,3 +0,0 @@ -title: Report Metadata -type: string -value: "latestPumpUpload, bgSources" \ No newline at end of file diff --git a/reference/export/models/reportRequest.v1.yaml b/reference/export/models/reportRequest.v1.yaml index 1b7c2032..8b26e614 100644 --- a/reference/export/models/reportRequest.v1.yaml +++ b/reference/export/models/reportRequest.v1.yaml @@ -2,10 +2,10 @@ title: New Report description: >- User report type: object -required: [reports, dateRange, timePrefs] +required: [reports, dateRange, timePrefs, bgPrefs] properties: reports: - $ref: "./reports.v1.yaml" + $ref: "./reportTypes.v1.yaml" dateRange: $ref: "./reportDateRange.v1.yaml" timePrefs: @@ -14,10 +14,12 @@ properties: $ref: "./reportBGPrefs.v1.yaml" example: reports: [agp, basics, daily] - dateRange: [1684272720, 1685482320] + dateRange: + startDate: 1684272720 + endDate: 1685482320 timePrefs: timezoneAware: true timezoneName: "NZ" - bgPrefs: + bgPrefs: source: cbg units: mmol/L diff --git a/reference/export/models/reportStats.v1.yaml b/reference/export/models/reportStats.v1.yaml deleted file mode 100644 index 73c5460e..00000000 --- a/reference/export/models/reportStats.v1.yaml +++ /dev/null @@ -1,17 +0,0 @@ -title: Report stats -type: array -items: - type: string - anyOf: - - "timeInRange" - - "averageGlucose" - - "sensorUsage" - - "totalInsulin" - - "timeInAuto" - - "timeInOverride" - - "carbs" - - "averageDailyDose" - - "glucoseManagementIndicator" - - "standardDev" - - "coefficientOfVariation" - - "bgExtents" diff --git a/reference/export/models/reportTypes.v1.yaml b/reference/export/models/reportTypes.v1.yaml index 8f7adc55..668f219d 100644 --- a/reference/export/models/reportTypes.v1.yaml +++ b/reference/export/models/reportTypes.v1.yaml @@ -1,28 +1,13 @@ -title: Report data types -type: object -minProperties: 1 -properties: - basal: - type: object - default: {} - bolus: - type: object - default: {} - cbg: - type: object - default: {} - deviceEvent: - type: object - default: {} - food: - type: object - default: {} - message: - type: object - default: {} - smbg: - type: object - default: {} - wizard: - type: object - default: {} +title: Reports types +type: array +minItems: 1 +maxItems: 5 +items: + type: string + enum: + - daily + - bgLog + - basics + - agp + - settings +example: [daily, agp] diff --git a/reference/export/models/reports.v1.yaml b/reference/export/models/reports.v1.yaml deleted file mode 100644 index d765e1c7..00000000 --- a/reference/export/models/reports.v1.yaml +++ /dev/null @@ -1,13 +0,0 @@ -title: Reports -type: array -minItems: 1 -maxItems: 5 -items: - type: string - enum: - - daily - - bgLog - - basics - - agp - - settings -example: [daily, agp] From 6a844c4915e9a063e88ba5da7f31a2d5392d165a Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 8 Jun 2023 11:03:48 +1200 Subject: [PATCH 04/18] formatting and resp error examples --- reference/common/models/error.v1.yaml | 2 - reference/common/responses/badrequest.v1.yaml | 3 + reference/common/responses/forbidden.v1.yaml | 3 + reference/common/responses/nocontent.v1.yaml | 7 ++ reference/common/responses/notfound.v1.yaml | 3 + .../common/responses/servererror.v1.yaml | 3 + .../common/responses/unauthorized.v1.yaml | 3 + reference/export.v1.yaml | 94 ++++++++----------- reference/export/models/reportBGPrefs.v1.yaml | 2 +- reference/export/models/reportRequest.v1.yaml | 10 +- .../export/models/reportTimePrefs.v1.yaml | 2 +- 11 files changed, 70 insertions(+), 62 deletions(-) diff --git a/reference/common/models/error.v1.yaml b/reference/common/models/error.v1.yaml index 65b4b2a4..6a787da2 100644 --- a/reference/common/models/error.v1.yaml +++ b/reference/common/models/error.v1.yaml @@ -3,10 +3,8 @@ type: object properties: code: type: integer - example: 404 message: type: string - example: 'Requested resources was not found' required: - code - message diff --git a/reference/common/responses/badrequest.v1.yaml b/reference/common/responses/badrequest.v1.yaml index 7247324a..79cb6bed 100644 --- a/reference/common/responses/badrequest.v1.yaml +++ b/reference/common/responses/badrequest.v1.yaml @@ -3,3 +3,6 @@ content: 'application/json': schema: $ref: '../models/error.v1.yaml' + example: + code: 400 + message: 'Bad request' diff --git a/reference/common/responses/forbidden.v1.yaml b/reference/common/responses/forbidden.v1.yaml index c14ae541..47e625d3 100644 --- a/reference/common/responses/forbidden.v1.yaml +++ b/reference/common/responses/forbidden.v1.yaml @@ -3,3 +3,6 @@ content: 'application/json': schema: $ref: '../models/error.v1.yaml' + example: + code: 403 + message: 'Forbidden' diff --git a/reference/common/responses/nocontent.v1.yaml b/reference/common/responses/nocontent.v1.yaml index ece5811d..776adb03 100644 --- a/reference/common/responses/nocontent.v1.yaml +++ b/reference/common/responses/nocontent.v1.yaml @@ -1 +1,8 @@ description: 204 No Content +content: + 'application/json': + schema: + $ref: '../models/error.v1.yaml' + example: + code: 204 + message: 'No Content' diff --git a/reference/common/responses/notfound.v1.yaml b/reference/common/responses/notfound.v1.yaml index fa58f0a9..5902492e 100644 --- a/reference/common/responses/notfound.v1.yaml +++ b/reference/common/responses/notfound.v1.yaml @@ -3,3 +3,6 @@ content: 'application/json': schema: $ref: '../models/error.v1.yaml' + example: + code: 404 + message: 'Not Found' diff --git a/reference/common/responses/servererror.v1.yaml b/reference/common/responses/servererror.v1.yaml index 88dfae11..643aafb9 100644 --- a/reference/common/responses/servererror.v1.yaml +++ b/reference/common/responses/servererror.v1.yaml @@ -3,3 +3,6 @@ content: 'application/json': schema: $ref: '../models/error.v1.yaml' + example: + code: 500 + message: 'Server Error' diff --git a/reference/common/responses/unauthorized.v1.yaml b/reference/common/responses/unauthorized.v1.yaml index 737a092f..9aaae884 100644 --- a/reference/common/responses/unauthorized.v1.yaml +++ b/reference/common/responses/unauthorized.v1.yaml @@ -3,3 +3,6 @@ content: 'application/json': schema: $ref: '../models/error.v1.yaml' + example: + code: 401 + message: 'Unauthorized' diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index 2f3e5ae5..f7d96a06 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Export API - version: "1.0" + version: '1.0' description: |- The Tidepool API is an HTTP REST API used by Tidepool clients use to communicate with the Tidepool Platform. @@ -17,15 +17,15 @@ info: x-tidepool-service: https://github.com/tidepool-org/export servers: - - url: "https://external.integration.tidepool.org" + - url: 'https://external.integration.tidepool.org' description: integration - - url: "https://api.tidepool.org" + - url: 'https://api.tidepool.org' description: production - - url: "https://dev1.dev.tidepool.org" + - url: 'https://dev1.dev.tidepool.org' description: dev1 - - url: "https://qa1.development.tidepool.org" + - url: 'https://qa1.development.tidepool.org' description: qa1 - - url: "https://qa2.development.tidepool.org" + - url: 'https://qa2.development.tidepool.org' description: qa2 tags: @@ -37,9 +37,9 @@ tags: Enable bulk export of diabetes data from user's Tidepool account. paths: - "/export/{userId}": + '/export/{userId}': parameters: - - $ref: "./common/parameters/tidepooluserid.yaml" + - $ref: './common/parameters/tidepooluserid.yaml' get: operationId: ExportUserData summary: Export user data @@ -47,41 +47,42 @@ paths: Exports the diabetes data from user identified by `userId`, from `startDate` to `endDate`, in the requested `format`. Either a Tidepool session token, or a restricted token must be supplied. parameters: - - $ref: "./export/parameters/startdate.v1.yaml" - - $ref: "./export/parameters/enddate.v1.yaml" - - $ref: "./export/parameters/format.v1.yaml" - - $ref: "./export/parameters/glucoseunits.v1.yaml" + - $ref: './export/parameters/startdate.v1.yaml' + - $ref: './export/parameters/enddate.v1.yaml' + - $ref: './export/parameters/format.v1.yaml' + - $ref: './export/parameters/glucoseunits.v1.yaml' responses: - "200": + '200': description: >- User data exported in the requested `format`. headers: Content-Disposition: - $ref: "./common/headers/contentdisposition.v1.yaml" + $ref: './common/headers/contentdisposition.v1.yaml' content: - "application/json": + 'application/json': schema: - $ref: "./export/models/json.v1.yaml" - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": + $ref: './export/models/json.v1.yaml' + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': schema: - $ref: "./export/models/excel.v1.yaml" - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "500": - $ref: "#/components/responses/ServerError" + $ref: './export/models/excel.v1.yaml' + '400': + $ref: './common/responses/badrequest.v1.yaml' + '401': + $ref: './common/responses/unauthorized.v1.yaml' + '403': + $ref: './common/responses/forbidden.v1.yaml' + '500': + $ref: './common/responses/servererror.v1.yaml' + security: - sessionToken: [] - restrictedToken: [] tags: - Export - Internal - "/export/report/{userId}": + '/export/report/{userId}': parameters: - - $ref: "./common/parameters/tidepooluserid.yaml" + - $ref: './common/parameters/tidepooluserid.yaml' post: operationId: ExportUserReport summary: Export user report @@ -91,23 +92,23 @@ paths: content: application/json: schema: - $ref: "./export/models/reportRequest.v1.yaml" + $ref: './export/models/reportRequest.v1.yaml' responses: - "200": + '200': description: A PDF report for the given user content: application/pdf: schema: type: string format: binary - "400": - $ref: "#/components/responses/BadRequest" - "401": - $ref: "#/components/responses/Unauthorized" - "403": - $ref: "#/components/responses/Forbidden" - "500": - $ref: "#/components/responses/ServerError" + '400': + $ref: './common/responses/badrequest.v1.yaml' + '401': + $ref: './common/responses/unauthorized.v1.yaml' + '403': + $ref: './common/responses/forbidden.v1.yaml' + '500': + $ref: './common/responses/servererror.v1.yaml' security: - sessionToken: [] - restrictedToken: [] @@ -117,20 +118,7 @@ paths: components: securitySchemes: sessionToken: - $ref: "./common/security/tidepoolsessiontoken.v1.yaml" + $ref: './common/security/tidepoolsessiontoken.v1.yaml' restrictedToken: - $ref: "./common/security/tidepoolrestrictedtoken.v1.yaml" - - responses: - BadRequest: - description: "Bad Request" - - Unauthorized: - description: "Unauthorized" - - Forbidden: - description: "Forbidden" - - ServerError: - description: "Server Error" + $ref: './common/security/tidepoolrestrictedtoken.v1.yaml' diff --git a/reference/export/models/reportBGPrefs.v1.yaml b/reference/export/models/reportBGPrefs.v1.yaml index e78d4c8e..617cfd01 100644 --- a/reference/export/models/reportBGPrefs.v1.yaml +++ b/reference/export/models/reportBGPrefs.v1.yaml @@ -2,7 +2,7 @@ title: Report BG Preferences type: object properties: units: - $ref: "./glucoseunits.v1.yaml" + $ref: './glucoseunits.v1.yaml' source: type: string enum: diff --git a/reference/export/models/reportRequest.v1.yaml b/reference/export/models/reportRequest.v1.yaml index 8b26e614..539fbcb4 100644 --- a/reference/export/models/reportRequest.v1.yaml +++ b/reference/export/models/reportRequest.v1.yaml @@ -5,13 +5,13 @@ type: object required: [reports, dateRange, timePrefs, bgPrefs] properties: reports: - $ref: "./reportTypes.v1.yaml" + $ref: './reportTypes.v1.yaml' dateRange: - $ref: "./reportDateRange.v1.yaml" + $ref: './reportDateRange.v1.yaml' timePrefs: - $ref: "./reportTimePrefs.v1.yaml" + $ref: './reportTimePrefs.v1.yaml' bgPrefs: - $ref: "./reportBGPrefs.v1.yaml" + $ref: './reportBGPrefs.v1.yaml' example: reports: [agp, basics, daily] dateRange: @@ -19,7 +19,7 @@ example: endDate: 1685482320 timePrefs: timezoneAware: true - timezoneName: "NZ" + timezoneName: 'NZ' bgPrefs: source: cbg units: mmol/L diff --git a/reference/export/models/reportTimePrefs.v1.yaml b/reference/export/models/reportTimePrefs.v1.yaml index 53a9db3e..cce41113 100644 --- a/reference/export/models/reportTimePrefs.v1.yaml +++ b/reference/export/models/reportTimePrefs.v1.yaml @@ -5,4 +5,4 @@ properties: type: boolean timezoneName: type: string - example: "NZ" + example: 'NZ' From 9d0814b1f8f8ffc91a5fd5f0b0c0b730a8d68cfd Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 8 Jun 2023 13:09:19 +1200 Subject: [PATCH 05/18] common used of units formatting updates for consistency --- reference/data/models/cgmsettings.v1.yaml | 5 +---- .../data/models/pumpsettings/pumpsettings.v1.yaml | 12 ++---------- reference/export.v1.yaml | 2 +- reference/export/models/glucoseunits.v1.yaml | 7 ------- reference/export/models/reportBGPrefs.v1.yaml | 2 +- reference/export/models/reportDateRange.v1.yaml | 12 +++++------- reference/export/models/reportRequest.v1.yaml | 12 ++++++------ 7 files changed, 16 insertions(+), 36 deletions(-) delete mode 100644 reference/export/models/glucoseunits.v1.yaml diff --git a/reference/data/models/cgmsettings.v1.yaml b/reference/data/models/cgmsettings.v1.yaml index fa8040f3..9a2f2ea3 100644 --- a/reference/data/models/cgmsettings.v1.yaml +++ b/reference/data/models/cgmsettings.v1.yaml @@ -142,10 +142,7 @@ allOf: enum: - cgmSettings units: - type: string - enum: - - mg/dL - - mmol/L + $ref: './blood/units.v1.yaml' required: - type x-tags: diff --git a/reference/data/models/pumpsettings/pumpsettings.v1.yaml b/reference/data/models/pumpsettings/pumpsettings.v1.yaml index 09a8b8f2..c3dff951 100644 --- a/reference/data/models/pumpsettings/pumpsettings.v1.yaml +++ b/reference/data/models/pumpsettings/pumpsettings.v1.yaml @@ -103,10 +103,7 @@ allOf: type: object properties: units: - type: string - enum: - - mg/dL - - mmol/L + $ref: '../blood/units.v1.yaml' required: - units firmwareVersion: @@ -159,12 +156,7 @@ allOf: type: object properties: bg: - type: string - enum: - - mmol/L - - mmol/l - - mg/dL - - mg/dl + $ref: '../blood/units.v1.yaml' description: A string value encoding the blood glucose units exposed in the user interface on this insulin pump. carb: type: string diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index f7d96a06..87444c98 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -50,7 +50,7 @@ paths: - $ref: './export/parameters/startdate.v1.yaml' - $ref: './export/parameters/enddate.v1.yaml' - $ref: './export/parameters/format.v1.yaml' - - $ref: './export/parameters/glucoseunits.v1.yaml' + - $ref: './data/models/blood/units.v1.yaml' responses: '200': description: >- diff --git a/reference/export/models/glucoseunits.v1.yaml b/reference/export/models/glucoseunits.v1.yaml deleted file mode 100644 index f52d2521..00000000 --- a/reference/export/models/glucoseunits.v1.yaml +++ /dev/null @@ -1,7 +0,0 @@ -title: Export Glucose Units -type: string -enum: - - mmol/L - - mg/dL -default: mmol/L -example: mmol/L diff --git a/reference/export/models/reportBGPrefs.v1.yaml b/reference/export/models/reportBGPrefs.v1.yaml index 617cfd01..b3265f10 100644 --- a/reference/export/models/reportBGPrefs.v1.yaml +++ b/reference/export/models/reportBGPrefs.v1.yaml @@ -2,7 +2,7 @@ title: Report BG Preferences type: object properties: units: - $ref: './glucoseunits.v1.yaml' + $ref: ../../data/models/blood/units.v1.yaml source: type: string enum: diff --git a/reference/export/models/reportDateRange.v1.yaml b/reference/export/models/reportDateRange.v1.yaml index c8dcbdef..74fa6ae4 100644 --- a/reference/export/models/reportDateRange.v1.yaml +++ b/reference/export/models/reportDateRange.v1.yaml @@ -1,12 +1,10 @@ title: Report endpoint dates -description: Start and end dates in hammertime format +description: Start and end dates type: object properties: startDate: - type: integer - format: hammertime - description: unix-time in milliseconds instead of seconds + $ref: ../../common/models/datetime.v1.yaml + description: startDate cannot be more than 90 days before the endDate endDate: - type: integer - format: hammertime - description: unix-time in milliseconds instead of seconds + $ref: ../../common/models/datetime.v1.yaml + description: endDate cannot be in the future diff --git a/reference/export/models/reportRequest.v1.yaml b/reference/export/models/reportRequest.v1.yaml index 539fbcb4..94ef9ffb 100644 --- a/reference/export/models/reportRequest.v1.yaml +++ b/reference/export/models/reportRequest.v1.yaml @@ -5,18 +5,18 @@ type: object required: [reports, dateRange, timePrefs, bgPrefs] properties: reports: - $ref: './reportTypes.v1.yaml' + $ref: './reporttypes.v1.yaml' dateRange: - $ref: './reportDateRange.v1.yaml' + $ref: './reportdaterange.v1.yaml' timePrefs: - $ref: './reportTimePrefs.v1.yaml' + $ref: './reporttimeprefs.v1.yaml' bgPrefs: - $ref: './reportBGPrefs.v1.yaml' + $ref: './reportbgprefs.v1.yaml' example: reports: [agp, basics, daily] dateRange: - startDate: 1684272720 - endDate: 1685482320 + startDate: '2023-04-01T02:37:46Z' + endDate: '2023-04-30T02:37:46Z' timePrefs: timezoneAware: true timezoneName: 'NZ' From 9d4a9f8db25ca403692014bb9959c8c10163b983 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 8 Jun 2023 21:22:02 +1200 Subject: [PATCH 06/18] rename for case --- reference/export.v1.yaml | 2 +- .../models/{reportBGPrefs.v1.yaml => reportbgprefs.v1.yaml} | 0 .../models/{reportDateRange.v1.yaml => reportdaterange.v1.yaml} | 0 .../models/{reportRequest.v1.yaml => reportrequest.v1.yaml} | 0 .../models/{reportTimePrefs.v1.yaml => reporttimeprefs.v1.yaml} | 0 .../export/models/{reportTypes.v1.yaml => reporttypes.v1.yaml} | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename reference/export/models/{reportBGPrefs.v1.yaml => reportbgprefs.v1.yaml} (100%) rename reference/export/models/{reportDateRange.v1.yaml => reportdaterange.v1.yaml} (100%) rename reference/export/models/{reportRequest.v1.yaml => reportrequest.v1.yaml} (100%) rename reference/export/models/{reportTimePrefs.v1.yaml => reporttimeprefs.v1.yaml} (100%) rename reference/export/models/{reportTypes.v1.yaml => reporttypes.v1.yaml} (100%) diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index 87444c98..b6985a36 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -92,7 +92,7 @@ paths: content: application/json: schema: - $ref: './export/models/reportRequest.v1.yaml' + $ref: './export/models/reportrequest.v1.yaml' responses: '200': description: A PDF report for the given user diff --git a/reference/export/models/reportBGPrefs.v1.yaml b/reference/export/models/reportbgprefs.v1.yaml similarity index 100% rename from reference/export/models/reportBGPrefs.v1.yaml rename to reference/export/models/reportbgprefs.v1.yaml diff --git a/reference/export/models/reportDateRange.v1.yaml b/reference/export/models/reportdaterange.v1.yaml similarity index 100% rename from reference/export/models/reportDateRange.v1.yaml rename to reference/export/models/reportdaterange.v1.yaml diff --git a/reference/export/models/reportRequest.v1.yaml b/reference/export/models/reportrequest.v1.yaml similarity index 100% rename from reference/export/models/reportRequest.v1.yaml rename to reference/export/models/reportrequest.v1.yaml diff --git a/reference/export/models/reportTimePrefs.v1.yaml b/reference/export/models/reporttimeprefs.v1.yaml similarity index 100% rename from reference/export/models/reportTimePrefs.v1.yaml rename to reference/export/models/reporttimeprefs.v1.yaml diff --git a/reference/export/models/reportTypes.v1.yaml b/reference/export/models/reporttypes.v1.yaml similarity index 100% rename from reference/export/models/reportTypes.v1.yaml rename to reference/export/models/reporttypes.v1.yaml From c987df16d58ef2c5d77790de1e58121a9de2a044 Mon Sep 17 00:00:00 2001 From: Jamie Date: Fri, 9 Jun 2023 11:23:57 +1200 Subject: [PATCH 07/18] fix params glucoseunits reference --- reference/data/models/blood/units.v1.yaml | 1 + reference/export.v1.yaml | 2 +- reference/export/parameters/glucoseunits.v1.yaml | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/reference/data/models/blood/units.v1.yaml b/reference/data/models/blood/units.v1.yaml index 95123045..c099a1ec 100644 --- a/reference/data/models/blood/units.v1.yaml +++ b/reference/data/models/blood/units.v1.yaml @@ -2,5 +2,6 @@ title: Blood Unit (mg/dL or mmol/L) oneOf: - $ref: './unitsmgdl.v1.yaml' - $ref: './unitsmmol.v1.yaml' +default: mmol/L x-tags: - Data diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index b6985a36..0c7577d8 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -50,7 +50,7 @@ paths: - $ref: './export/parameters/startdate.v1.yaml' - $ref: './export/parameters/enddate.v1.yaml' - $ref: './export/parameters/format.v1.yaml' - - $ref: './data/models/blood/units.v1.yaml' + - $ref: './export/parameters/glucoseunits.v1.yaml' responses: '200': description: >- diff --git a/reference/export/parameters/glucoseunits.v1.yaml b/reference/export/parameters/glucoseunits.v1.yaml index 31441f0e..5097fb11 100644 --- a/reference/export/parameters/glucoseunits.v1.yaml +++ b/reference/export/parameters/glucoseunits.v1.yaml @@ -3,4 +3,5 @@ description: >- name: bgUnits in: query schema: - $ref: '../models/glucoseunits.v1.yaml' + $ref: '../../data/models/blood/units.v1.yaml' + default: mmol/L From c0a4b2f5a893561cb793339571df6a75a8bd9070 Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 20 Jun 2023 13:53:29 +1200 Subject: [PATCH 08/18] add defaults and required vals allow daterange per report --- reference/common/models/daterange.v1.yaml | 12 ++++++++++++ reference/export/models/reportbgprefs.v1.yaml | 2 ++ .../export/models/reportdaterange.v1.yaml | 19 ++++++++++++++++--- reference/export/models/reportrequest.v1.yaml | 3 +++ .../export/models/reporttimeprefs.v1.yaml | 3 +++ reference/export/models/reporttypes.v1.yaml | 2 ++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 reference/common/models/daterange.v1.yaml diff --git a/reference/common/models/daterange.v1.yaml b/reference/common/models/daterange.v1.yaml new file mode 100644 index 00000000..db486cd5 --- /dev/null +++ b/reference/common/models/daterange.v1.yaml @@ -0,0 +1,12 @@ +title: Date Range +description: >- + start and end datetime +type: object +properties: + startDate: + $ref: './datetime.v1.yaml' + endDate: + $ref: './datetime.v1.yaml' +required: + - startDate + - endDate \ No newline at end of file diff --git a/reference/export/models/reportbgprefs.v1.yaml b/reference/export/models/reportbgprefs.v1.yaml index b3265f10..64a2b8f9 100644 --- a/reference/export/models/reportbgprefs.v1.yaml +++ b/reference/export/models/reportbgprefs.v1.yaml @@ -9,3 +9,5 @@ properties: - smbg - cbg default: cbg +required: + - units diff --git a/reference/export/models/reportdaterange.v1.yaml b/reference/export/models/reportdaterange.v1.yaml index 74fa6ae4..7ea610e6 100644 --- a/reference/export/models/reportdaterange.v1.yaml +++ b/reference/export/models/reportdaterange.v1.yaml @@ -1,10 +1,23 @@ title: Report endpoint dates -description: Start and end dates +description: Start and end dates, can also specify per report if needed type: object properties: startDate: $ref: ../../common/models/datetime.v1.yaml - description: startDate cannot be more than 90 days before the endDate + description: cannot be more than 90 days before the endDate endDate: $ref: ../../common/models/datetime.v1.yaml - description: endDate cannot be in the future + description: cannot be in the future + agp: + $ref: ../../common/models/daterange.v1.yaml + basics: + $ref: ../../common/models/daterange.v1.yaml + bgLog: + $ref: ../../common/models/daterange.v1.yaml + daily: + $ref: ../../common/models/daterange.v1.yaml + settings: + $ref: ../../common/models/daterange.v1.yaml +required: + - startDate + - endDate diff --git a/reference/export/models/reportrequest.v1.yaml b/reference/export/models/reportrequest.v1.yaml index 94ef9ffb..47cd46d3 100644 --- a/reference/export/models/reportrequest.v1.yaml +++ b/reference/export/models/reportrequest.v1.yaml @@ -17,6 +17,9 @@ example: dateRange: startDate: '2023-04-01T02:37:46Z' endDate: '2023-04-30T02:37:46Z' + agp: + startDate: '2023-04-01T02:37:46Z' + endDate: '2023-04-15T02:37:46Z' timePrefs: timezoneAware: true timezoneName: 'NZ' diff --git a/reference/export/models/reporttimeprefs.v1.yaml b/reference/export/models/reporttimeprefs.v1.yaml index cce41113..0b29a4a4 100644 --- a/reference/export/models/reporttimeprefs.v1.yaml +++ b/reference/export/models/reporttimeprefs.v1.yaml @@ -3,6 +3,9 @@ type: object properties: timezoneAware: type: boolean + default: true timezoneName: type: string example: 'NZ' +required: + - timezoneName diff --git a/reference/export/models/reporttypes.v1.yaml b/reference/export/models/reporttypes.v1.yaml index 668f219d..3c3509ee 100644 --- a/reference/export/models/reporttypes.v1.yaml +++ b/reference/export/models/reporttypes.v1.yaml @@ -10,4 +10,6 @@ items: - basics - agp - settings + - all example: [daily, agp] +default: [all] From ff09cdf17f5b2a8691b040510b4b3667dcaa1537 Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 20 Jun 2023 14:52:58 +1200 Subject: [PATCH 09/18] use timezonename ref --- reference/export/models/reporttimeprefs.v1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/export/models/reporttimeprefs.v1.yaml b/reference/export/models/reporttimeprefs.v1.yaml index 0b29a4a4..43740760 100644 --- a/reference/export/models/reporttimeprefs.v1.yaml +++ b/reference/export/models/reporttimeprefs.v1.yaml @@ -5,7 +5,7 @@ properties: type: boolean default: true timezoneName: - type: string + $ref: ../../data/models/timezonename.v1.yaml example: 'NZ' required: - timezoneName From 989bc8234a3e29c2550afb7ed5dbf51f2ec3f0ee Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 6 Jul 2023 17:20:45 +1200 Subject: [PATCH 10/18] updates for pdf report api --- reference/export.v1.yaml | 12 +++++----- reference/export/models/reportbgprefs.v1.yaml | 13 ----------- reference/export/models/reportrequest.v1.yaml | 23 ++++++++----------- .../export/models/reporttimeprefs.v1.yaml | 11 --------- ...reporttypes.v1.yaml => reporttype.v1.yaml} | 4 +--- reference/export/parameters/reports.v1.yaml | 11 +++++++++ .../export/parameters/timezonename.v1.yaml | 8 +++++++ 7 files changed, 36 insertions(+), 46 deletions(-) delete mode 100644 reference/export/models/reportbgprefs.v1.yaml delete mode 100644 reference/export/models/reporttimeprefs.v1.yaml rename reference/export/models/{reporttypes.v1.yaml => reporttype.v1.yaml} (70%) create mode 100644 reference/export/parameters/reports.v1.yaml create mode 100644 reference/export/parameters/timezonename.v1.yaml diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index 0c7577d8..02f2e846 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -83,16 +83,16 @@ paths: '/export/report/{userId}': parameters: - $ref: './common/parameters/tidepooluserid.yaml' - post: + get: operationId: ExportUserReport summary: Export user report description: >- User report exported in with the requested options. - requestBody: - content: - application/json: - schema: - $ref: './export/models/reportrequest.v1.yaml' + Either a Tidepool session token, or a restricted token must be supplied. + parameters: + - $ref: './export/parameters/reports.v1.yaml' + - $ref: './export/parameters/timezonename.v1.yaml' + - $ref: './export/parameters/glucoseunits.v1.yaml' responses: '200': description: A PDF report for the given user diff --git a/reference/export/models/reportbgprefs.v1.yaml b/reference/export/models/reportbgprefs.v1.yaml deleted file mode 100644 index 64a2b8f9..00000000 --- a/reference/export/models/reportbgprefs.v1.yaml +++ /dev/null @@ -1,13 +0,0 @@ -title: Report BG Preferences -type: object -properties: - units: - $ref: ../../data/models/blood/units.v1.yaml - source: - type: string - enum: - - smbg - - cbg - default: cbg -required: - - units diff --git a/reference/export/models/reportrequest.v1.yaml b/reference/export/models/reportrequest.v1.yaml index 47cd46d3..a7ff694f 100644 --- a/reference/export/models/reportrequest.v1.yaml +++ b/reference/export/models/reportrequest.v1.yaml @@ -2,16 +2,16 @@ title: New Report description: >- User report type: object -required: [reports, dateRange, timePrefs, bgPrefs] +required: [reports] properties: reports: - $ref: './reporttypes.v1.yaml' + $ref: './reporttype.v1.yaml' dateRange: - $ref: './reportdaterange.v1.yaml' - timePrefs: - $ref: './reporttimeprefs.v1.yaml' - bgPrefs: - $ref: './reportbgprefs.v1.yaml' + $ref: ./reportdaterange.v1.yaml' + tzName: + $ref: ../../data/models/timezonename.v1.yaml + bgUnits: + $ref: ../../data/models/blood/units.v1.yaml example: reports: [agp, basics, daily] dateRange: @@ -20,9 +20,6 @@ example: agp: startDate: '2023-04-01T02:37:46Z' endDate: '2023-04-15T02:37:46Z' - timePrefs: - timezoneAware: true - timezoneName: 'NZ' - bgPrefs: - source: cbg - units: mmol/L + tzName: 'NZ' + bgUnits: mmol/L + diff --git a/reference/export/models/reporttimeprefs.v1.yaml b/reference/export/models/reporttimeprefs.v1.yaml deleted file mode 100644 index 43740760..00000000 --- a/reference/export/models/reporttimeprefs.v1.yaml +++ /dev/null @@ -1,11 +0,0 @@ -title: Report Time Preferences -type: object -properties: - timezoneAware: - type: boolean - default: true - timezoneName: - $ref: ../../data/models/timezonename.v1.yaml - example: 'NZ' -required: - - timezoneName diff --git a/reference/export/models/reporttypes.v1.yaml b/reference/export/models/reporttype.v1.yaml similarity index 70% rename from reference/export/models/reporttypes.v1.yaml rename to reference/export/models/reporttype.v1.yaml index 3c3509ee..a4fa2866 100644 --- a/reference/export/models/reporttypes.v1.yaml +++ b/reference/export/models/reporttype.v1.yaml @@ -1,4 +1,4 @@ -title: Reports types +title: Reports type type: array minItems: 1 maxItems: 5 @@ -11,5 +11,3 @@ items: - agp - settings - all -example: [daily, agp] -default: [all] diff --git a/reference/export/parameters/reports.v1.yaml b/reference/export/parameters/reports.v1.yaml new file mode 100644 index 00000000..c0a5e0ff --- /dev/null +++ b/reference/export/parameters/reports.v1.yaml @@ -0,0 +1,11 @@ +description: >- + Report Type. The type of report(s) to produce. + It can be a single value like `/export/report/userid?reports=apg` or a comma separated list like `/export/report/userid?reports=agp,daily,basics`. +name: reports +in: query +required: false +style: form +explode: false +schema: + $ref: '../models/reporttype.v1.yaml' + default: all diff --git a/reference/export/parameters/timezonename.v1.yaml b/reference/export/parameters/timezonename.v1.yaml new file mode 100644 index 00000000..c0cf15c0 --- /dev/null +++ b/reference/export/parameters/timezonename.v1.yaml @@ -0,0 +1,8 @@ +description: >- + Timezone name used for report production +name: tzName +in: query +required: false +schema: + $ref: ../../data/models/timezonename.v1.yaml + default: UTC From 9ac6811c88fe685834d19e5479d994a33c158512 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 6 Jul 2023 17:50:28 +1200 Subject: [PATCH 11/18] remove report request for now --- reference/export/models/reportrequest.v1.yaml | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 reference/export/models/reportrequest.v1.yaml diff --git a/reference/export/models/reportrequest.v1.yaml b/reference/export/models/reportrequest.v1.yaml deleted file mode 100644 index a7ff694f..00000000 --- a/reference/export/models/reportrequest.v1.yaml +++ /dev/null @@ -1,25 +0,0 @@ -title: New Report -description: >- - User report -type: object -required: [reports] -properties: - reports: - $ref: './reporttype.v1.yaml' - dateRange: - $ref: ./reportdaterange.v1.yaml' - tzName: - $ref: ../../data/models/timezonename.v1.yaml - bgUnits: - $ref: ../../data/models/blood/units.v1.yaml -example: - reports: [agp, basics, daily] - dateRange: - startDate: '2023-04-01T02:37:46Z' - endDate: '2023-04-30T02:37:46Z' - agp: - startDate: '2023-04-01T02:37:46Z' - endDate: '2023-04-15T02:37:46Z' - tzName: 'NZ' - bgUnits: mmol/L - From e3e3f0622272d2b9a2ad143574d02cb1fb879795 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 6 Jul 2023 18:52:18 +1200 Subject: [PATCH 12/18] add dob and fullname --- reference/export.v1.yaml | 2 ++ reference/export/parameters/birthday.v1.yaml | 6 ++++++ reference/export/parameters/fullname.v1.yaml | 6 ++++++ reference/export/parameters/glucoseunits.v1.yaml | 2 +- reference/export/parameters/timezonename.v1.yaml | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 reference/export/parameters/birthday.v1.yaml create mode 100644 reference/export/parameters/fullname.v1.yaml diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index 02f2e846..d83de3e6 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -91,6 +91,8 @@ paths: Either a Tidepool session token, or a restricted token must be supplied. parameters: - $ref: './export/parameters/reports.v1.yaml' + - $ref: './export/parameters/birthday.v1.yaml' + - $ref: './export/parameters/fullname.v1.yaml' - $ref: './export/parameters/timezonename.v1.yaml' - $ref: './export/parameters/glucoseunits.v1.yaml' responses: diff --git a/reference/export/parameters/birthday.v1.yaml b/reference/export/parameters/birthday.v1.yaml new file mode 100644 index 00000000..4983cb29 --- /dev/null +++ b/reference/export/parameters/birthday.v1.yaml @@ -0,0 +1,6 @@ +description: >- + Date of birth +name: dob +in: query +schema: + $ref: '../../common/models/birthday.v1.yaml' diff --git a/reference/export/parameters/fullname.v1.yaml b/reference/export/parameters/fullname.v1.yaml new file mode 100644 index 00000000..76a1e496 --- /dev/null +++ b/reference/export/parameters/fullname.v1.yaml @@ -0,0 +1,6 @@ +description: >- + Full name +name: fullName +in: query +schema: + $ref: '../../metadata/models/fullname.v1.yaml' diff --git a/reference/export/parameters/glucoseunits.v1.yaml b/reference/export/parameters/glucoseunits.v1.yaml index 5097fb11..89eaffad 100644 --- a/reference/export/parameters/glucoseunits.v1.yaml +++ b/reference/export/parameters/glucoseunits.v1.yaml @@ -1,5 +1,5 @@ description: >- - Glucose units of the exported data + Glucose units name: bgUnits in: query schema: diff --git a/reference/export/parameters/timezonename.v1.yaml b/reference/export/parameters/timezonename.v1.yaml index c0cf15c0..efbec787 100644 --- a/reference/export/parameters/timezonename.v1.yaml +++ b/reference/export/parameters/timezonename.v1.yaml @@ -1,5 +1,5 @@ description: >- - Timezone name used for report production + Timezone name name: tzName in: query required: false From cce5e8ec7a7917d34133ee61dba782ea17104488 Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 6 Jul 2023 22:38:47 +1200 Subject: [PATCH 13/18] formatting --- reference/common/models/daterange.v1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/common/models/daterange.v1.yaml b/reference/common/models/daterange.v1.yaml index db486cd5..ccb0127f 100644 --- a/reference/common/models/daterange.v1.yaml +++ b/reference/common/models/daterange.v1.yaml @@ -9,4 +9,4 @@ properties: $ref: './datetime.v1.yaml' required: - startDate - - endDate \ No newline at end of file + - endDate From 64f43f759fb5e87ca17637be706d7fc26e05d12d Mon Sep 17 00:00:00 2001 From: Jamie Date: Thu, 13 Jul 2023 16:44:05 +1200 Subject: [PATCH 14/18] include post endpoint for reports --- reference/clinic/models/patient.v1.yaml | 4 +-- reference/export.v1.yaml | 36 +++++++++++++++++-- reference/export/models/reportdetail.v1.yaml | 29 +++++++++++++++ reference/export/models/reportrequest.v1.yaml | 10 ++++++ reference/export/models/reportuser.v1.yaml | 16 +++++++++ .../models/writableattributes.v1.yaml | 2 +- 6 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 reference/export/models/reportdetail.v1.yaml create mode 100644 reference/export/models/reportrequest.v1.yaml create mode 100644 reference/export/models/reportuser.v1.yaml diff --git a/reference/clinic/models/patient.v1.yaml b/reference/clinic/models/patient.v1.yaml index ac7f2df7..6b090f73 100644 --- a/reference/clinic/models/patient.v1.yaml +++ b/reference/clinic/models/patient.v1.yaml @@ -17,9 +17,7 @@ properties: format: date example: '2012-08-30' mrn: - type: string - description: The medical record number of the patient - minLength: 1 + $ref: ../../metadata/models/mrn.v1.yaml tags: type: array nullable: true diff --git a/reference/export.v1.yaml b/reference/export.v1.yaml index d83de3e6..72e3da1a 100644 --- a/reference/export.v1.yaml +++ b/reference/export.v1.yaml @@ -84,8 +84,8 @@ paths: parameters: - $ref: './common/parameters/tidepooluserid.yaml' get: - operationId: ExportUserReport - summary: Export user report + operationId: WebExportUserReport + summary: Export user report from webapp description: >- User report exported in with the requested options. Either a Tidepool session token, or a restricted token must be supplied. @@ -117,6 +117,38 @@ paths: tags: - Export - Internal + post: + operationId: ExportUserReport + summary: Export user report + description: >- + Export user report called from + requestBody: + content: + application/json: + schema: + $ref: ./export/models/reportrequest.v1.yaml + responses: + '200': + description: A PDF report for the given user + content: + application/pdf: + schema: + type: string + format: binary + '400': + $ref: './common/responses/badrequest.v1.yaml' + '401': + $ref: './common/responses/unauthorized.v1.yaml' + '403': + $ref: './common/responses/forbidden.v1.yaml' + '500': + $ref: './common/responses/servererror.v1.yaml' + security: + - sessionToken: [] + - restrictedToken: [] + tags: + - Export + - Internal components: securitySchemes: sessionToken: diff --git a/reference/export/models/reportdetail.v1.yaml b/reference/export/models/reportdetail.v1.yaml new file mode 100644 index 00000000..579bf83f --- /dev/null +++ b/reference/export/models/reportdetail.v1.yaml @@ -0,0 +1,29 @@ +title: Report details +description: >- + Report details +type: object +required: [fullName, mrn, dob] +properties: + reports: + type: array + minItems: 1 + maxItems: 5 + items: + $ref: ./reporttype.v1.yaml + default: [all] + tzName: + $ref: ../../data/models/timezonename.v1.yaml + default: UTC + bgUnits: + $ref: ../../data/models/blood/units.v1.yaml + default: mmol/L + startDate: + $ref: ../../common/models/datetime.v1.yaml + endDate: + $ref: ../../common/models/datetime.v1.yaml +example: + reports: [all] + tzName: 'NZ' + bgUnits: mmol/L + startDate: '2022-02-06T02:37:46Z' + endDate: '2022-03-06T02:37:46Z' diff --git a/reference/export/models/reportrequest.v1.yaml b/reference/export/models/reportrequest.v1.yaml new file mode 100644 index 00000000..bbe13a5a --- /dev/null +++ b/reference/export/models/reportrequest.v1.yaml @@ -0,0 +1,10 @@ +title: New Report +description: >- + User report +type: object +required: [reportDetails, userDetails] +properties: + reportDetails: + $ref: ./reportdetail.v1.yaml + userDetails: + $ref: ./reportuser.v1.yaml diff --git a/reference/export/models/reportuser.v1.yaml b/reference/export/models/reportuser.v1.yaml new file mode 100644 index 00000000..e6e9a41d --- /dev/null +++ b/reference/export/models/reportuser.v1.yaml @@ -0,0 +1,16 @@ +title: Report user +description: >- + Report user +type: object +required: [fullName, mrn, dob] +properties: + fullName: + $ref: ../../metadata/models/fullname.v1.yaml + mrn: + $ref: ../../metadata/models/mrn.v1.yaml + dob: + $ref: ../../common/models/birthday.v1.yaml +example: + fullName: User Name' + mrn: 'mrn123' + dob: '1999-04-01' diff --git a/reference/prescription/models/writableattributes.v1.yaml b/reference/prescription/models/writableattributes.v1.yaml index 7a07b283..398bf03f 100644 --- a/reference/prescription/models/writableattributes.v1.yaml +++ b/reference/prescription/models/writableattributes.v1.yaml @@ -10,7 +10,7 @@ properties: birthday: $ref: ../../common/models/birthday.v1.yaml mrn: - type: string + type: ../../metadata/models/mrn.v1.yaml email: $ref: ../../common/models/emailaddress.v1.yaml sex: From ea5ca0073f23a69196cf0273ad985e5e28d996a8 Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 18 Jul 2023 11:51:07 +1200 Subject: [PATCH 15/18] fix defaults --- reference/export/models/reportdetail.v1.yaml | 15 +++++++-------- reference/export/models/reportrequest.v1.yaml | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/reference/export/models/reportdetail.v1.yaml b/reference/export/models/reportdetail.v1.yaml index 579bf83f..7de957bf 100644 --- a/reference/export/models/reportdetail.v1.yaml +++ b/reference/export/models/reportdetail.v1.yaml @@ -2,15 +2,11 @@ title: Report details description: >- Report details type: object -required: [fullName, mrn, dob] properties: reports: - type: array - minItems: 1 - maxItems: 5 - items: - $ref: ./reporttype.v1.yaml - default: [all] + $ref: ./reporttype.v1.yaml + default: + - all tzName: $ref: ../../data/models/timezonename.v1.yaml default: UTC @@ -22,7 +18,10 @@ properties: endDate: $ref: ../../common/models/datetime.v1.yaml example: - reports: [all] + reports: + - daily + - basics + - settings tzName: 'NZ' bgUnits: mmol/L startDate: '2022-02-06T02:37:46Z' diff --git a/reference/export/models/reportrequest.v1.yaml b/reference/export/models/reportrequest.v1.yaml index bbe13a5a..9bd566aa 100644 --- a/reference/export/models/reportrequest.v1.yaml +++ b/reference/export/models/reportrequest.v1.yaml @@ -2,7 +2,7 @@ title: New Report description: >- User report type: object -required: [reportDetails, userDetails] +required: [userDetails] properties: reportDetails: $ref: ./reportdetail.v1.yaml From 8c5b25359afed55a3443c685199686aef47c3c2c Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 18 Jul 2023 14:16:23 +1200 Subject: [PATCH 16/18] fix reference --- reference/prescription/models/writableattributes.v1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/prescription/models/writableattributes.v1.yaml b/reference/prescription/models/writableattributes.v1.yaml index 398bf03f..48ff042d 100644 --- a/reference/prescription/models/writableattributes.v1.yaml +++ b/reference/prescription/models/writableattributes.v1.yaml @@ -10,7 +10,7 @@ properties: birthday: $ref: ../../common/models/birthday.v1.yaml mrn: - type: ../../metadata/models/mrn.v1.yaml + $ref: ../../metadata/models/mrn.v1.yaml email: $ref: ../../common/models/emailaddress.v1.yaml sex: From cafb99b6548942c18b39847eedc3f39edaae88bd Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 25 Jul 2023 09:11:13 +1200 Subject: [PATCH 17/18] remove unused model --- .../export/models/reportdaterange.v1.yaml | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 reference/export/models/reportdaterange.v1.yaml diff --git a/reference/export/models/reportdaterange.v1.yaml b/reference/export/models/reportdaterange.v1.yaml deleted file mode 100644 index 7ea610e6..00000000 --- a/reference/export/models/reportdaterange.v1.yaml +++ /dev/null @@ -1,23 +0,0 @@ -title: Report endpoint dates -description: Start and end dates, can also specify per report if needed -type: object -properties: - startDate: - $ref: ../../common/models/datetime.v1.yaml - description: cannot be more than 90 days before the endDate - endDate: - $ref: ../../common/models/datetime.v1.yaml - description: cannot be in the future - agp: - $ref: ../../common/models/daterange.v1.yaml - basics: - $ref: ../../common/models/daterange.v1.yaml - bgLog: - $ref: ../../common/models/daterange.v1.yaml - daily: - $ref: ../../common/models/daterange.v1.yaml - settings: - $ref: ../../common/models/daterange.v1.yaml -required: - - startDate - - endDate From 84555a7de8adf7044e1512e698217bd5d9438602 Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 8 Aug 2023 16:05:27 +1200 Subject: [PATCH 18/18] revert mrn ref for patient model --- reference/clinic/models/patient.v1.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/clinic/models/patient.v1.yaml b/reference/clinic/models/patient.v1.yaml index 6b090f73..ac7f2df7 100644 --- a/reference/clinic/models/patient.v1.yaml +++ b/reference/clinic/models/patient.v1.yaml @@ -17,7 +17,9 @@ properties: format: date example: '2012-08-30' mrn: - $ref: ../../metadata/models/mrn.v1.yaml + type: string + description: The medical record number of the patient + minLength: 1 tags: type: array nullable: true