# DCS Credit Application Chrome Extension

This Chrome extension extracts data from DCS credit application web pages and sends it to the Python backend for processing.

## Installation & Testing

### 1. Load Extension in Chrome

1. Open Chrome and go to `chrome://extensions/`
2. Enable "Developer mode" (toggle in top right)
3. Click "Load unpacked"
4. Select this `extension` folder
5. The extension should now appear in your extensions list

### 2. Test the Extension

1. **Test on any webpage first:**
   - Click the extension icon in the toolbar
   - You should see the popup with status indicators

2. **Test DCS page detection:**
   - Navigate to a page with credit application content
   - The extension should detect relevant form fields
   - Status indicator should show "DCS page detected" if forms are found

3. **Test data extraction:**
   - Click "Extract Data from Page"
   - Check browser console (F12) for extracted data logs
   - Field counter should show number of fields found

### 3. Current Status

✅ **Working:**
- Extension loads in Chrome
- Popup interface displays correctly
- Content script runs on all pages
- Basic form field detection
- Data extraction from DOM elements

🔄 **In Progress:**
- Python backend API server
- DCS-specific field mapping refinement
- Server communication bridge

⏳ **Next Steps:**
- Convert Python file watcher to HTTP API
- Improve DCS page detection accuracy
- Add visual indicators for extracted fields

## File Structure

```
extension/
├── manifest.json          # Extension configuration
├── popup.html            # Extension popup interface
├── popup.js              # Popup functionality
├── content.js            # Page content extraction
├── background.js         # Background service worker
└── README.md            # This file
```

## Development Notes

- **Content Script:** Runs on all pages, detects DCS forms, extracts data
- **Popup:** User interface for controlling extraction and processing
- **Background:** Handles storage, notifications, and server communication
- **Manifest V3:** Uses modern Chrome extension architecture

## Testing Tips

1. **View Console Logs:** Open Developer Tools (F12) to see extraction logs
2. **Check Storage:** Go to `chrome://extensions/` → Extension Details → "Storage" to see stored data
3. **Reload Extension:** Use the reload button on the extensions page after code changes
4. **Test Different Pages:** Try various form pages to test detection accuracy

## Next Phase

The next step is converting the Python backend from a file watcher to an HTTP API server that can receive the extracted data from this extension.