diff --git a/TODO b/TODO index ed1ee4d..a671672 100644 --- a/TODO +++ b/TODO @@ -12,7 +12,7 @@ * run_ai_on throws log line, for matching even if there are no faces, would be less noisy to not do that (or should say no faces?) - * should allow right-click from View menu (particularly useful on search) to show other files around this one by date (maybe that folder or something?) + * should allow context menu from View thumbs (particularly useful on search) to show other files around this one by date (maybe that folder or something?) * re-think unmatched faces... (the view needs a orig_url and pa_user_state to support viewer for current) @@ -25,7 +25,7 @@ * delete folder - * allow joblog search + * allow joblog search (less needed with logs visible on a given file now) * back button will fail if we do these POSTs: job.py:@app.route("/jobs", methods=["GET", "POST"]) diff --git a/tables.sql b/tables.sql index cac8c0b..892535d 100644 --- a/tables.sql +++ b/tables.sql @@ -1,5 +1,23 @@ alter database PA set timezone to 'Australia/Victoria'; +create sequence PA_USER_ID_SEQ; +create sequence PA_USER_STATE_ID_SEQ; +create sequence FACE_ID_SEQ; +create sequence PATH_ID_SEQ; +create sequence PATH_TYPE_ID_SEQ; +create sequence FILE_ID_SEQ; +create sequence FILE_TYPE_ID_SEQ; +create sequence JOBEXTRA_ID_SEQ; +create sequence JOBLOG_ID_SEQ; +create sequence JOB_ID_SEQ; +create sequence PERSON_ID_SEQ; +create sequence REFIMG_ID_SEQ; +create sequence SETTINGS_ID_SEQ; +create sequence PA_JOB_MANAGER_ID_SEQ; +create sequence PA_JOB_MANAGER_FE_MESSAGE_ID_SEQ; +create sequence FACE_OVERRIDE_TYPE_ID_SEQ; +create sequence FACE_OVERRIDE_ID_SEQ; + -- these are hard-coded at present, not sure I can reflexively find models from API? create table AI_MODEL ( ID integer, NAME varchar(24), DESCRIPTION varchar(80), constraint PK_AI_MODEL primary key(ID) ); insert into AI_MODEL values ( 1, 'hog', 'normal' ); @@ -73,7 +91,7 @@ create table ENTRY_DIR_LINK ( entry_id integer, dir_eid integer, constraint FK_EDL_ENTRY_ID foreign key (ENTRY_ID) references ENTRY(ID), constraint FK_EDL_DIR_EID foreign key (DIR_EID) references DIR(EID) ); -create table PERSON ( ID integer, TAG varchar(48), FIRSTNAME varchar(48), SURNAME varchar(48), +create table PERSON ( ID integer default nextval('PERSON_ID'), TAG varchar(48), FIRSTNAME varchar(48), SURNAME varchar(48), constraint PK_PERSON_ID primary key(ID) ); create table REFIMG ( ID integer, FNAME varchar(128), FACE bytea, ORIG_W integer, ORIG_H integer, FACE_LOCN varchar(32), CREATED_ON float, THUMBNAIL varchar, MODEL_USED integer, @@ -93,8 +111,6 @@ create table FACE_REFIMG_LINK( FACE_ID integer, REFIMG_ID integer, FACE_DISTANCE constraint FK_FRL_FACE_ID foreign key (FACE_ID) references FACE(ID) on delete cascade, constraint FK_FRL_REFIMG_ID foreign key (REFIMG_ID) references REFIMG(ID) ); -create sequence FACE_OVERRIDE_TYPE_ID_SEQ; -create sequence FACE_OVERRIDE_ID_SEQ; create table FACE_OVERRIDE_TYPE ( ID integer, NAME varchar unique, constraint PK_FACE_OVERRIDE_TYPE_ID primary key(ID) ); insert into FACE_OVERRIDE_TYPE values ( (select nextval('FACE_OVERRIDE_TYPE_ID_SEQ')), 'Manual match to existing person' ); insert into FACE_OVERRIDE_TYPE values ( (select nextval('FACE_OVERRIDE_TYPE_ID_SEQ')), 'Not a face' ); @@ -134,22 +150,6 @@ create table PA_JOB_MANAGER_FE_MESSAGE ( ID integer, JOB_ID integer, ALERT varch constraint PA_JOB_MANAGER_FE_ACKS_ID primary key(ID), constraint FK_PA_JOB_MANAGER_FE_MESSAGE_JOB_ID foreign key(JOB_ID) references JOB(ID) ); -create sequence PA_USER_ID_SEQ; -create sequence PA_USER_STATE_ID_SEQ; -create sequence FACE_ID_SEQ; -create sequence PATH_ID_SEQ; -create sequence PATH_TYPE_ID_SEQ; -create sequence FILE_ID_SEQ; -create sequence FILE_TYPE_ID_SEQ; -create sequence JOBEXTRA_ID_SEQ; -create sequence JOBLOG_ID_SEQ; -create sequence JOB_ID_SEQ; -create sequence PERSON_ID_SEQ; -create sequence REFIMG_ID_SEQ; -create sequence SETTINGS_ID_SEQ; -create sequence PA_JOB_MANAGER_ID_SEQ; -create sequence PA_JOB_MANAGER_FE_MESSAGE_ID_SEQ; - -- default data for types of paths insert into PATH_TYPE values ( (select nextval('PATH_TYPE_ID_SEQ')), 'Import' ); insert into PATH_TYPE values ( (select nextval('PATH_TYPE_ID_SEQ')), 'Storage' ); @@ -162,10 +162,10 @@ insert into FILE_TYPE values ( (select nextval('FILE_TYPE_ID_SEQ')), 'Directory' insert into FILE_TYPE values ( (select nextval('FILE_TYPE_ID_SEQ')), 'Unknown' ); -- fake data only for making testing easier -insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'dad', 'Damien', 'De Paoli' ); -insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'mum', 'Mandy', 'De Paoli' ); -insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'cam', 'Cameron', 'De Paoli' ); -insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'mich', 'Michelle', 'De Paoli' ); +--insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'dad', 'Damien', 'De Paoli' ); +--insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'mum', 'Mandy', 'De Paoli' ); +--insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'cam', 'Cameron', 'De Paoli' ); +--insert into PERSON values ( (select nextval('PERSON_ID_SEQ')), 'mich', 'Michelle', 'De Paoli' ); -- DEV(ddp): insert into SETTINGS ( id, base_path, import_path, storage_path, recycle_bin_path, auto_rotate, default_refimg_model, default_scan_model, default_threshold, face_size_limit, scheduled_import_scan, scheduled_storage_scan, scheduled_bin_cleanup, bin_cleanup_file_age, job_archive_age ) values ( (select nextval('SETTINGS_ID_SEQ')), '/home/ddp/src/photoassistant/', 'images_to_process/', 'photos/', '.pa_bin/', true, 1, 1, '0.55', 43, 1, 1, 7, 30, 3 ); -- DEV(cam):