front-end-fix
This commit is contained in:
@@ -384,7 +384,7 @@ The scraper creates three tables:
|
|||||||
|
|
||||||
**images**
|
**images**
|
||||||
- `id` (PRIMARY KEY)
|
- `id` (PRIMARY KEY)
|
||||||
- `lot_id`, `url`, `file_path`, `labels` (detected objects)
|
- `lot_id`, `url`, `local_path`, `labels` (detected objects)
|
||||||
|
|
||||||
## Notification Examples
|
## Notification Examples
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class DatabaseService {
|
|||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
lot_id INTEGER,
|
lot_id INTEGER,
|
||||||
url TEXT,
|
url TEXT,
|
||||||
file_path TEXT,
|
local_path TEXT,
|
||||||
labels TEXT,
|
labels TEXT,
|
||||||
processed_at INTEGER,
|
processed_at INTEGER,
|
||||||
FOREIGN KEY (lot_id) REFERENCES lots(lot_id)
|
FOREIGN KEY (lot_id) REFERENCES lots(lot_id)
|
||||||
@@ -433,7 +433,7 @@ public class DatabaseService {
|
|||||||
* Inserts a new image record with object detection labels
|
* Inserts a new image record with object detection labels
|
||||||
*/
|
*/
|
||||||
synchronized void insertImage(long lotId, String url, String filePath, List<String> labels) throws SQLException {
|
synchronized void insertImage(long lotId, String url, String filePath, List<String> labels) throws SQLException {
|
||||||
var sql = "INSERT INTO images (lot_id, url, file_path, labels, processed_at) VALUES (?, ?, ?, ?, ?)";
|
var sql = "INSERT INTO images (lot_id, url, local_path, labels, processed_at) VALUES (?, ?, ?, ?, ?)";
|
||||||
try (var conn = DriverManager.getConnection(this.url); var ps = conn.prepareStatement(sql)) {
|
try (var conn = DriverManager.getConnection(this.url); var ps = conn.prepareStatement(sql)) {
|
||||||
ps.setLong(1, lotId);
|
ps.setLong(1, lotId);
|
||||||
ps.setString(2, url);
|
ps.setString(2, url);
|
||||||
@@ -449,7 +449,7 @@ public class DatabaseService {
|
|||||||
*/
|
*/
|
||||||
synchronized List<ImageRecord> getImagesForLot(long lotId) throws SQLException {
|
synchronized List<ImageRecord> getImagesForLot(long lotId) throws SQLException {
|
||||||
List<ImageRecord> images = new ArrayList<>();
|
List<ImageRecord> images = new ArrayList<>();
|
||||||
var sql = "SELECT id, lot_id, url, file_path, labels FROM images WHERE lot_id = ?";
|
var sql = "SELECT id, lot_id, url, local_path, labels FROM images WHERE lot_id = ?";
|
||||||
|
|
||||||
try (var conn = DriverManager.getConnection(url); var ps = conn.prepareStatement(sql)) {
|
try (var conn = DriverManager.getConnection(url); var ps = conn.prepareStatement(sql)) {
|
||||||
ps.setLong(1, lotId);
|
ps.setLong(1, lotId);
|
||||||
@@ -459,7 +459,7 @@ public class DatabaseService {
|
|||||||
rs.getInt("id"),
|
rs.getInt("id"),
|
||||||
rs.getLong("lot_id"),
|
rs.getLong("lot_id"),
|
||||||
rs.getString("url"),
|
rs.getString("url"),
|
||||||
rs.getString("file_path"),
|
rs.getString("local_path"),
|
||||||
rs.getString("labels")
|
rs.getString("labels")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ CREATE TABLE images (
|
|||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
lot_id INTEGER,
|
lot_id INTEGER,
|
||||||
url TEXT,
|
url TEXT,
|
||||||
file_path TEXT,
|
local_path TEXT,
|
||||||
labels TEXT, -- Object detection results
|
labels TEXT, -- Object detection results
|
||||||
processed_at INTEGER,
|
processed_at INTEGER,
|
||||||
FOREIGN KEY (lot_id) REFERENCES lots(lot_id)
|
FOREIGN KEY (lot_id) REFERENCES lots(lot_id)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ This document describes how **Troostwijk Monitor** (this Java project) integrate
|
|||||||
The scraper and monitor use **slightly different schemas** that need to be reconciled:
|
The scraper and monitor use **slightly different schemas** that need to be reconciled:
|
||||||
|
|
||||||
| Scraper Table | Monitor Table | Integration Notes |
|
| Scraper Table | Monitor Table | Integration Notes |
|
||||||
|---------------|---------------|-------------------|
|
|---------------|---------------|-----------------------------------------------|
|
||||||
| `auctions` | `auctions` | ✅ **Compatible** - same structure |
|
| `auctions` | `auctions` | ✅ **Compatible** - same structure |
|
||||||
| `lots` | `lots` | ⚠️ **Needs mapping** - field name differences |
|
| `lots` | `lots` | ⚠️ **Needs mapping** - field name differences |
|
||||||
| `images` | `images` | ⚠️ **Partial overlap** - different purposes |
|
| `images` | `images` | ⚠️ **Partial overlap** - different purposes |
|
||||||
@@ -59,7 +59,7 @@ The scraper and monitor use **slightly different schemas** that need to be recon
|
|||||||
### Field Mapping: `auctions` Table
|
### Field Mapping: `auctions` Table
|
||||||
|
|
||||||
| Scraper Field | Monitor Field | Notes |
|
| Scraper Field | Monitor Field | Notes |
|
||||||
|---------------|---------------|-------|
|
|--------------------------|-------------------------------|---------------------------------------------------------------------|
|
||||||
| `auction_id` (TEXT) | `auction_id` (INTEGER) | ⚠️ **TYPE MISMATCH** - Scraper uses "A7-39813", Monitor expects INT |
|
| `auction_id` (TEXT) | `auction_id` (INTEGER) | ⚠️ **TYPE MISMATCH** - Scraper uses "A7-39813", Monitor expects INT |
|
||||||
| `url` | `url` | ✅ Compatible |
|
| `url` | `url` | ✅ Compatible |
|
||||||
| `title` | `title` | ✅ Compatible |
|
| `title` | `title` | ✅ Compatible |
|
||||||
@@ -71,7 +71,7 @@ The scraper and monitor use **slightly different schemas** that need to be recon
|
|||||||
### Field Mapping: `lots` Table
|
### Field Mapping: `lots` Table
|
||||||
|
|
||||||
| Scraper Field | Monitor Field | Notes |
|
| Scraper Field | Monitor Field | Notes |
|
||||||
|---------------|---------------|-------|
|
|----------------------|----------------------|--------------------------------------------------|
|
||||||
| `lot_id` (TEXT) | `lot_id` (INTEGER) | ⚠️ **TYPE MISMATCH** - "A1-28505-5" vs INT |
|
| `lot_id` (TEXT) | `lot_id` (INTEGER) | ⚠️ **TYPE MISMATCH** - "A1-28505-5" vs INT |
|
||||||
| `auction_id` | `sale_id` | ⚠️ Different name |
|
| `auction_id` | `sale_id` | ⚠️ Different name |
|
||||||
| `url` | `url` | ✅ Compatible |
|
| `url` | `url` | ✅ Compatible |
|
||||||
@@ -93,11 +93,11 @@ The scraper and monitor use **slightly different schemas** that need to be recon
|
|||||||
### Field Mapping: `images` Table
|
### Field Mapping: `images` Table
|
||||||
|
|
||||||
| Scraper Field | Monitor Field | Notes |
|
| Scraper Field | Monitor Field | Notes |
|
||||||
|---------------|---------------|-------|
|
|------------------------|--------------------------|----------------------------------------|
|
||||||
| `id` | `id` | ✅ Compatible |
|
| `id` | `id` | ✅ Compatible |
|
||||||
| `lot_id` | `lot_id` | ⚠️ Type difference (TEXT vs INTEGER) |
|
| `lot_id` | `lot_id` | ⚠️ Type difference (TEXT vs INTEGER) |
|
||||||
| `url` | `url` | ✅ Compatible |
|
| `url` | `url` | ✅ Compatible |
|
||||||
| `local_path` | `file_path` | ⚠️ Different name |
|
| `local_path` | `Local_path` | ⚠️ Different name |
|
||||||
| `downloaded` (INTEGER) | N/A | ℹ️ Monitor uses `processed_at` instead |
|
| `downloaded` (INTEGER) | N/A | ℹ️ Monitor uses `processed_at` instead |
|
||||||
| N/A | `labels` (TEXT) | ℹ️ Monitor adds detected objects |
|
| N/A | `labels` (TEXT) | ℹ️ Monitor adds detected objects |
|
||||||
| N/A | `processed_at` (INTEGER) | ℹ️ Monitor tracking field |
|
| N/A | `processed_at` (INTEGER) | ℹ️ Monitor tracking field |
|
||||||
@@ -252,8 +252,7 @@ CREATE TABLE IF NOT EXISTS images (
|
|||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
lot_id TEXT, -- FK: "A1-28505-5"
|
lot_id TEXT, -- FK: "A1-28505-5"
|
||||||
url TEXT, -- Image URL from website
|
url TEXT, -- Image URL from website
|
||||||
file_path TEXT, -- Local path after download
|
local_path TEXT, -- Local path after download
|
||||||
local_path TEXT, -- Alias for compatibility
|
|
||||||
labels TEXT, -- Detected objects (comma-separated)
|
labels TEXT, -- Detected objects (comma-separated)
|
||||||
downloaded INTEGER DEFAULT 0, -- 0=pending, 1=downloaded
|
downloaded INTEGER DEFAULT 0, -- 0=pending, 1=downloaded
|
||||||
processed_at INTEGER, -- Unix timestamp when processed
|
processed_at INTEGER, -- Unix timestamp when processed
|
||||||
@@ -469,7 +468,7 @@ sqlite3 /mnt/okcomputer/output/cache.db "SELECT COUNT(*) FROM lots"
|
|||||||
**Check**:
|
**Check**:
|
||||||
1. Scraper writes image URLs to `images` table
|
1. Scraper writes image URLs to `images` table
|
||||||
2. Monitor reads from `images` table with `downloaded=0`
|
2. Monitor reads from `images` table with `downloaded=0`
|
||||||
3. Field name mapping: `local_path` vs `file_path`
|
3. Field name mapping: `local_path` vs `local_path`
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user