feat(dashboard, api): integrate BMI thresholds and enhance dashboard with health metrics
This commit is contained in:
@@ -242,6 +242,23 @@ class AccountsApi {
|
||||
|
||||
return (count ?? 0) > 0;
|
||||
}
|
||||
|
||||
async fetchBmiThresholds() {
|
||||
// Fetch BMI
|
||||
const { data, error } = await this.client
|
||||
.schema('medreport')
|
||||
.from('bmi_thresholds')
|
||||
.select(
|
||||
'age_min,age_max,underweight_max,normal_min,normal_max,overweight_min,strong_min,obesity_min',
|
||||
)
|
||||
.order('age_min', { ascending: true });
|
||||
|
||||
if (error) {
|
||||
console.error('Error fetching BMI thresholds:', error);
|
||||
throw error;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
export function createAccountsApi(client: SupabaseClient<Database>) {
|
||||
|
||||
@@ -14,4 +14,4 @@ export enum ApplicationRoleEnum {
|
||||
User = 'user',
|
||||
Doctor = 'doctor',
|
||||
SuperAdmin = 'super_admin',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,6 +690,42 @@ export type Database = {
|
||||
},
|
||||
]
|
||||
}
|
||||
bmi_thresholds: {
|
||||
Row: {
|
||||
age_max: number | null
|
||||
age_min: number
|
||||
id: number
|
||||
normal_max: number
|
||||
normal_min: number
|
||||
obesity_min: number
|
||||
overweight_min: number
|
||||
strong_min: number
|
||||
underweight_max: number
|
||||
}
|
||||
Insert: {
|
||||
age_max?: number | null
|
||||
age_min: number
|
||||
id?: number
|
||||
normal_max: number
|
||||
normal_min: number
|
||||
obesity_min: number
|
||||
overweight_min: number
|
||||
strong_min: number
|
||||
underweight_max: number
|
||||
}
|
||||
Update: {
|
||||
age_max?: number | null
|
||||
age_min?: number
|
||||
id?: number
|
||||
normal_max?: number
|
||||
normal_min?: number
|
||||
obesity_min?: number
|
||||
overweight_min?: number
|
||||
strong_min?: number
|
||||
underweight_max?: number
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
codes: {
|
||||
Row: {
|
||||
analysis_element_id: number | null
|
||||
@@ -1807,6 +1843,7 @@ export type Database = {
|
||||
primary_owner_user_id: string
|
||||
subscription_status: Database["medreport"]["Enums"]["subscription_status"]
|
||||
permissions: Database["medreport"]["Enums"]["app_permissions"][]
|
||||
account_role: string
|
||||
application_role: Database["medreport"]["Enums"]["application_role"]
|
||||
}[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user