@@ -25,47 +25,59 @@ Make sure the database is running and accessible. Schema is given below
2525
2626``` sql
2727
28- CREATE TABLE public .inspections (
29- id CHARACTER VARYING NOT NULL ,
30- transformer_id CHARACTER VARYING NOT NULL ,
31- inspectionnumber TEXT NOT NULL UNIQUE,
32- inspecteddate TEXT ,
33- maintainancedate TEXT ,
34- branch CHARACTER VARYING,
35- status CHARACTER VARYING,
36- imageurl TEXT ,
37- weather CHARACTER VARYING,
38- lastanalysisweather TEXT ,
39- uploadedby TEXT ,
40- imageuploadedby TEXT ,
41- imageuploadedat TIMESTAMP WITH TIME ZONE ,
42- favourite BOOLEAN NOT NULL DEFAULT FALSE,
43- boundingboxes TEXT ,
44- faulttypes TEXT ,
45- CONSTRAINT inspections_pkey PRIMARY KEY (id),
46- CONSTRAINT fk_inspections_transformer FOREIGN KEY (transformer_id) REFERENCES public .transformers (id)
47- );
48-
49- CREATE TABLE public .transformers (
50- id CHARACTER VARYING NOT NULL ,
51- region CHARACTER VARYING,
52- transformernumber TEXT NOT NULL UNIQUE,
53- polenumber TEXT ,
54- type CHARACTER VARYING,
55- location CHARACTER VARYING,
56- sunnyimage TEXT ,
57- cloudyimage TEXT ,
58- windyimage TEXT ,
59- uploadedby TEXT ,
60- sunnyimageuploadedby TEXT ,
61- cloudyimageuploadedby TEXT ,
62- windyimageuploadedby TEXT ,
63- sunnyimageuploadedat TIMESTAMP WITH TIME ZONE ,
64- cloudyimageuploadedat TIMESTAMP WITH TIME ZONE ,
65- windyimageuploadedat TIMESTAMP WITH TIME ZONE ,
66- favourite BOOLEAN NOT NULL DEFAULT FALSE,
67- CONSTRAINT transformers_pkey PRIMARY KEY (id)
68- );
28+ create table public .inspections (
29+ id text not null ,
30+ transformer_id text not null ,
31+ inspectionnumber text not null ,
32+ inspecteddate text null ,
33+ maintainancedate text null ,
34+ branch text null ,
35+ status text null ,
36+ imageurl text null ,
37+ weather text null ,
38+ lastanalysisweather text null ,
39+ uploadedby text null ,
40+ imageuploadedby text null ,
41+ imageuploadedat timestamp with time zone null ,
42+ favourite boolean not null default false,
43+ boundingboxes text null ,
44+ faulttypes text null ,
45+ faulttypehistory text null ,
46+ boundingboxhistory text null ,
47+ annotatedby text null ,
48+ annotatedbyhistory text null ,
49+ severity text null ,
50+ timestamphistory text null ,
51+ timestamp timestamp with time zone null ,
52+ severityhistory text null ,
53+ constraint inspections_pkey primary key (id),
54+ constraint inspections_inspectionnumber_key unique (inspectionnumber),
55+ constraint fk_inspections_transformer foreign KEY (transformer_id) references transformers (id) on delete CASCADE
56+ )
57+
58+ create index IF not exists idx_inspections_transformer_id on public .inspections using btree (transformer_id) TABLESPACE pg_default;
59+
60+ create table public .transformers (
61+ id text not null ,
62+ region text null ,
63+ transformernumber text not null ,
64+ polenumber text null ,
65+ type text null ,
66+ location text null ,
67+ sunnyimage text null ,
68+ cloudyimage text null ,
69+ windyimage text null ,
70+ uploadedby text null ,
71+ sunnyimageuploadedby text null ,
72+ cloudyimageuploadedby text null ,
73+ windyimageuploadedby text null ,
74+ sunnyimageuploadedat timestamp with time zone null ,
75+ cloudyimageuploadedat timestamp with time zone null ,
76+ windyimageuploadedat timestamp with time zone null ,
77+ favourite boolean not null default false,
78+ constraint transformers_pkey primary key (id),
79+ constraint transformers_transformernumber_key unique (transformernumber)
80+ )
6981
7082CREATE TABLE public .users (
7183 id CHARACTER VARYING NOT NULL ,
@@ -76,6 +88,30 @@ CREATE TABLE public.users (
7688 CONSTRAINT users_pkey PRIMARY KEY (id)
7789);
7890
91+ CREATE TABLE public .ai_model_parameters (
92+ param_key text not null ,
93+ param_value double precision not null ,
94+ updated_at timestamp with time zone not null default now(),
95+ constraint ai_model_parameters_pkey primary key (param_key)
96+ ) TABLESPACE pg_default;
97+
98+ CREATE TABLE public .ai_tuning_feedback (
99+ id uuid not null default gen_random_uuid (),
100+ inspection_id text not null ,
101+ ai_box_count integer not null ,
102+ user_box_count integer not null ,
103+ box_diff integer not null ,
104+ created_at timestamp with time zone not null default now(),
105+ previous_snapshot text null ,
106+ final_snapshot text null ,
107+ previous_faults text null ,
108+ final_faults text null ,
109+ previous_annotated text null ,
110+ final_annotated text null ,
111+ notes text null ,
112+ constraint ai_tuning_feedback_pkey primary key (id)
113+ ) TABLESPACE pg_default;
114+
79115```
80116
81117### Recommended method: Use Docker for the backend
@@ -185,7 +221,8 @@ pnpm run dev
185221- H2 console won’t connect: verify JDBC URL is ` jdbc:h2:file:./db/transformerdb ` , user ` sa ` , and empty password.
186222- DB file not created: ensure the backend is running and you’ve performed at least one API action (the file appears on first write).
187223
188- ## Notes
224+ ## For Improvements
189225
190- - Package manager: pnpm-first. Running ` pnpm install ` in the project root installs all dependencies. No extra global tools are required beyond pnpm and Node.
191- - Frontend reads ` NEXT_PUBLIC_BACKEND_URL ` (default ` http://localhost:8080 ` ).
226+ - Feel free to open issues or submit PRs for any bugs, improvements, or new features.
227+ - For your own use, you are free to customize the project as needed.
228+ - If you find the project useful, consider starring the repo!
0 commit comments