Skip to content

Latest commit

ย 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FHIR API Automation with Cypress ๐Ÿš€

๐Ÿ“– Overview

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 ๐Ÿš€

FHIR Badge Cypress Node.js Healthcare

Automated Healthcare API Testing for FHIR Resources

Overview โ€ข Features โ€ข Installation โ€ข Documentation


๐Ÿ“– Overview

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.


๐ŸŒ What is FHIR?

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.


๐Ÿฅ Why Interoperability Matters?

โœจ 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


๐Ÿ›  Project Highlights

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

๐Ÿ“‚ Project Structure

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

โ–ถ๏ธ How to Run Tests

1๏ธโƒฃ Clone this repository

git clone <repository-url>
cd <repository-folder>

2๏ธโƒฃ Install dependencies

npm install

3๏ธโƒฃ Run tests

npx cypress run

4๏ธโƒฃ Generate merged Mochawesome report

npx mochawesome-merge cypress/reports/*.json > cypress/reports/merged.json
npx marge cypress/reports/merged.json --reportDir cypress/reports/final

5๏ธโƒฃ Open the report

cypress/reports/final/merged.html

๐Ÿ“Š Example Test Flow

graph LR
    A[๐Ÿ“ Create Patient] --> B[๐Ÿฉบ Create Condition]
    B --> C[๐Ÿ”ฌ Validate Observation]
    C --> D[๐Ÿ’Š Validate Medication]
    D --> E[๐Ÿ“Š Generate Report]
    E --> F[โœ… All Tests Passed]
Loading
  1. Create Patient โ†’ POST request with mock data
  2. Create Condition โ†’ linked to Patient resource
  3. Validate Observation/Medication โ†’ GET requests to confirm data
  4. Check Reports โ†’ Verify all tests passed with Mochawesome

๐ŸŒŸ Outcome

๐ŸŽฏ Automated validation of healthcare APIs
๐Ÿ”— Demonstrates FHIR interoperability in action
๐Ÿ“ˆ Real-time Cypress reports for better monitoring
๐Ÿ† Production-ready test framework


๐Ÿ”ฎ Next Steps

  • 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

๐Ÿ“Œ References

๐Ÿ”— HL7 Official Site
๐Ÿ”— HAPI FHIR Test Server
๐Ÿ”— Cypress Documentation
๐Ÿ”— FHIR Specification


๐Ÿ‘จโ€๐Ÿ’ป Author

Saran Kumar

GitHub LinkedIn

Built with โค๏ธ for Healthcare Interoperability & Automation


โญ If you find this project helpful, please give it a star! โญ


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with โ˜• & ๐Ÿ’ป

๐ŸŒ What is FHIR?

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.


๐Ÿฅ Why Interoperability Matters?

  • 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.

๐Ÿ›  Project Highlights

  • โœ… 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

๐Ÿ“‚ Project Structure

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

โ–ถ๏ธ How to Run Tests

  1. Clone this repo
  2. Install dependencies:
    npm install
  3. Run tests:
    npx cypress run
  4. Generate merged Mochawesome report:
    npx mochawesome-merge cypress/reports/*.json > cypress/reports/merged.json
    npx marge cypress/reports/merged.json --reportDir cypress/reports/final
  5. Open the report:
    cypress/reports/final/merged.html
    

๐Ÿ“Š Example Test Flow

  1. Create Patient โ†’ POST request with mock data
  2. Create Condition โ†’ linked to Patient resource
  3. Validate Observation/Medication โ†’ GET requests to confirm data
  4. Check Reports โ†’ Verify all tests passed with Mochawesome

๐ŸŒŸ Outcome

  • Automated validation of healthcare APIs
  • Demonstrates FHIR interoperability in action
  • Generates real-time Cypress reports for better monitoring

๐Ÿ”ฎ Next Steps

  • 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

๐Ÿ“Œ References


๐Ÿ‘จโ€๐Ÿ’ป Built with โค๏ธ for Healthcare Interoperability & Automation

About

End-to-end API tests for HL7 FHIR resources using Cypress, targeting the public HAPI FHIR R4 server. Each resource has separate spec files, and CRUD flows reuse dynamically created IDs via a shared fixture.

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages