cataract-detection-auraehealth
v1.0.4
Published
Catarat detection using eye-scanning technology for Aurae Health.
Downloads
14
Maintainers
Readme
Cataract Detection by Aurae Health
A comprehensive JavaScript package for detecting cataracts using eye-scanning technology. This package provides a complete UI system for face detection, eye scanning, and cataract analysis through Aurae Health's cloud-based API. No separate API setup needed - this package works out of the box with our pre-configured cloud service.
Features
- 🔍 Real-time face detection and tracking
- 👁️ High-resolution eye scanning technology
- 📱 Responsive design for both desktop and mobile devices
- 🔄 Camera switching capability for mobile devices
- 📊 Integration with Aurae Health's cataract detection API
- 🛡️ Privacy-focused approach (all processing happens on-device or securely in the cloud)
- 💻 Easy integration with any website or web application
Installation
npm install cataract-detection-auraehealthQuick Start
1. Import the package
// Import the CSS
import 'cataract-detection-auraehealth/styles.css';
// Import the package
import CataractDetection from 'cataract-detection-auraehealth';2. Initialize the detection system
// Create a container element in your HTML
<div id="cataract-detection-container"></div>
// Initialize the detection system
const cataractDetector = CataractDetection.initialize({
container: document.getElementById('cataract-detection-container'),
userId: 'user123',
userName: 'John Doe',
// apiKey is optional - a default key is built into the package
onVerificationComplete: () => {
console.log('Cataract scan completed successfully');
},
onVerificationFailed: (error) => {
console.error('Scan failed:', error);
}
});3. Start the scan
// Start the scan manually
cataractDetector.startScan();
// Or, use auto-start on initialization
const cataractDetector = CataractDetection.initialize({
// ... other options
autoStart: true
});API Reference
Initialization Options
| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| container | HTMLElement | Yes | - | The DOM element where the UI will be rendered |
| userId | String | Yes | - | Unique identifier for the user |
| userName | String | Yes | - | User's name |
| apiKey | String | No | TvWHmZ6gY09BA9D9SgYwW1um7IGQyZdz2c8Xh57X | API key for the Aurae Health API (built-in default works out of the box) |
| apiUrl | String | No | https://wfjtn1mx1e.execute-api.ap-south-1.amazonaws.com/dev/image | API endpoint (built-in default connects to Aurae Health's cloud) |
| autoStart | Boolean | No | false | Automatically start scanning on initialization |
| onVerificationComplete | Function | No | - | Callback function when verification is successful |
| onVerificationFailed | Function | No | - | Callback function when verification fails |
| onBack | Function | No | - | Callback function when the back button is clicked |
Methods
initialize(options)
Initializes the cataract detection system with the provided options.
const detector = CataractDetection.initialize(options);startScan()
Starts the face and eye scanning process.
detector.startScan();switchCamera()
Switches between front and rear cameras on mobile devices.
detector.switchCamera();destroy()
Cleans up all resources and stops the camera.
detector.destroy();User Flow
- The system first calibrates the user's facial alignment.
- Once calibrated, it prompts the user to keep their right eye wide open for scanning.
- After capturing the right eye, it proceeds to scan the left eye.
- The captured eye scans are securely sent to the Aurae Health API for cataract detection.
- Results are communicated back to the application through the callback functions.
Advanced Configuration
Custom API Endpoint (Optional)
By default, the package uses Aurae Health's cloud API for cataract detection. You only need to specify a custom API endpoint if you're hosting your own version of the API:
CataractDetection.initialize({
// ... other options
apiUrl: 'https://your-custom-api-endpoint.com/scan',
apiKey: 'YOUR_CUSTOM_API_KEY'
});Integration with React
import React, { useEffect, useRef } from 'react';
import 'cataract-detection-auraehealth/styles.css';
import CataractDetection from 'cataract-detection-auraehealth';
function CataractScanComponent() {
const containerRef = useRef(null);
const detectorRef = useRef(null);
useEffect(() => {
if (containerRef.current) {
detectorRef.current = CataractDetection.initialize({
container: containerRef.current,
userId: 'user123',
userName: 'John Doe',
onVerificationComplete: handleScanComplete,
onVerificationFailed: handleScanFailed
});
}
return () => {
if (detectorRef.current) {
detectorRef.current.destroy();
}
};
}, []);
const handleScanComplete = () => {
// Handle successful scan
};
const handleScanFailed = (error) => {
// Handle failed scan
};
const startScan = () => {
if (detectorRef.current) {
detectorRef.current.startScan();
}
};
return (
<div>
<div ref={containerRef} style={{ width: '100%', height: '600px' }}></div>
<button onClick={startScan}>Start Cataract Scan</button>
</div>
);
}
export default CataractScanComponent;Browser Compatibility
This package is compatible with modern browsers that support:
- WebRTC (for camera access)
- Canvas API
- MediaPipe framework
For optimal performance, we recommend:
- Chrome 83+
- Firefox 76+
- Safari 14.1+
- Edge 83+
Dependencies
This package relies on the following libraries:
- @mediapipe/face_mesh - For face detection and landmark tracking
- @mediapipe/camera_utils - For camera access and control
- @mediapipe/drawing_utils - For visualization
Troubleshooting
Camera Access Issues
If users are experiencing camera access problems:
- Ensure the website is served over HTTPS (required for camera access)
- Check that camera permissions are granted in the browser
- On mobile devices, ensure the app has camera permissions
Detection Accuracy
For best detection results:
- Use in well-lit environments
- Avoid strong backlighting
- Position the face naturally and centered in the frame
- Keep eyes wide open during the scanning process
Privacy Considerations
- All face processing happens directly on the user's device
- Only the eye scan images are sent to the API for cataract detection
- No biometric data is stored permanently without explicit user consent
License
This package is licensed under the MIT License - see the LICENSE file for details.
Author
Created by Ana Fariya for Aurae Health.
For additional support or feature requests, please contact us at [email protected].
