Skip to content

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.

Generate comprehensive health reports covering a user’s metrics, trends, and recommendations.

Terminal window
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"
}'
TypePeriodContent
weekly7 daysActivity summary, sleep trends, notable metrics
monthly~30 daysFull metric breakdown, goal progress, health scores
quarterly~90 daysTrend analysis, correlations, recommendations
annual~365 daysYear-in-review, personal records, long-term trends
{
"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"]
}
StatusDescription
generatingReport computation in progress
completedReport ready to view
failedReport generation encountered an error
MethodPathDescription
GET/v1/users/:userId/reportsList reports (filter by reportType)
GET/v1/users/:userId/reports/:reportIdGet a specific report
POST/v1/users/:userId/reports/generateGenerate a new report

Export all user health data for GDPR compliance, data portability, or external analysis.

Terminal window
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"]
}'
FormatDescriptionUse Case
jsonFull structured JSON dumpProgrammatic access, backup
csvFlat CSV tables per metric typeSpreadsheet analysis, data science
fhir_r4HL7 FHIR R4 BundleHealthcare interoperability
pdfFormatted PDF reportSharing with healthcare providers
{
"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.

StatusDescription
pendingExport queued for processing
processingData extraction in progress
completedReady for download
failedExport encountered an error
expiredDownload link has expired
MethodPathDescription
GET/v1/users/:userId/exportsList exports
GET/v1/users/:userId/exports/:exportIdGet export status/details
POST/v1/users/:userId/exportsRequest a new export

When exporting in fhir_r4 format, VitaSync produces a valid HL7 FHIR R4 Bundle containing:

  • Patient resource with user metadata
  • Observation resources for each health metric
  • Standard LOINC codes for common metrics (heart rate, SpO₂, body weight, etc.)