File size: 1,230 Bytes
c7ee404
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
create table if not exists prediction_logs (
    id bigint generated by default as identity primary key,
    timestamp timestamptz not null,
    event varchar(40) not null default 'prediction',
    input_data jsonb not null,
    prediction integer,
    probability_of_default double precision,
    risk_category varchar(20),
    inference_time_ms double precision,
    error text,
    model_version varchar(120),
    created_at timestamptz not null default now()
);

create index if not exists prediction_logs_timestamp_idx
    on prediction_logs (timestamp);

create index if not exists prediction_logs_event_idx
    on prediction_logs (event);

create table if not exists drift_events (
    id bigint generated by default as identity primary key,
    timestamp timestamptz not null,
    drift_detected boolean,
    feature varchar(100),
    drift_score double precision,
    p_value double precision,
    ks_statistic double precision,
    method varchar(50),
    batch_size integer,
    details jsonb,
    created_at timestamptz not null default now()
);

create index if not exists drift_events_timestamp_idx
    on drift_events (timestamp);

create index if not exists drift_events_feature_idx
    on drift_events (feature);