openapi: 3.1.0 info: title: Api version: 0.2.0 description: Uroflow Tracker API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: voidings description: Voiding event operations - name: fluid-intake description: Fluid intake tracking - name: report description: Analytics and reports paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /voidings: get: operationId: listVoidings tags: [voidings] summary: List voiding events newest first responses: "200": description: List of voiding events content: application/json: schema: type: array items: $ref: "#/components/schemas/VoidingEvent" post: operationId: createVoiding tags: [voidings] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateVoidingEvent" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/VoidingEvent" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /voidings/{id}: get: operationId: getVoiding tags: [voidings] parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Voiding event content: application/json: schema: $ref: "#/components/schemas/VoidingEvent" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: deleteVoiding tags: [voidings] parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /voidings/stats/summary: get: operationId: getVoidingStats tags: [voidings] summary: Aggregated voiding statistics responses: "200": description: Statistics content: application/json: schema: $ref: "#/components/schemas/VoidingStats" /fluid-intake: get: operationId: listFluidIntake tags: [fluid-intake] summary: List fluid intake events newest first responses: "200": description: List of fluid intake events content: application/json: schema: type: array items: $ref: "#/components/schemas/FluidIntakeEvent" post: operationId: createFluidIntake tags: [fluid-intake] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateFluidIntakeEvent" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/FluidIntakeEvent" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /fluid-intake/{id}: delete: operationId: deleteFluidIntake tags: [fluid-intake] parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /report: get: operationId: getReport tags: [report] summary: Get full analytics report responses: "200": description: Report data content: application/json: schema: $ref: "#/components/schemas/ReportData" components: schemas: HealthStatus: type: object properties: status: type: string required: [status] ErrorResponse: type: object properties: error: type: string required: [error] VoidingEvent: type: object properties: id: type: integer voidedAt: type: string format: date-time volumeMl: type: integer minimum: 0 qmax: type: number nullable: true durationSeconds: type: integer minimum: 0 nullable: true urineColor: type: string enum: [pale_yellow, yellow, dark_yellow, orange, dark_orange] cloudy: type: boolean appearanceTags: type: array items: type: string enum: [clots, flakes, specks] nullable: true hematuria: type: string enum: [none, visible_hematuria, post_drops, post_pink] urgency: type: string enum: [none, awareness, urgent, highly_urgent, sudden_onset] nullable: true painLocations: type: array items: type: string enum: [spasm, perineum, shaft, tip] nullable: true stream: type: string enum: [strong, normal, weak, intermittent, dribbling] nullable: true isNocturia: type: boolean notes: type: string nullable: true createdAt: type: string format: date-time required: - id - voidedAt - volumeMl - urineColor - cloudy - hematuria - isNocturia - createdAt CreateVoidingEvent: type: object properties: voidedAt: type: string format: date-time volumeMl: type: integer minimum: 0 qmax: type: number nullable: true durationSeconds: type: integer minimum: 0 nullable: true urineColor: type: string enum: [pale_yellow, yellow, dark_yellow, orange, dark_orange] cloudy: type: boolean appearanceTags: type: array items: type: string enum: [clots, flakes, specks] nullable: true hematuria: type: string enum: [none, visible_hematuria, post_drops, post_pink] urgency: type: string enum: [none, awareness, urgent, highly_urgent, sudden_onset] nullable: true painLocations: type: array items: type: string enum: [spasm, perineum, shaft, tip] nullable: true stream: type: string enum: [strong, normal, weak, intermittent, dribbling] nullable: true isNocturia: type: boolean notes: type: string nullable: true required: - voidedAt - volumeMl - urineColor - cloudy - hematuria - isNocturia FluidIntakeEvent: type: object properties: id: type: integer recordedAt: type: string format: date-time volumeMl: type: integer minimum: 0 drinkTypes: type: array items: type: string enum: [caffeine, fizzy, acidic, alcohol, neutral] nullable: true createdAt: type: string format: date-time required: - id - recordedAt - volumeMl - createdAt CreateFluidIntakeEvent: type: object properties: recordedAt: type: string format: date-time volumeMl: type: integer minimum: 0 drinkTypes: type: array items: type: string enum: [caffeine, fizzy, acidic, alcohol, neutral] nullable: true required: - recordedAt - volumeMl VoidingStats: type: object properties: last7Days: $ref: "#/components/schemas/StatsPeriod" last30Days: $ref: "#/components/schemas/StatsPeriod" totalRecords: type: integer required: [last7Days, last30Days, totalRecords] StatsPeriod: type: object properties: count: type: integer avgVolumeMl: type: number nullable: true totalVolumeMl: type: integer bloodIncidents: type: integer avgDurationSeconds: type: number nullable: true required: [count, avgVolumeMl, totalVolumeMl, bloodIncidents, avgDurationSeconds] ReportData: type: object properties: fluidBalance: type: array items: $ref: "#/components/schemas/FluidBalancePoint" nocturia: $ref: "#/components/schemas/NocturiaStats" urgencyVsVolume: type: array items: $ref: "#/components/schemas/UrgencyVsVolume" required: [fluidBalance, nocturia, urgencyVsVolume] FluidBalancePoint: type: object properties: date: type: string cumulativeIntakeMl: type: number cumulativeVoidedMl: type: number netBalanceMl: type: number required: [date, cumulativeIntakeMl, cumulativeVoidedMl, netBalanceMl] NocturiaStats: type: object properties: totalEvents: type: integer avgPerNight: type: number nights: type: array items: $ref: "#/components/schemas/NocturiaNight" required: [totalEvents, avgPerNight, nights] NocturiaNight: type: object properties: date: type: string count: type: integer required: [date, count] UrgencyVsVolume: type: object properties: urgency: type: string avgVolumeMl: type: number count: type: integer required: [urgency, avgVolumeMl, count]