This project demonstrates how to automate FHIR (Fast Healthcare Interoperability Resources) APIs using Cypress.
The automation validates healthcare resources like Patient, Condition, Observation, and Medication with real-time reporting.
---# ๐ฅ FHIR API Automation with Cypress ๐
Automated Healthcare API Testing for FHIR Resources
Overview โข Features โข Installation โข Documentation
This project demonstrates how to automate FHIR (Fast Healthcare Interoperability Resources) APIs using Cypress. The automation validates healthcare resources like Patient, Condition, Observation, and Medication with real-time reporting.
FHIR (Fast Healthcare Interoperability Resources) is a global standard created by HL7 (Health Level Seven International). It allows healthcare systems to communicate and exchange data seamlessly.
๐ก Think of it like a common language for healthcare applications โ so a hospital's EHR, a pharmacy system, and a lab system can all understand each other.
โจ Better patient care โ doctors get accurate information faster
๐ Secure data sharing across hospitals, pharmacies, and labs
๐ Compliance standards like HL7, USCDI, HTI-1
โก Reduces manual errors and speeds up healthcare operations
| Feature | Description |
|---|---|
| โ Automated FHIR Resources | Patient, Condition, Observation, Medication |
| โ HAPI FHIR Test Server | Using https://hapi.fhir.org/baseR4 |
| โ CRUD Operations | Create, Read, Update, Delete |
| โ Dynamic Test Data | Read from fixtures (JSON files) โ scalable & reusable |
| โ Mochawesome Reports | Beautiful HTML reports with detailed insights |
| โ Real-time Validation | Healthcare data consistency checks |
cypress/
โฃ ๐ e2e/ # Test cases for FHIR APIs
โ โฃ ๐ condition/ # Condition resource tests
โ โฃ ๐ medication/ # Medication resource tests
โ โฃ ๐ observation/ # Observation resource tests
โ โ ๐ patient/ # Patient resource tests
โฃ ๐ fixtures/ # Test data in JSON format
โฃ ๐ reports/ # Test execution reports (HTML & JSON)
โฃ ๐ support/ # Support commands & config
๐ cypress.config.js # Cypress configuration file
๐ package.json # Node.js dependencies
git clone <repository-url>
cd <repository-folder>npm installnpx cypress runnpx mochawesome-merge cypress/reports/*.json > cypress/reports/merged.json
npx marge cypress/reports/merged.json --reportDir cypress/reports/finalcypress/reports/final/merged.htmlgraph LR
A[๐ Create Patient] --> B[๐ฉบ Create Condition]
B --> C[๐ฌ Validate Observation]
C --> D[๐ Validate Medication]
D --> E[๐ Generate Report]
E --> F[โ
All Tests Passed]
- Create Patient โ POST request with mock data
- Create Condition โ linked to Patient resource
- Validate Observation/Medication โ GET requests to confirm data
- Check Reports โ Verify all tests passed with Mochawesome
๐ฏ Automated validation of healthcare APIs
๐ Demonstrates FHIR interoperability in action
๐ Real-time Cypress reports for better monitoring
๐ Production-ready test framework
- Add more FHIR resources for wider test coverage
- Integrate with CI/CD pipelines for continuous validation
- Extend to real EHR systems for production-grade interoperability
- Implement authentication & security testing
- Add performance & load testing scenarios
๐ HL7 Official Site
๐ HAPI FHIR Test Server
๐ Cypress Documentation
๐ FHIR Specification
Saran Kumar
Built with โค๏ธ for Healthcare Interoperability & Automation
โญ If you find this project helpful, please give it a star! โญ
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โ & ๐ป
FHIR (Fast Healthcare Interoperability Resources) is a global standard created by HL7 (Health Level Seven International).
It allows healthcare systems to communicate and exchange data seamlessly.
Think of it like a common language for healthcare applications โ so a hospitalโs EHR, a pharmacy system, and a lab system can all understand each other.
- Better patient care โ doctors get accurate information faster.
- Secure data sharing across hospitals, pharmacies, and labs.
- Helps in meeting compliance standards like HL7, USCDI, HTI-1.
- Reduces manual errors and speeds up healthcare operations.
- โ Automated FHIR resources โ Patient, Condition, Observation, Medication
- โ Used HAPI FHIR Test Server โ https://hapi.fhir.org/baseR4
- โ Implemented CRUD operations (Create, Read, Update, Delete)
- โ Dynamically read data from fixtures (JSON files) โ scalable & reusable tests
- โ Integrated Mochawesome reporting โ generates beautiful HTML reports
- โ Real-time validation of healthcare data consistency
cypress/
โฃ e2e/ # Test cases for FHIR APIs
โ โฃ condition/ # Condition resource tests
โ โฃ medication/ # Medication resource tests
โ โฃ observation/ # Observation resource tests
โ โ patient/ # Patient resource tests
โฃ fixtures/ # Test data in JSON format
โฃ reports/ # Test execution reports (HTML & JSON)
โฃ support/ # Support commands & config
cypress.config.js # Cypress configuration file
package.json # Node.js dependencies
- Clone this repo
- Install dependencies:
npm install
- Run tests:
npx cypress run
- Generate merged Mochawesome report:
npx mochawesome-merge cypress/reports/*.json > cypress/reports/merged.json npx marge cypress/reports/merged.json --reportDir cypress/reports/final
- Open the report:
cypress/reports/final/merged.html
- Create Patient โ POST request with mock data
- Create Condition โ linked to Patient resource
- Validate Observation/Medication โ GET requests to confirm data
- Check Reports โ Verify all tests passed with Mochawesome
- Automated validation of healthcare APIs
- Demonstrates FHIR interoperability in action
- Generates real-time Cypress reports for better monitoring
- Add more FHIR resources for wider test coverage
- Integrate with CI/CD pipelines for continuous validation
- Extend to real EHR systems for production-grade interoperability
๐จโ๐ป Built with โค๏ธ for Healthcare Interoperability & Automation