feat(dashboard, api): integrate BMI thresholds and enhance dashboard with health metrics
This commit is contained in:
27
supabase/migrations/20250821213200_bmi_config.sql
Normal file
27
supabase/migrations/20250821213200_bmi_config.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
create table medreport.bmi_thresholds (
|
||||
id bigserial primary key,
|
||||
age_min int not null,
|
||||
age_max int,
|
||||
underweight_max numeric not null,
|
||||
normal_min numeric not null,
|
||||
normal_max numeric not null,
|
||||
overweight_min numeric not null,
|
||||
strong_min numeric not null,
|
||||
obesity_min numeric not null
|
||||
);
|
||||
|
||||
insert into medreport.bmi_thresholds
|
||||
(age_min, age_max, underweight_max, normal_min, normal_max, overweight_min, strong_min, obesity_min)
|
||||
values
|
||||
(19, 24, 19, 19, 24, 24, 30, 35),
|
||||
(25, 34, 20, 20, 25, 25, 30, 35),
|
||||
(35, 44, 21, 21, 26, 26, 30, 35),
|
||||
(45, 54, 22, 22, 27, 27, 30, 35),
|
||||
(55, 64, 23, 23, 28, 28, 30, 35),
|
||||
(65, null, 24, 24, 29, 29, 30, 35);
|
||||
|
||||
alter table medreport.bmi_thresholds enable row level security;
|
||||
|
||||
grant select, insert, update, delete on table medreport.bmi_thresholds to authenticated;
|
||||
|
||||
create policy "bmi_thresholds_select" on "medreport"."bmi_thresholds" for select to service_role using (true);
|
||||
Reference in New Issue
Block a user