Prepare legacy migration for the portal cutover
- detection from legacy category only for scores >= 0.5, without ''/none - category_label + view detection_labeled unify ICU and legacy labels - schema/003 + migrate_legacy --dedupe removes Gundi twins of legacy images (same imei, same size, <= 10 min), archived in image_superseded - migrate_legacy --plan: read-only preview of the migration - Gundi S3 prefix icu/gundi-test/ -> icu/gundi/ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
-- Split der Legacy-Daten ins Fachmodell: jede remote_cam.metadata-Zeile ergibt
|
||||
-- ein image und ein camera_status; remote_cam.category wird zu detection.
|
||||
-- ein image und ein camera_status; remote_cam.category (Score >= 0.5) wird zu detection.
|
||||
--
|
||||
-- Erwartet die Temp-Tabelle _mig_batch(metadata_uuid text), die tools/migrate_legacy.py
|
||||
-- je Batch fuellt. Wiederholbar: bereits migrierte Zeilen werden uebersprungen.
|
||||
@@ -82,12 +82,16 @@ WHERE m.imei IS NOT NULL AND m.servertime IS NOT NULL
|
||||
ON CONFLICT (source_ref) WHERE source = 'entrance' DO NOTHING;
|
||||
|
||||
-- step: detection
|
||||
-- remote_cam.category ist ein Score-Vektor ueber alle Klassen, detection haelt nur Erkanntes:
|
||||
-- uebernommen werden Klassen ab Score 0.5, ohne '' und 'none' (leeres Bild = keine Detection).
|
||||
INSERT INTO remote_cam.detection (image_uuid, category, confidence, model_version, source)
|
||||
SELECT i.image_uuid, c.category, c.score, c.version, 'entrance'
|
||||
FROM _mig_batch b
|
||||
JOIN remote_cam.category c ON c.image_uuid = b.metadata_uuid
|
||||
JOIN remote_cam.image i ON i.image_uuid = b.metadata_uuid::uuid
|
||||
WHERE c.category IS NOT NULL
|
||||
AND c.category NOT IN ('', 'none')
|
||||
AND c.score >= 0.5
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM remote_cam.detection d
|
||||
WHERE d.image_uuid = i.image_uuid AND d.source = 'entrance'
|
||||
|
||||
Reference in New Issue
Block a user