API Community Workers (Cuidadoras)
L'API Community Workers permet de gerer les agents communautaires (cuidadoras) du programme de protection sociale.
Vue d'ensemble
Le module Community Workers gere les agents communautaires qui effectuent des activites sur le terrain : enregistrement de menages, sensibilisation, verification, collecte GRM, et suivi des vulnerables.
Architecture du module
┌─────────────────────────────────────────────────────────────────────────┐
│ COMMUNITY WORKER │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ Informations personnelles: nom, prenom, telephone, email, etc. │ │
│ │ Zone d'affectation: region, secteur, localite │ │
│ │ Contrat: type (volontaire/contractuel), dates, statut │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────┼─────────────────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ AFFECTATIONS │ │ ACTIVITES │ │ FORMATIONS │ │
│ │ Historique │ │ Rapports │ │ Certifications│ │
│ │ des zones │ │ d'activite │ │ Evaluations │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────┐ │
│ │ PAIEMENTS │ │
│ │ Fiches mensu-│ │
│ │ elles + Lots │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘
Endpoints principaux
| Endpoint | Methode | Description |
|---|---|---|
/api/community-workers | GET | Liste des community workers |
/api/community-workers | POST | Creer un community worker |
/api/community-workers/{id} | GET | Detail d'un community worker |
/api/community-workers/{id} | PUT/PATCH | Modifier un community worker |
/api/community-workers/{id} | DELETE | Supprimer un community worker |
/api/community-workers/stats | GET | Statistiques globales |
/api/community-workers/bulk-status | POST | Modification en masse du statut |
/api/community-workers/check-duplicates | POST | Verifier les doublons |
/api/community-workers/{id}/affectations | GET | Historique des affectations |
/api/community-workers/{id}/change-affectation | POST | Changer l'affectation |
/api/community-workers/{id}/activites | GET | Rapports d'activite |
/api/community-workers/{id}/certifications | GET | Certifications |
/api/community-workers/{id}/evaluations | GET | Evaluations |
/api/community-workers/{id}/photo | POST | Upload photo |
/api/community-workers/{id}/photo | DELETE | Supprimer photo |
/api/community-workers/paiements | GET | Liste des paiements cuidadors |
/api/community-workers/paiements/stats | GET | Statistiques des paiements |
/api/community-workers/kobo/forms | GET | Formulaires Kobo disponibles |
/api/community-workers/kobo/sync | POST | Synchroniser depuis Kobo |
/api/community-workers/kobo/import | POST | Importer des soumissions |
/api/community-workers/kobo/recent | GET | CW importes recemment |
/api/community-workers/kobo/stats | GET | Statistiques d'import Kobo |
Modele de donnees
CommunityWorker
| Champ | Type | Description |
|---|---|---|
id | UUID | Identifiant unique |
code | string | Code unique (format: CW-REGION-SEQ) |
prenom | string | Prenom |
nom | string | Nom |
nomComplet | string | Nom complet (calcule) |
sexe | string | M ou F |
dateNaissance | date | Date de naissance |
lieuNaissance | string | Lieu de naissance |
telephone | string | Numero de telephone |
email | string | Adresse email |
niveauInstruction | string | Niveau d'instruction |
pieceIdentite | string | Type de piece d'identite |
numeroPieceIdentite | string | Numero de la piece |
adresse | text | Adresse complete |
languePrincipale | string | Langue principale |
languesSecondaires | array | Langues secondaires |
typeContrat | string | volontaire ou contractuel |
dateRecrutement | date | Date de recrutement |
dateFinContrat | date | Date de fin de contrat |
statut | string | Statut actuel |
photo | string | Chemin vers la photo |
region | object | Region d'affectation |
secteur | object | Secteur d'affectation |
localite | object | Localite d'affectation |
superviseur | object | Superviseur (autre CW) |
programme | object | Programme associe |
koboSubmissionId | string | ID de la soumission Kobo (si importe) |
koboSubmissionTime | datetime | Date de soumission Kobo |
agentCollecte | string | Nom de l'agent ayant collecte les donnees |
createdAt | datetime | Date de creation |
updatedAt | datetime | Date de mise a jour |
Statuts
| Statut | Description |
|---|---|
actif | Community worker en activite |
suspendu | Temporairement suspendu |
inactif | Inactif ou sorti |
Types de contrat
| Type | Description |
|---|---|
volontaire | Agent benevole, non remunere |
contractuel | Agent sous contrat, remunere |
Statistiques
L'endpoint /api/community-workers/stats retourne :
{
"success": true,
"data": {
"total": 150,
"actifs": 120,
"suspendus": 5,
"inactifs": 25,
"parSexe": {
"M": 45,
"F": 105
},
"tauxValidation": 85.5,
"tauxCertification": 72.3,
"parRegion": [
{"region": "Oio", "count": 45},
{"region": "Bafata", "count": 35}
]
}
}
Codes d'erreur
| Code | Statut HTTP | Description |
|---|---|---|
NOT_FOUND | 404 | Community Worker non trouve |
VALIDATION_ERROR | 400 | Donnees invalides (nom/prenom requis) |
INVALID_STATUS | 400 | Statut invalide |
FORBIDDEN | 403 | Permission insuffisante |