CSNET commited on
Commit
9fa900d
·
verified ·
1 Parent(s): a92c7c5

สร้างเว็บแอป HTML5 ไฟล์เดียวเป็นภาษาไทย (ห้ามแยกไฟล์) เป็น Mobile-first SPA สไตล์ WHOOP แต่สวยกว่า/compact สำหรับ demo นักลงทุน โดยต้องมี Metric catalog จริง 100+ ตัว และฝังเป็น JSON catalog ในไฟล์ พร้อม mock data และกราฟใช้งานจริง

Browse files

ข้อกำหนดหลัก

Deliverable: โค้ด HTML5 ไฟล์เดียว เปิดใน browser ได้ทันที

ใช้ Chart.js ผ่าน CDN

ทำเป็น SPA (สลับ section ไม่ reload)

ทุกเมนู/ทุก metric กดได้จริง

มี mock data สมจริง (90–180 วัน daily + labs 6–12 ครั้ง)

ทุก metric detail ต้องมี: Snapshot + Trend chart + Driver bars + 3/7/30 trend + status badge + projection + AI insight + actions

มี Search + Filter by source + Group by category

Theme: dark premium health-tech, gradient accent

1) ฝัง JSON Catalog ในไฟล์ (ต้องทำ!)

ภายใน <script> ต้องมีตัวแปร:

const METRICS_CATALOG = { "schema_version":"1.2-demo", "data_sources":[ ... ] };


โดย METRICS_CATALOG ต้องมี structure:

{
"schema_version": "1.2-demo",
"data_sources": [
{
"source_id": "smartband",
"name_en": "Smartband / Wearable",
"name_th": "สมาร์ทแบนด์ / อุปกรณ์สวมใส่",
"description": "...",
"primary_metrics": [
{
"metric_id": "heart_rate",
"name_en": "Heart Rate",
"name_th": "อัตราการเต้นหัวใจ",
"description": "...",
"ai_notes": "...",
"type": "number|string|object|array|datetime|date",
"unit": "bpm|percent|kg|mg_dL|...",
"granularity": "timeseries|daily|event|weekly",
"nullable": true,
"category": "wearable_hr|blood_lipid|body_comp_fat|...",
"health_risks_targeted": ["..."],
"expected_benefits": ["..."],
"habit_concern": ["H001","H0xx"...],
"marketplace_hooks": ["magnesium","omega3","sleep_stack"...]
}
]
}
]
}


NOTE: ค่า field อื่นๆ ใส่แบบ demo ได้ แต่ต้องครบทุก key ตาม schema ด้านบน

2) ต้องใส่ “Metric list จริง 120+ metrics” (ห้ามย่อ/ห้ามแทนด้วย placeholder)

ให้สร้าง JSON catalog โดยมีอย่างน้อย 120 metrics แบ่งตาม source ตามนี้

2.1 SMARTBAND / WEARABLE (อย่างน้อย 45 metrics)

ใส่ metrics ต่อไปนี้ “ครบทุกตัว”:

timestamp

heart_rate

resting_heart_rate

max_heart_rate

hrv_rmssd

hrv_sdnn

respiratory_rate

blood_oxygen

skin_temperature

temperature_deviation

Sleep
11. sleep_score
12. sleep_start
13. sleep_end
14. sleep_duration
15. sleep_efficiency
16. sleep_latency
17. wake_after_sleep_onset
18. sleep_stage_awake
19. sleep_stage_light
20. sleep_stage_deep
21. sleep_stage_rem

Recovery/Strain/Stress
22. recovery_score
23. strain_score
24. stress_score
25. stress_load

Activity
26. steps
27. distance
28. active_minutes
29. calories_active
30. calories_total
31. sedentary_time

Workouts
32. workout_sessions
33. workout_type
34. workout_duration
35. workout_avg_hr
36. workout_max_hr
37. workout_calories

HR Zones
38. hr_zone_1_min
39. hr_zone_2_min
40. hr_zone_3_min
41. hr_zone_4_min
42. hr_zone_5_min

Fitness
43. vo2max
44. training_load

เพิ่มอีกอย่างน้อย 3–5 metrics demo (ถ้าต้องการ) เช่น: step_cadence, avg_pace, workout_distance_km

2.2 MYSCALE / BODY COMPOSITION (อย่างน้อย 32 metrics)

ใส่ metrics ต่อไปนี้ “ครบทุกตัว”:

timestamp

weight

body_age

body_water_percent

body_water_mass

protein_mass

protein_percent

fat_mass

body_fat_percent

bone_mass

muscle_mass

muscle_rate

subcutaneous_fat_percent

ideal_body_weight

bmi

visceral_fat_level

obesity_level

skeletal_muscle_mass

bmr

left_leg_fat

right_leg_fat

left_arm_fat

right_arm_fat

left_leg_muscle

right_leg_muscle

left_arm_muscle

right_arm_muscle

trunk_fat

trunk_muscle

body_type

fat_free_body_weight

segmental (object)

2.3 BLOOD / LAB BIOMARKERS (อย่างน้อย 80 metrics)

ให้ใส่ biomarkers “ครบชุด” รายการนี้ (80+) และ set category ให้เหมาะ เช่น blood_lipid, blood_glucose ฯลฯ

Meta

test_date

CBC
2. wbc
3. rbc
4. hb
5. hct
6. mcv
7. mch
8. mchc
9. rdw
10. plt
11. neutrophils_percent
12. lymphocytes_percent
13. monocytes_percent
14. eosinophils_percent
15. basophils_percent

Glucose/Insulin
16. fasting_glucose
17. hba1c
18. fasting_insulin
19. c_peptide
20. homair

Lipids
21. total_cholesterol
22. ldl
23. hdl
24. triglycerides
25. non_hdl_cholesterol
26. apolipoprotein_a1
27. apolipoprotein_b
28. lpa

Liver
29. alt
30. ast
31. ggt
32. alp
33. bilirubin_total
34. albumin
35. protein_total

Kidney
36. creatinine
37. egfr
38. bun
39. uric_acid
40. urine_microalbumin

Electrolytes/Minerals
41. sodium
42. potassium
43. chloride
44. co2_bicarbonate
45. calcium
46. phosphate
47. magnesium
48. zinc
49. selenium

Thyroid
50. tsh
51. ft4
52. ft3
53. tpo_ab
54. tg_ab

Inflammation
55. crp
56. hs_crp
57. esr
58. il6
59. tnf_alpha
60. ferritin

Iron
61. iron_serum
62. tibc
63. transferrin_saturation

Vitamins
64. vitamin_d_25oh
65. vitamin_b12
66. folate
67. vitamin_b1
68. vitamin_c

Cardiac/Muscle
69. ck
70. ck_mb
71. troponin
72. ntprobnp

Hormones
73. cortisol_am
74. testosterone_total
75. estradiol_e2
76. progesterone
77. dhea_s
78. lh
79. fsh
80. shbg
81. prolactin

(รวม 81 แล้ว ให้เพิ่มอีก 5–10 ได้ เช่น: homocysteine, urinalysis ph, etc. ถ้าต้องการ แต่ขั้นต่ำต้อง >=80)

2.4 NUTRITION (อย่างน้อย 10 metrics)

timestamp

meal_type

calories

protein_g

carbs_g

fat_g

fiber_g

sugar_g

meal_score

tdee_target

2.5 MANUAL / JOURNAL (อย่างน้อย 7 metrics)

timestamp

mood

energy

stress_self_report

alcohol_units

caffeine_mg

habit_completed

2.6 SYSTEM / DERIVED (อย่างน้อย 12 metrics)

health_score

health_risk_score

recovery_score_calc

strain_score_calc

sleep_performance_calc

nutrition_score

movement_score

risk_flags

ai_action_plan

ai_alerts

readiness_index (demo)

longevity_score (demo)

3) UI Requirements (must-have)
Tabs

Overview / Metrics / Journal / Marketplace / Profile

Metrics Page

Search input

Filter chips (All, Smartband, MyScale, Blood, Nutrition, Manual, System)

Group by category

Each row: metric name + latest value + badge trend

Metric Detail Page (all metrics)

Snapshot (value, date, status)

Chart (Line + Trend dotted) + Driver bars

3/7/30 trend table

30-day projection + confidence

AI insight text (2–3 lines)

Recommended actions (3 buttons) → modal (habit + marketplace bundle)

4) Trend Engine (ต้องทำจริงใน JS)

Implement functions:

EWMA

linearSlope

stddev

statusFromSlope(metric_id, slope, betterDirection)

projection30

Metric direction map

higher is better: hrv_rmssd, sleep_score, vo2max, hdl, etc.

lower is better: resting_heart_rate, stress_score, triglycerides, hs_crp, visceral_fat_level, etc.

Threshold map (ขั้นต่ำต้องมี)

weight: ±0.15 kg/week

body_fat_percent: ±0.5% / 14d

visceral_fat_level: >12 high risk

hrv_rmssd: drop >20% baseline

sleep_score: <70 for 3 days

stress_score: >65 for 3 days

triglycerides: >150

hba1c: ≥5.7

hs_crp: >3

5) Mock Data Generator (สำคัญมาก)

สร้าง mock data ที่สัมพันธ์กันสมจริง:

calories surplus → weight ↑

sleep low → hrv ↓ stress ↑

zone2 ↑ → visceral fat ↓

protein + strength → muscle ↑

ต้องสร้าง:

daily series (90–180 days): smartband/nutrition/manual/system

myscale: 2–4 ครั้ง/สัปดาห์

labs: 6–12 ครั้ง/ปี

6) Output

ส่งกลับเป็นโค้ด HTML5 ไฟล์เดียว ที่:

เปิดแล้วเห็น dashboard

เข้า metrics แล้วเห็น 120+ metrics จริง

กด metric แล้วเห็น detail + chart + trend + projection + insight + actions

IMPORTANT: ห้ามตอบเป็นคำอธิบาย ให้ตอบเป็นโค้ด HTML5 เต็มๆ เท่านั้น

Files changed (2) hide show
  1. README.md +8 -5
  2. index.html +0 -0
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Vitalmetrics Pro
3
- emoji: 🚀
4
- colorFrom: yellow
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: VitalMetrics Pro 📊
3
+ colorFrom: blue
4
+ colorTo: yellow
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
The diff for this file is too large to render. See raw diff