//! Cotton Health's screens as data: the phone module//! `cotton_ffi::phone::health_app` reads one person's rows and these modules//! decide what each screen says, in the shapes [`shapes`] publishes//! (a `shapes.md` kept beside the work, in prose)./// The wire shapes of every `health.*` screen method.pubmod shapes;/// Labs, a parameter's history, Reports, a report, the people switcher.pubmod labs;/// Body: the owner's Apple Health by section, and anyone's report vitals.pubmod body;/// Settings.pubmod settings;#[cfg(test)]mod tests;usecrate::keys::app::look::Look;usecrate::rules::shell_lines::LineSet;/// The look, as shipped (`kits/health/look.json`).pubconst LOOK: &str = include_str!("../../../kits/health/look.json");pubfn look() -> &'staticLook {static SHIPPED: std::sync::OnceLock<Look> = std::sync::OnceLock::new(); SHIPPED.get_or_init(|| Look::parse(LOOK).expect("kits/health/look.json reads"))}/// The health set, read once per process.pubfn lines() -> &'staticLineSet {static LINES: std::sync::OnceLock<LineSet> = std::sync::OnceLock::new(); LINES.get_or_init(|| LineSet::shipped("health").expect("the kit ships the health line set"))}/// One line; a missing one is a kit bug the line test catches, said as its key.pubfn say(line: &str) -> String { lines().say(line, &[]).unwrap_or_else(|| line.to_string())}pubfn sayf(line: &str, fills: &[(&str, &str)]) -> String { lines().say(line, fills).unwrap_or_else(|| line.to_string())}/// `2024-03-12` as `12 Mar 2024`.pubfn day_said(day: &str) -> String { chrono::NaiveDate::parse_from_str(day, "%Y-%m-%d").map(|d| d.format("%-d %b %Y").to_string()).unwrap_or_else(|_| day.to_string())}/// A number as few digits say it: `212`, `5.8`, `0.05`, three decimals at most.pubfn number_said(value: f64) -> String {let text = format!("{value:.3}");let text = text.trim_end_matches('0').trim_end_matches('.');if text == "-0" { "0".into() } else { text.to_string() }}