Cotton code
468 lines · 14.4 KB · JSONRaw
{  "format_version": 1,  "id": "health_day",  "name": "Health day",  "plural": "Health days",  "picture": null,  "builtin": false,  "visibility": "owner",  "engine": null,  "columns": [    {      "key": "key",      "name": "Key",      "type": "text",      "required": true,      "hidden": true    },    {      "key": "metric",      "name": "Measure",      "type": "choice",      "choices": [        "steps",        "distance",        "active_energy",        "flights",        "stand_hours",        "resting_heart_rate",        "heart_rate_variability",        "vo2_max",        "sleep_asleep",        "sleep_in_bed",        "sleep_core",        "sleep_deep",        "sleep_rem",        "sleep_awake",        "weight",        "body_fat",        "blood_pressure_systolic",        "blood_pressure_diastolic",        "glucose",        "mindful_minutes",        "menstrual_flow",        "basal_energy",        "exercise_minutes",        "stand_minutes",        "move_minutes",        "distance_cycling",        "distance_swimming",        "distance_wheelchair",        "distance_snow_sports",        "push_count",        "swimming_strokes",        "time_in_daylight",        "falls",        "heart_rate",        "walking_heart_rate",        "oxygen_saturation",        "respiratory_rate",        "wrist_temperature",        "breathing_disturbances",        "walking_speed",        "walking_step_length",        "walking_asymmetry",        "walking_double_support",        "walking_steadiness",        "stair_ascent_speed",        "stair_descent_speed",        "six_minute_walk",        "running_speed",        "running_power",        "running_stride_length",        "running_vertical_oscillation",        "running_ground_contact",        "cycling_speed",        "cycling_power",        "cycling_cadence",        "environmental_audio",        "headphone_audio",        "body_mass_index",        "lean_body_mass",        "height",        "waist",        "uv_exposure",        "dietary_energy",        "protein",        "carbohydrates",        "fat",        "saturated_fat",        "sugar",        "fibre",        "sodium",        "dietary_cholesterol",        "potassium",        "calcium",        "iron",        "vitamin_c",        "vitamin_d",        "caffeine",        "water",        "toothbrushing",        "handwashing",        "high_heart_rate_events",        "low_heart_rate_events",        "irregular_rhythm_events",        "low_cardio_fitness_events",        "walking_steadiness_events",        "loud_environment_events",        "loud_headphone_events",        "sleep_apnea_events",        "sexual_activity",        "intermenstrual_bleeding",        "distance_rowing",        "distance_paddling",        "distance_skating",        "distance_cross_country_skiing",        "physical_effort",        "heart_rate_recovery",        "afib_burden",        "basal_body_temperature",        "peripheral_perfusion",        "blood_alcohol",        "forced_vital_capacity",        "forced_expiratory_volume",        "peak_expiratory_flow",        "inhaler_uses",        "insulin",        "cycling_ftp",        "environmental_sound_reduction",        "fat_monounsaturated",        "fat_polyunsaturated",        "magnesium",        "phosphorus",        "zinc",        "copper",        "manganese",        "chloride",        "selenium",        "iodine",        "chromium",        "molybdenum",        "vitamin_a",        "vitamin_b6",        "vitamin_b12",        "vitamin_e",        "vitamin_k",        "thiamin",        "riboflavin",        "niacin",        "folate",        "biotin",        "pantothenic_acid",        "alcoholic_drinks",        "irregular_cycle_events",        "infrequent_cycle_events",        "prolonged_period_events",        "persistent_bleeding_events"      ],      "labels": {        "steps": "Steps",        "distance": "Walking and running",        "active_energy": "Active energy",        "flights": "Flights climbed",        "stand_hours": "Stand hours",        "resting_heart_rate": "Resting heart rate",        "heart_rate_variability": "Heart rate variability",        "vo2_max": "Cardio fitness",        "sleep_asleep": "Asleep",        "sleep_in_bed": "In bed",        "sleep_core": "Core sleep",        "sleep_deep": "Deep sleep",        "sleep_rem": "REM sleep",        "sleep_awake": "Awake in the night",        "weight": "Weight",        "body_fat": "Body fat",        "blood_pressure_systolic": "Blood pressure, upper",        "blood_pressure_diastolic": "Blood pressure, lower",        "glucose": "Blood glucose",        "mindful_minutes": "Mindful minutes",        "menstrual_flow": "Period",        "basal_energy": "Resting energy",        "exercise_minutes": "Exercise minutes",        "stand_minutes": "Stand minutes",        "move_minutes": "Move minutes",        "distance_cycling": "Cycling distance",        "distance_swimming": "Swimming distance",        "distance_wheelchair": "Wheelchair distance",        "distance_snow_sports": "Downhill snow sports distance",        "push_count": "Wheelchair pushes",        "swimming_strokes": "Swimming strokes",        "time_in_daylight": "Time in daylight",        "falls": "Falls",        "heart_rate": "Heart rate",        "walking_heart_rate": "Walking heart rate",        "oxygen_saturation": "Blood oxygen",        "respiratory_rate": "Respiratory rate",        "wrist_temperature": "Sleeping wrist temperature",        "breathing_disturbances": "Breathing disturbances",        "walking_speed": "Walking speed",        "walking_step_length": "Walking step length",        "walking_asymmetry": "Walking asymmetry",        "walking_double_support": "Double support time",        "walking_steadiness": "Walking steadiness",        "stair_ascent_speed": "Stair speed, up",        "stair_descent_speed": "Stair speed, down",        "six_minute_walk": "Six-minute walk",        "running_speed": "Running speed",        "running_power": "Running power",        "running_stride_length": "Running stride length",        "running_vertical_oscillation": "Vertical oscillation",        "running_ground_contact": "Ground contact time",        "cycling_speed": "Cycling speed",        "cycling_power": "Cycling power",        "cycling_cadence": "Cycling cadence",        "environmental_audio": "Environmental sound",        "headphone_audio": "Headphone audio",        "body_mass_index": "Body mass index",        "lean_body_mass": "Lean body mass",        "height": "Height",        "waist": "Waist",        "uv_exposure": "UV index",        "dietary_energy": "Dietary energy",        "protein": "Protein",        "carbohydrates": "Carbohydrates",        "fat": "Total fat",        "saturated_fat": "Saturated fat",        "sugar": "Sugar",        "fibre": "Fibre",        "sodium": "Sodium",        "dietary_cholesterol": "Dietary cholesterol",        "potassium": "Potassium",        "calcium": "Calcium",        "iron": "Iron",        "vitamin_c": "Vitamin C",        "vitamin_d": "Vitamin D",        "caffeine": "Caffeine",        "water": "Water",        "toothbrushing": "Toothbrushing",        "handwashing": "Handwashing",        "high_heart_rate_events": "High heart rate notifications",        "low_heart_rate_events": "Low heart rate notifications",        "irregular_rhythm_events": "Irregular rhythm notifications",        "low_cardio_fitness_events": "Low cardio fitness notifications",        "walking_steadiness_events": "Walking steadiness notifications",        "loud_environment_events": "Loud environment notifications",        "loud_headphone_events": "Loud headphone notifications",        "sleep_apnea_events": "Breathing disturbance notifications",        "sexual_activity": "Sexual activity",        "intermenstrual_bleeding": "Spotting",        "distance_rowing": "Rowing distance",        "distance_paddling": "Paddling distance",        "distance_skating": "Skating distance",        "distance_cross_country_skiing": "Cross-country skiing distance",        "physical_effort": "Physical effort",        "heart_rate_recovery": "Heart rate recovery",        "afib_burden": "AFib history",        "basal_body_temperature": "Basal body temperature",        "peripheral_perfusion": "Peripheral perfusion",        "blood_alcohol": "Blood alcohol",        "forced_vital_capacity": "Forced vital capacity",        "forced_expiratory_volume": "Forced expiratory volume, 1 s",        "peak_expiratory_flow": "Peak expiratory flow",        "inhaler_uses": "Inhaler use",        "insulin": "Insulin delivery",        "cycling_ftp": "Cycling functional threshold power",        "environmental_sound_reduction": "Environmental sound reduction",        "fat_monounsaturated": "Monounsaturated fat",        "fat_polyunsaturated": "Polyunsaturated fat",        "magnesium": "Magnesium",        "phosphorus": "Phosphorus",        "zinc": "Zinc",        "copper": "Copper",        "manganese": "Manganese",        "chloride": "Chloride",        "selenium": "Selenium",        "iodine": "Iodine",        "chromium": "Chromium",        "molybdenum": "Molybdenum",        "vitamin_a": "Vitamin A",        "vitamin_b6": "Vitamin B6",        "vitamin_b12": "Vitamin B12",        "vitamin_e": "Vitamin E",        "vitamin_k": "Vitamin K",        "thiamin": "Thiamin",        "riboflavin": "Riboflavin",        "niacin": "Niacin",        "folate": "Folate",        "biotin": "Biotin",        "pantothenic_acid": "Pantothenic acid",        "alcoholic_drinks": "Alcoholic drinks",        "irregular_cycle_events": "Irregular cycle notifications",        "infrequent_cycle_events": "Infrequent period notifications",        "prolonged_period_events": "Prolonged period notifications",        "persistent_bleeding_events": "Persistent spotting notifications"      },      "readonly": true,      "required": true    },    {      "key": "day",      "name": "Day",      "type": "date",      "required": true,      "readonly": true    },    {      "key": "value",      "name": "Value",      "type": "number",      "readonly": true    },    {      "key": "min",      "name": "Lowest",      "type": "number",      "readonly": true    },    {      "key": "max",      "name": "Highest",      "type": "number",      "readonly": true    },    {      "key": "unit",      "name": "Unit",      "type": "text",      "readonly": true    },    {      "key": "samples",      "name": "Readings",      "type": "number",      "readonly": true,      "units": {        "one": "{n} reading",        "other": "{n} readings"      }    },    {      "key": "state",      "name": "Flow",      "type": "choice",      "choices": [        "none",        "unspecified",        "light",        "medium",        "heavy"      ],      "labels": {        "none": "None",        "unspecified": "Flow",        "light": "Light",        "medium": "Medium",        "heavy": "Heavy"      },      "readonly": true    },    {      "key": "source",      "name": "From",      "type": "choice",      "choices": [        "healthkit",        "health_connect",        "export"      ],      "labels": {        "healthkit": "Apple Health",        "health_connect": "Health Connect",        "export": "Apple Health export"      },      "readonly": true    }  ],  "seal": {    "clear": [      "key",      "day"    ]  },  "title": "metric",  "date": "day",  "project": null,  "order": null,  "slip": {    "title": "metric",    "subtitle": "value",    "trailing": "day",    "photo": null,    "toggle": null  },  "tile": {    "face": "slip-list"  },  "card": {    "face": "health.pedometer",    "fields": [      {        "slot": "title",        "column": "metric"      },      {        "slot": "subtitle",        "column": "value"      },      {        "slot": "date",        "column": "day",        "form": "weekday_date"      }    ]  },  "page": [    {      "heading": null,      "columns": [        "metric",        "day",        "value",        "unit"      ]    },    {      "heading": "The day's readings",      "columns": [        "min",        "max",        "samples",        "state",        "source"      ]    }  ],  "sort": {    "column": "day",    "descending": true  },  "empty": {    "title": "No health readings yet",    "message": "Allow Cotton Health to read Apple Health and each day's numbers stand here."  },  "create": {    "label": "Bring in",    "doors": [      {        "id": "apple_health",        "label": "Read Apple Health",        "object": "device",        "reads": "apple_health"      },      {        "id": "export",        "label": "Bring in a Health export",        "object": "folder",        "files": {          "types": [            "public.zip-archive",            "public.xml"          ]        }      }    ]  },  "row_key": "key",  "instructions": "One row per measure per day, the main health table: the day's steps, walking and running distance (metres), active energy (kcal), flights, stand hours, resting heart rate (bpm), heart rate variability (SDNN, ms), cardio fitness (VO2 max, ml/kg/min), sleep by stage in minutes (asleep, in bed, core, deep, REM, awake; a night is the day it ended), weight (kg), body fat (%), blood pressure (mmHg, the day's mean), blood glucose (mg/dL, the day's mean), mindful minutes and, only when logged, the period's flow (state). value is in unit; min and max are the day's lowest and highest where a measure has them. Every other type Apple Health offers as a day's number lands here too, by the same rule: activity (resting energy, exercise, stand and move minutes, each kind of distance, pushes, strokes, daylight, falls), heart (the day's heart rate average with its least and most, walking heart rate, blood oxygen, respiratory rate, sleeping wrist temperature, breathing disturbances), mobility (walking speed, step length, asymmetry, double support, steadiness, stair speeds, six-minute walk), running and cycling metrics, sound exposure, body (BMI, lean mass, height, waist), UV, nutrition (energy, protein, carbohydrates, fat, sugar, fibre, sodium, minerals, vitamins, caffeine, water), and counts of events (toothbrushing minutes, handwashing, heart and sound notifications, spotting). Read from Apple Health, never written back: a person never edits a reading here, and Cotton never writes one to Health. Sealed: only the day stays clear on the object."}