@univ-lehavre/atlas-crf
@univ-lehavre/atlas-crf
Microservice HTTP CRF pour exposer une API REST au-dessus de REDCap.
About
Ce service Hono encapsule le client REDCap Atlas et expose des routes, métadonnées projet, instruments, champs, records, PDF, liens de survey et recherche utilisateur par email. Il ajoute validation Effect, réponses d’erreur normalisées, rate limiting et documentation OpenAPI/Scalar côté serveur.
Features
- Health checks: état du serveur REDCap, token et latence moyenne
- Projet REDCap: version, informations projet, instruments, champs et noms d’export
- Records: export, import, PDF et liens survey avec validation de requête
- Utilisateurs: résolution d’un utilisateur REDCap par email
Usage
Server
Depuis le monorepo:
# Required environment variablesexport REDCAP_API_URL=https://redcap.example.com/api/export REDCAP_API_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAexport CRF_AUTH_TOKEN=change-me-shared-bearer-secretexport PORT=3000
# Start the serverpnpm -F @univ-lehavre/atlas-crf startLes routes /api/* exigent un en-tête Authorization: Bearer $CRF_AUTH_TOKEN
(secret partagé statique, requis — le serveur refuse de démarrer sans). Les
sondes /health, /openapi.json et /docs restent ouvertes. Voir
l’ADR 0041 pour la stratégie d’authentification.
Le package exporte aussi createApp() pour construire l’application Hono dans des tests ou dans un runtime serveur personnalisé.
Server API
| Endpoint | Description |
|---|---|
GET /health | Health check |
GET /api/v1/project/version | REDCap version |
GET /api/v1/project/info | Project information |
GET /api/v1/project/instruments | REDCap instruments |
GET /api/v1/project/fields | REDCap data dictionary fields |
GET /api/v1/project/export-field-names | Export field name mappings |
GET /api/v1/records | Export records |
POST /api/v1/records | Import records |
GET /api/v1/records/:recordId/pdf | Download record PDF |
GET /api/v1/records/:recordId/survey-link | Get survey link |
GET /api/v1/users/by-email?email=... | Find a user |
GET /openapi.json | OpenAPI specification |
GET /docs | Scalar documentation |
Scripts
pnpm -F @univ-lehavre/atlas-crf start:dev # Development serverpnpm -F @univ-lehavre/atlas-crf build # Production buildpnpm -F @univ-lehavre/atlas-crf test # Unit testspnpm -F @univ-lehavre/atlas-crf start # Start built serverpnpm -F @univ-lehavre/atlas-crf test:api # API testspnpm -F @univ-lehavre/atlas-crf test:integration # Integration testsDocumentation
- Données structurées de formulaires (CRF) : flux et contrats
- Documentation interactive du service:
GET /docs - Spécification OpenAPI du service:
GET /openapi.json
Organization
This package is part of Atlas, a set of tools developed by Le Havre Normandie University to facilitate research and collaboration between researchers.
Atlas is developed as part of two projects led by Le Havre Normandie University:
- Campus Polytechnique des Territoires Maritimes et Portuaires: research and training program focused on maritime and port issues
- EUNICoast: European university alliance bringing together institutions located in European coastal areas
License
MIT