POC - Mapping CDA to FHIR
0.1.0 - ci-build
FRANCE
POC - Mapping CDA to FHIR - version de développement local (intégration continue v0.1.0) construite par les outils de publication FHIR (HL7® FHIR® Standard). Voir le répertoire des versions publiées
Ce guide vous permet de tester rapidement la transformation de documents CDA vers FHIR en utilisant matchbox et les exemples fournis.
docker pull europe-west6-docker.pkg.dev/ahdis-ch/ahdis/matchbox:v4.0.12
Important : Adaptez le chemin selon votre installation locale. Le chemin doit pointer vers le dossier input/with-all de votre projet.
docker run -d --name matchbox -p 8080:8080 \
-v /chemin/absolu/vers/IG-mapping-cda-fhir/input/with-all:/config \
europe-west6-docker.pkg.dev/ahdis-ch/ahdis/matchbox:v4.0.12
Ou utilisez le script de démarrage automatique :
./start-matchbox.sh
Pour suivre les logs de matchbox :
docker logs --follow matchbox
Attendez que matchbox ait terminé son démarrage. L'interface sera accessible sur : http://localhost:8080/matchbox
Les fichiers HTTP de test se trouvent dans le dossier http-test/. Utilisez le fichier fr_cdatofhir_mde.http avec votre client REST.
Avec VS Code et l'extension REST Client :
http-test/fr_cdatofhir_mde.httpAvec curl (exemple complet) :
# 1. Charger les ConceptMaps nécessaires
curl -X POST http://localhost:8080/matchbox/fhir/ConceptMap \
-H "Content-Type: application/fhir+json" \
--data-binary @input/resources/ConceptMap-cm-v3-administrative-gender.json
# 2. Charger les StructureMaps dans l'ordre
curl -X POST http://localhost:8080/matchbox/fhir/StructureMap \
-H "Accept: application/fhir+xml;fhirVersion=4.0" \
-H "Content-Type: text/fhir-mapping" \
--data-binary @input/fml/CDAtoFHIRTypes.fml
curl -X POST http://localhost:8080/matchbox/fhir/StructureMap \
-H "Accept: application/fhir+xml;fhirVersion=4.0" \
-H "Content-Type: text/fhir-mapping" \
--data-binary @input/fml/CdaToBundle.fml
curl -X POST http://localhost:8080/matchbox/fhir/StructureMap \
-H "Accept: application/fhir+xml;fhirVersion=4.0" \
-H "Content-Type: text/fhir-mapping" \
--data-binary @input/fml/CDAFrToBundle.fml
curl -X POST http://localhost:8080/matchbox/fhir/StructureMap \
-H "Accept: application/fhir+xml;fhirVersion=4.0" \
-H "Content-Type: text/fhir-mapping" \
--data-binary @input/fml/CDAFrMDEToBundle.fml
# 3. Transformer un document CDA
curl -X POST "http://localhost:8080/matchbox/fhir/StructureMap/\$transform?source=https://interop.esante.gouv.fr/ig/fhir/mappingcdafhir/StructureMap/CdaFrMDEToBundle" \
-H "Accept: application/fhir+json;fhirVersion=4.0" \
-H "Content-Type: application/fhir+xml;fhirVersion=4.0" \
--data-binary @input/attachments/CSE-MDE_2023.01.xml
Le dossier input/attachments/ contient un exemple de document CDA français :
Si la transformation réussit, vous obtiendrez un Bundle FHIR contenant les ressources converties depuis le document CDA.
Note importante : Il peut y avoir des erreurs dans les fichiers FML lors de la transformation. L'objectif de ce POC est de valider le processus de transformation. Les erreurs dans les mappings seront traitées ultérieurement.
Les transformations CDA-FHIR ont été exécutées avec les résultats suivants :
| Fichier source | StructureMap utilisé | Fichier résultat | Ressources FHIR | Observations | Statut |
|---|---|---|---|---|---|
| CSE-MDE_2023.01.xml | CdaFrMDEToBundle | Bundle-fe569e1f-32d4-4ba4-b5ad-88082bf5470a.json | 11 | 3 | ✅ Succès complet |
Détails de la transformation :
Document CSE-MDE (Carnet de Santé de l'Enfant - Mesures) :
CdaFrMDEToBundle - Mapping spécifique pour le contexte françaisCdaToFHIRTypes, CdaToBundle et CdaFrToBundleLe mapping CdaFrMDEToBundle.fml est un mapping spécialisé pour les documents CSE-MDE français qui combine :
Architecture du mapping :
CdaToFHIRTypes, CdaToBundle, CdaFrToBundle)Résultats obtenus :
organizer > component > observationExemple d'Observation générée :
{
"resourceType": "Observation",
"status": "final",
"category": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "vital-signs"
}]
}],
"code": {
"coding": [{
"system": "http://loinc.org",
"code": "29463-7",
"display": "Poids"
}]
},
"subject": {
"reference": "urn:uuid:..."
},
"effectiveDateTime": "2023-01-06",
"valueQuantity": {
"value": 3900,
"unit": "g",
"system": "http://unitsofmeasure.org",
"code": "g"
}
}
Pour arrêter le conteneur :
docker stop matchbox
Pour redémarrer :
docker start matchbox
Pour supprimer le conteneur (et repartir de zéro) :
docker rm -f matchbox
Le fichier input/with-all/application.yaml configure matchbox avec :
Pour modifier la configuration, éditez application.yaml puis supprimez et recréez le conteneur Docker.
Merci à Oliver Egger (Ahdis, HL7 Suisse) qui a travaillé sur la première brique sur laquelle repose ces travaux et sur l'outil matchbox permettant d'effectuer la transformation. https://github.com/hl7ch/cda-fhir-maps