Reports & Data Exports
import { Aside } from ‘@astrojs/starlight/components’;
VitaSync can generate periodic health reports and export user data in multiple formats for compliance, portability, and AI analysis.
Health Reports
Section titled “Health Reports”Generate comprehensive health reports covering a user’s metrics, trends, and recommendations.
Generate a Report
Section titled “Generate a Report”curl -X POST http://localhost:3001/v1/users/$USER_ID/reports/generate \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "reportType": "weekly", "periodStart": "2025-03-10T00:00:00Z", "periodEnd": "2025-03-17T00:00:00Z" }'Report Types
Section titled “Report Types”| Type | Period | Content |
|---|---|---|
weekly | 7 days | Activity summary, sleep trends, notable metrics |
monthly | ~30 days | Full metric breakdown, goal progress, health scores |
quarterly | ~90 days | Trend analysis, correlations, recommendations |
annual | ~365 days | Year-in-review, personal records, long-term trends |
Report Response
Section titled “Report Response”{ "id": "01HX...", "userId": "...", "reportType": "weekly", "title": "Weekly Health Report — Mar 10–17", "status": "completed", "periodStart": "2025-03-10T00:00:00.000Z", "periodEnd": "2025-03-17T00:00:00.000Z", "content": { "...structured report data..." }, "highlights": ["Resting HR decreased 3%", "Sleep consistency improved"], "recommendations": ["Consider increasing cardio frequency"]}Report Statuses
Section titled “Report Statuses”| Status | Description |
|---|---|
generating | Report computation in progress |
completed | Report ready to view |
failed | Report generation encountered an error |
Endpoints
Section titled “Endpoints”| Method | Path | Description |
|---|---|---|
GET | /v1/users/:userId/reports | List reports (filter by reportType) |
GET | /v1/users/:userId/reports/:reportId | Get a specific report |
POST | /v1/users/:userId/reports/generate | Generate a new report |
Data Exports
Section titled “Data Exports”Export all user health data for GDPR compliance, data portability, or external analysis.
Request an Export
Section titled “Request an Export”curl -X POST http://localhost:3001/v1/users/$USER_ID/exports \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "format": "json", "from": "2025-01-01T00:00:00Z", "to": "2025-03-18T00:00:00Z", "metricTypes": ["steps", "heart_rate", "sleep_duration"] }'Export Formats
Section titled “Export Formats”| Format | Description | Use Case |
|---|---|---|
json | Full structured JSON dump | Programmatic access, backup |
csv | Flat CSV tables per metric type | Spreadsheet analysis, data science |
fhir_r4 | HL7 FHIR R4 Bundle | Healthcare interoperability |
pdf | Formatted PDF report | Sharing with healthcare providers |
Export Response
Section titled “Export Response”{ "id": "01HX...", "userId": "...", "format": "json", "status": "pending", "metricTypes": ["steps", "heart_rate", "sleep_duration"], "periodStart": "2025-01-01T00:00:00.000Z", "periodEnd": "2025-03-18T00:00:00.000Z", "downloadUrl": null, "expiresAt": null, "createdAt": "2025-03-18T10:00:00.000Z"}Once processing completes, status changes to completed and downloadUrl is populated with a time-limited download link.
Export Statuses
Section titled “Export Statuses”| Status | Description |
|---|---|
pending | Export queued for processing |
processing | Data extraction in progress |
completed | Ready for download |
failed | Export encountered an error |
expired | Download link has expired |
Endpoints
Section titled “Endpoints”| Method | Path | Description |
|---|---|---|
GET | /v1/users/:userId/exports | List exports |
GET | /v1/users/:userId/exports/:exportId | Get export status/details |
POST | /v1/users/:userId/exports | Request a new export |
FHIR R4 Support
Section titled “FHIR R4 Support”When exporting in fhir_r4 format, VitaSync produces a valid HL7 FHIR R4 Bundle containing:
Patientresource with user metadataObservationresources for each health metric- Standard LOINC codes for common metrics (heart rate, SpO₂, body weight, etc.)