A Node.js script that transforms FHIR (Fast Healthcare Interoperability Resources) JSON data into structured CSV files for healthcare data integration.
This script processes FHIR resources including Patient, Provider, and Encounter data, transforming them into easily manageable CSV formats. Perfect for healthcare data migrations, analytics, and system integrations.
- 🔄 Converts FHIR JSON to CSV format
- 👤 Processes Patient demographics
- 👨⚕️ Handles Provider information
- 🏥 Manages Encounter data
- 📅 Standardized date formatting
- ⚡ Efficient data transformation
- 🔍 OID to ID type mapping
- Node.js installed
json2csvnpm package- Source FHIR JSON files in
resourcesfolder
├── resources/
│ ├── fhir_sample_patient.json
│ ├── fhir_sample_provider.json
│ ├── fhir_sample_encounter.json
│ └── fhir_sample_oru.json
├── csv/
│ ├── Patient.csv
│ ├── Provider.csv
│ └── Encounter.csv
└── mapper.js
# Clone the repository
git clone https://github.com/yourusername/fhir-csv-mapper
# Install dependencies
npm install json2csv- Place your FHIR JSON files in the
resourcesfolder - Run the script:
node mapper.js- Find converted CSV files in the
csvfolder
- Patient_ID
- First/Last Name
- DOB
- Gender
- Contact Information
- Address Details
- Status Information
- Provider_ID
- Personal Information
- Specialty
- Organization
- Contact Details
- Encounter_ID
- Patient/Practitioner References
- Encounter Details
- Status Information
// Date formatting
formatDate(dateString) → MM/DD/YYYY
// Gender standardization
convertGender(gender) → M/F/U
// OID mapping
mapOidToIdType(oid) → ID type stringGlenn R. Tomassi
Make yourself at 🏠.
Made with ❤️ for healthcare interoperability