Spaces:
Build error
Build error
Commit ·
bb02ce5
1
Parent(s): 48a476c
changes
Browse files- .gitignore +6 -0
- DEPLOYMENT.md +47 -0
- README.md +67 -10
- verify-deployment.sh +38 -0
.gitignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
node_modules/
|
| 2 |
+
npm-debug.log*
|
| 3 |
+
.npm
|
| 4 |
+
.env
|
| 5 |
+
.DS_Store
|
| 6 |
+
package-lock.json
|
DEPLOYMENT.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Practice Fusion Automator - Ready for Deployment
|
| 2 |
+
|
| 3 |
+
## ✅ Current Status
|
| 4 |
+
Your local files have been updated with the simple, proven login approach. The error you're seeing is from the old deployed version.
|
| 5 |
+
|
| 6 |
+
## 📋 Files Updated (Ready to Deploy)
|
| 7 |
+
- `package.json`: Uses `puppeteer` (not puppeteer-core)
|
| 8 |
+
- `index.js`: Simple login flow with networkidle2 navigation
|
| 9 |
+
- `Dockerfile`: Simplified Puppeteer setup
|
| 10 |
+
- `.gitignore`: Added to exclude node_modules
|
| 11 |
+
|
| 12 |
+
## 🚀 Deployment Steps
|
| 13 |
+
|
| 14 |
+
1. **Push Updated Files to Hugging Face Spaces**
|
| 15 |
+
- Upload all files from this directory to your HF Space
|
| 16 |
+
- Make sure to overwrite the existing files
|
| 17 |
+
|
| 18 |
+
2. **Set Environment Variables**
|
| 19 |
+
- Go to your Space settings
|
| 20 |
+
- Add these secrets:
|
| 21 |
+
- `LOGIN_EMAIL`: your Practice Fusion email
|
| 22 |
+
- `LOGIN_PASSWORD`: your Practice Fusion password
|
| 23 |
+
|
| 24 |
+
3. **Restart the Space**
|
| 25 |
+
- The new version will use the simple login approach
|
| 26 |
+
- No more Chrome detection messages
|
| 27 |
+
- No more navigation timeout errors
|
| 28 |
+
|
| 29 |
+
## 🔍 What Changed
|
| 30 |
+
- ❌ Removed complex Chrome path detection
|
| 31 |
+
- ❌ Removed timeout error handling that was causing issues
|
| 32 |
+
- ❌ Removed puppeteer-core dependency
|
| 33 |
+
- ✅ Added simple puppeteer.launch() with basic args
|
| 34 |
+
- ✅ Added simple login flow: goto → type → click → waitForNavigation
|
| 35 |
+
- ✅ Used your proven working approach
|
| 36 |
+
|
| 37 |
+
## 📱 Expected Behavior After Deployment
|
| 38 |
+
```
|
| 39 |
+
Starting browser...
|
| 40 |
+
Navigating to login page...
|
| 41 |
+
Entering credentials...
|
| 42 |
+
Clicking login button...
|
| 43 |
+
Login successful. Starting automation script...
|
| 44 |
+
Automation is now running in the background
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
The timeout error will be gone because we're using the same simple navigation approach that worked in your reference code.
|
README.md
CHANGED
|
@@ -1,10 +1,67 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
--
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Practice Fusion Automation for Hugging Face Spaces
|
| 2 |
+
|
| 3 |
+
This project automates the Practice Fusion receipt processing workflow and is designed to run on Hugging Face Spaces.
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
|
| 7 |
+
- **Automated Login**: Uses environment variables for secure login
|
| 8 |
+
- **Receipt Processing**: Automatically processes Auto-Receipt items
|
| 9 |
+
- **Business Hours**: Only runs during 8 AM - 6 PM ET
|
| 10 |
+
- **Live Dashboard**: Real-time monitoring with WebSocket updates
|
| 11 |
+
- **Error Handling**: Comprehensive error handling and automatic restarts
|
| 12 |
+
- **Modern UI**: Dark theme with live statistics and activity logs
|
| 13 |
+
|
| 14 |
+
## Setup for Hugging Face Spaces
|
| 15 |
+
|
| 16 |
+
1. **Create a new Space** on Hugging Face with Docker configuration
|
| 17 |
+
2. **Upload these files** to your Space repository
|
| 18 |
+
3. **Set Environment Variables** in your Space settings:
|
| 19 |
+
- `LOGIN_EMAIL`: Your Practice Fusion email
|
| 20 |
+
- `LOGIN_PASSWORD`: Your Practice Fusion password
|
| 21 |
+
4. **Deploy** your Space
|
| 22 |
+
|
| 23 |
+
## Environment Variables Required
|
| 24 |
+
|
| 25 |
+
- `LOGIN_EMAIL`: Your Practice Fusion login email
|
| 26 |
+
- `LOGIN_PASSWORD`: Your Practice Fusion login password
|
| 27 |
+
|
| 28 |
+
## How It Works
|
| 29 |
+
|
| 30 |
+
1. **Supervisor Process**: Manages the automation lifecycle
|
| 31 |
+
2. **Puppeteer Browser**: Handles the web automation
|
| 32 |
+
3. **WebSocket Server**: Provides real-time updates to the dashboard
|
| 33 |
+
4. **Scheduler**: Only runs during business hours (8 AM - 6 PM ET)
|
| 34 |
+
|
| 35 |
+
## Monitoring
|
| 36 |
+
|
| 37 |
+
The web interface provides:
|
| 38 |
+
- Real-time connection status
|
| 39 |
+
- Live activity logs
|
| 40 |
+
- Processing statistics (completed, discarded, errors)
|
| 41 |
+
- Automatic reconnection handling
|
| 42 |
+
|
| 43 |
+
## Technical Details
|
| 44 |
+
|
| 45 |
+
- **Node.js** backend with Express
|
| 46 |
+
- **Puppeteer** for browser automation
|
| 47 |
+
- **WebSockets** for real-time communication
|
| 48 |
+
- **Docker** containerization for Hugging Face Spaces
|
| 49 |
+
- **Responsive UI** that works on mobile and desktop
|
| 50 |
+
|
| 51 |
+
## Automation Features
|
| 52 |
+
|
| 53 |
+
- Processes Auto-Receipt items automatically
|
| 54 |
+
- Extracts phone numbers, customer IDs, and names
|
| 55 |
+
- Searches for matching patients
|
| 56 |
+
- Sends receipts to EHR with "Derin Patel" as provider
|
| 57 |
+
- Handles errors gracefully with discarding and logging
|
| 58 |
+
- 5-second refresh cycle when no items are found
|
| 59 |
+
- Visual timer and stop controls
|
| 60 |
+
|
| 61 |
+
## Safety Features
|
| 62 |
+
|
| 63 |
+
- Business hours restriction
|
| 64 |
+
- Stop button and Ctrl+Enter hotkey
|
| 65 |
+
- Automatic error recovery
|
| 66 |
+
- Process isolation and restart capability
|
| 67 |
+
- Comprehensive logging and monitoring
|
verify-deployment.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Deployment verification script for Hugging Face Spaces
|
| 3 |
+
|
| 4 |
+
echo "=== Practice Fusion Automator - Deployment Check ==="
|
| 5 |
+
echo "Date: $(date)"
|
| 6 |
+
echo ""
|
| 7 |
+
|
| 8 |
+
echo "✅ Checking package.json dependencies..."
|
| 9 |
+
grep -A5 "dependencies" package.json
|
| 10 |
+
|
| 11 |
+
echo ""
|
| 12 |
+
echo "✅ Checking Dockerfile..."
|
| 13 |
+
head -10 Dockerfile
|
| 14 |
+
|
| 15 |
+
echo ""
|
| 16 |
+
echo "✅ Checking browser launch configuration..."
|
| 17 |
+
grep -A5 "puppeteer.launch" index.js
|
| 18 |
+
|
| 19 |
+
echo ""
|
| 20 |
+
echo "✅ Checking login flow..."
|
| 21 |
+
grep -A10 "Entering credentials" index.js
|
| 22 |
+
|
| 23 |
+
echo ""
|
| 24 |
+
echo "✅ File sizes:"
|
| 25 |
+
ls -lh *.js *.json Dockerfile 2>/dev/null | grep -v node_modules
|
| 26 |
+
|
| 27 |
+
echo ""
|
| 28 |
+
echo "✅ Key verification points:"
|
| 29 |
+
echo "- Uses 'puppeteer' (not puppeteer-core): $(grep '"puppeteer"' package.json > /dev/null && echo "YES" || echo "NO")"
|
| 30 |
+
echo "- No Chrome path detection: $(grep -q "google-chrome\|executablePath" index.js && echo "NO - PROBLEM" || echo "YES")"
|
| 31 |
+
echo "- Simple navigation: $(grep -q "waitForNavigation.*networkidle2" index.js && echo "YES" || echo "NO")"
|
| 32 |
+
echo "- No timeout handling: $(grep -q "Navigation timeout" index.js && echo "NO - PROBLEM" || echo "YES")"
|
| 33 |
+
|
| 34 |
+
echo ""
|
| 35 |
+
echo "=== Ready for deployment ==="
|
| 36 |
+
echo "1. Push these files to your Hugging Face Space"
|
| 37 |
+
echo "2. Set LOGIN_EMAIL and LOGIN_PASSWORD in Space settings"
|
| 38 |
+
echo "3. The automation will use the simple proven login approach"
|