A CGM (Continuous Glucose Monitoring) resource server that exposes anonymized/pseudonymized continuous glucose monitoring data collected from diabetic users' glucose sensors. Intended for use by research organisations and pharmaceutical companies.
- Access Token Validation: All API endpoints validate access tokens through an external authorization server
- Data Classification: Supports multiple data classification levels:
anonymous: Fully anonymized data (no user identifiers)pii: Data with user IDs but no personal information
- Dynamic Data Anonymization: Handlers automatically anonymize or de-anonymize data based on the validated access token's classification
- Comprehensive CGM Data: Includes device ID, user ID, glucose levels, trends, sensor status, battery level, and temperature readings
The AccessValidationMiddleware intercepts all requests to protected endpoints and:
- Extracts the access token from the
Authorizationheader - Validates it against the authorization server
- Stores the validation response in
HttpContext.Itemsfor handlers to use - Returns appropriate error responses for invalid/expired tokens
GET /datasets/cgm
Returns anonymized/pseudonymized CGM sensor data for multiple diabetic users. Requires valid access token.
Response: Array of CGM records
[
{
"deviceId": "CGM-DEV-001",
"userId": "234324",
"timestamp": "2025-10-16T10:30:00Z",
"glucoseLevel": 95.0,
"trend": "steady",
"sensorStatus": "active",
"batteryLevel": 85.5,
"temperature": 36.2
},
{
"deviceId": "CGM-DEV-002",
"userId": "567890",
"timestamp": "2025-10-16T10:30:00Z",
"glucoseLevel": 88.0,
"trend": "steady",
"sensorStatus": "active",
"batteryLevel": 92.0,
"temperature": 36.1
}
]GET /datasets/cgm/{userId}
Returns anonymized/pseudonymized continuous glucose monitoring data for a single diabetic user identified by their pseudonymised ID.
Parameters:
userId(path): Pseudonymised user identifier
Response: Array of CGM records for the specified user
[
{
"deviceId": "CGM-DEV-001",
"userId": "234324",
"timestamp": "2025-10-16T10:30:00Z",
"glucoseLevel": 95.0,
"trend": "steady",
"sensorStatus": "active",
"batteryLevel": 85.5,
"temperature": 36.2
},
{
"deviceId": "CGM-DEV-001",
"userId": "234324",
"timestamp": "2025-10-16T11:00:00Z",
"glucoseLevel": 120.0,
"trend": "rising",
"sensorStatus": "active",
"batteryLevel": 85.0,
"temperature": 36.3
}
]CGM Record Schema:
deviceId: Unique identifier for the CGM deviceuserId: Pseudonymised user identifier linked to CGM datatimestamp: Timestamp of glucose measurement in ISO 8601 formatglucoseLevel: Measured interstitial glucose level (mg/dL)trend: Trend direction -"rising","steady", or"falling"sensorStatus: Operational status -"active","inactive","calibrating", or"error"batteryLevel: Battery level percentage of the CGM devicetemperature: Skin temperature near sensor (°C)
dotnet runThe server will start on https://localhost:5001 (or as configured).
curl -X GET 'https://localhost:5001/datasets/cgm' \
-H 'Authorization: Bearer <your-access-token>'curl -X GET 'https://localhost:5001/datasets/cgm/234324' \
-H 'Authorization: Bearer <your-user-specific-access-token>'curl -X GET 'https://localhost:5001/health'Returns an array of CGM records matching the request criteria.
Invalid or missing access token.
- Token does not have permission to access the requested data
- PII classification tokens cannot access anonymous datasets
- Anonymous classification tokens cannot access user-specific data
The requested user ID does not exist in the system.
┌─────────┐ ┌──────────────┐ ┌─────────────────┐ ┌─────────┐
│ Client │─────>│ Middleware │─────>│ Auth Server │─────>│ Handler │
└─────────┘ └──────────────┘ └─────────────────┘ └─────────┘
│ │ │ │
│ 1. Request │ │ │
│ + Bearer Token │ │ │
│ │ 2. Validate │ │
│ │ Token │ │
│ │ │ 3. Validation │
│ │ │ Response │
│ │ │ (classification, │
│ │ 4. Store in │ authorized users) │
│ │ HttpContext │ │
│ │ │ │
│ │ │ 5. Process with │
│ │ │ Classification │
│ │ │ & Authorization │
│ │ │ │
│ 6. Response │<──────────────────────│──────────────────────│
│ (CGM Records) │ │ │
This API conforms to OpenAPI 3.0.3 specification. When running in development mode, you can access the OpenAPI schema at /openapi/v1.json.
API Information:
- Title: Continuous Glucose Monitoring (CGM) Dataset API
- Version: 1.0.0
- Authentication: Bearer token (JWT)