[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BZQ64728P0FX1GP2JAED4Y":3,"skill-same:01M7BZQ64728P0FX1GP2JAED4Y":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7BZQ64728P0FX1GP2JAED4Y","lab-unit-harmonization",null,"Harmonize clinical lab values by parsing messy numerics, converting mixed unit systems into a single target, and validating outputs against authoritative feature ranges.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillGrad\u002Fmain31_local_recovery_four_20261019_v1\u002Ftasks\u002Flab-unit-harmonization\u002Frepaired_skill\u002Flab-unit-harmonization\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: lab-unit-harmonization\ndescription: Harmonize clinical lab values by parsing messy numerics, converting mixed unit systems into a single target, and validating outputs against authoritative feature ranges.\n---\n\n# Lab Unit Harmonization\n\n## Core Workflow\n\n1. **Parse first, convert second**: normalize raw strings (scientific notation, decimal separators, whitespace) into floats before any unit logic.\n2. **Anchor to the reference**: for each feature, treat the reference dictionary as the source of truth for (a) *target output unit* and (b) *valid min\u002Fmax range in that unit*.\n3. **Use ranges as unit evidence (not as the gate)**: pick conversion factors at the *feature* level by distribution fit; avoid per-value “try conversions until it fits” and avoid “already in range ⇒ correct unit” when ranges can overlap.\n4. **Keep reference ranges fixed**: treat the authoritative `(lo, hi)` as immutable; if many values are out-of-range or typicals don’t match, adjust conversion candidates (including trying inverse factors) or quarantine\u002Fflag, but do not broaden\u002Fshift the range to make values pass.\n5. **Verify post-write**: run (a) a range re-check against the same authoritative ranges and (b) a unit-sanity audit using summary stats\u002Ftypical values for the *target unit* (median\u002Fquantiles), not only broad min\u002Fmax.\n\n## Parse Numeric Formats\n\nNormalize heterogeneous numeric strings into floats.\n\n```python\nimport numpy as np\n\ndef parse_float(x):\n    if x is None:\n        return np.nan\n    s = str(x).strip()\n    if s == '' or s.lower() in {'nan', 'none', 'null'}:\n        return np.nan\n    # decimal comma (when used as decimal separator)\n    if ',' in s and '.' not in s:\n        s = s.replace(',', '.')\n    try:\n        return float(s)\n    except ValueError:\n        return np.nan\n```\n\n## Unit Conversion (Feature-Level Fit)\n\nConvert values into the *target unit* by scoring candidate conversion factors against the authoritative target-unit range.\n\n```python\nimport numpy as np\n\ndef pct_out_of_range(xs, lo, hi, tol=0.0):\n    xs = [x for x in xs if x is not None and not (isinstance(x, float) and np.isnan(x))]\n    if not xs:\n        return 0.0\n    return sum((x \u003C lo - tol) or (x > hi + tol) for x in xs) \u002F len(xs)\n\ndef convert_with_best_factor(values, target_range, candidate_factors, tol=0.0):\n    lo, hi = target_range\n    best = (pct_out_of_range(values, lo, hi, tol=tol), None)\n    for f in candidate_factors:\n        ys = [v * f if v is not None and not (isinstance(v, float) and np.isnan(v)) else v for v in values]\n        cand = (pct_out_of_range(ys, lo, hi, tol=tol), f)\n        if cand[0] \u003C best[0]:\n            best = cand\n    return best  # (pct_out, factor or None)\n```\n\nDecision rule: tolerance is only for float noise near boundaries; never use tolerance, per-value factor selection, or range-widening to make clearly wrong-unit values appear valid.\n\nRead references\u002Frange_unit_consistency_guardrail.md when a feature’s `% out of range` is low but the *distribution\u002Ftypicals* suggest a different unit regime (or when you feel tempted to broaden\u002Fshift `(lo, hi)` or to accept the first factor that makes a value “fit”). Skip when the target unit is unambiguous and range fit plus typicals both agree.\n\n## Format Output (Stable Precision)\n\nEmit consistent string formatting after all numeric transformations, then validate formatting constraints **per cell** (not by scanning the serialized CSV text).\n\n```python\nimport re\n\n_DECIMAL_DOT_2DP = re.compile(r\"^-?\\d+\\.\\d{2}$\")\n\ndef format_fixed(x, decimals=2):\n    return '' if x is None else f\"{x:.{decimals}f}\"\n\ndef validate_cells_are_dot_decimal(series_as_str, pattern=_DECIMAL_DOT_2DP):\n    bad = [s for s in series_as_str if s != '' and not pattern.match(s)]\n    assert not bad, f\"bad formatted cells: {bad[:5]}\"\n```\n\nDecision rule: treat “no commas” \u002F “dot decimal” requirements as constraints on **field values**; never regex the whole CSV text for commas because delimiter commas guarantee matches.\n\n## Common Pitfalls\n\n- **Using broad ranges as the definition of the target unit**: a permissive `(lo, hi)` can make the wrong unit look “in range,” or can drift the target unit entirely; anchor target unit + range in an authoritative feature dictionary, then validate typicals.\n- **Per-value “try conversions until it fits”**: choosing factors per cell can silently misconvert bimodal\u002Funit-mixed features; pick a feature-level factor (or explicitly branch\u002Fquarantine) based on distribution fit.\n- **One-direction conversion only**: some unit confusions require trying both multiply and divide (i.e., include inverse factors) to find the best fit.\n- **Converting before parsing**: unit conversion on unparsed strings (scientific notation, decimal comma) can create false outliers and bad conversions.\n- **CSV-level regex checks for per-cell formatting**: scanning the whole file for patterns like `\\d,\\d` confuses separators with decimal commas; validate per field (and reload with `dtype=str` if checking post-write).\n- **Over-tolerance or clamping**: tolerance is for boundary float noise, not for rescuing clearly invalid values.\n","# Lab Unit Harmonization\n\n## Core Workflow\n\n1. **Parse first, convert second**: normalize raw strings (scientific notation, decimal separators, whitespace) into floats before any unit logic.\n2. **Anchor to the reference**: for each feature, treat the reference dictionary as the source of truth for (a) *target output unit* and (b) *valid min\u002Fmax range in that unit*.\n3. **Use ranges as unit evidence (not as the gate)**: pick conversion factors at the *feature* level by distribution fit; avoid per-value “try conversions until it fits” and avoid “already in range ⇒ correct unit” when ranges can overlap.\n4. **Keep reference ranges fixed**: treat the authoritative `(lo, hi)` as immutable; if many values are out-of-range or typicals don’t match, adjust conversion candidates (including trying inverse factors) or quarantine\u002Fflag, but do not broaden\u002Fshift the range to make values pass.\n5. **Verify post-write**: run (a) a range re-check against the same authoritative ranges and (b) a unit-sanity audit using summary stats\u002Ftypical values for the *target unit* (median\u002Fquantiles), not only broad min\u002Fmax.\n\n## Parse Numeric Formats\n\nNormalize heterogeneous numeric strings into floats.\n\n```python\nimport numpy as np\n\ndef parse_float(x):\n    if x is None:\n        return np.nan\n    s = str(x).strip()\n    if s == '' or s.lower() in {'nan', 'none', 'null'}:\n        return np.nan\n    # decimal comma (when used as decimal separator)\n    if ',' in s and '.' not in s:\n        s = s.replace(',', '.')\n    try:\n        return float(s)\n    except ValueError:\n        return np.nan\n```\n\n## Unit Conversion (Feature-Level Fit)\n\nConvert values into the *target unit* by scoring candidate conversion factors against the authoritative target-unit range.\n\n```python\nimport numpy as np\n\ndef pct_out_of_range(xs, lo, hi, tol=0.0):\n    xs = [x for x in xs if x is not None and not (isinstance(x, float) and np.isnan(x))]\n    if not xs:\n        return 0.0\n    return sum((x \u003C lo - tol) or (x > hi + tol) for x in xs) \u002F len(xs)\n\ndef convert_with_best_factor(values, target_range, candidate_factors, tol=0.0):\n    lo, hi = target_range\n    best = (pct_out_of_range(values, lo, hi, tol=tol), None)\n    for f in candidate_factors:\n        ys = [v * f if v is not None and not (isinstance(v, float) and np.isnan(v)) else v for v in values]\n        cand = (pct_out_of_range(ys, lo, hi, tol=tol), f)\n        if cand[0] \u003C best[0]:\n            best = cand\n    return best  # (pct_out, factor or None)\n```\n\nDecision rule: tolerance is only for float noise near boundaries; never use tolerance, per-value factor selection, or range-widening to make clearly wrong-unit values appear valid.\n\nRead references\u002Frange_unit_consistency_guardrail.md when a feature’s `% out of range` is low but the *distribution\u002Ftypicals* suggest a different unit regime (or when you feel tempted to broaden\u002Fshift `(lo, hi)` or to accept the first factor that makes a value “fit”). Skip when the target unit is unambiguous and range fit plus typicals both agree.\n\n## Format Output (Stable Precision)\n\nEmit consistent string formatting after all numeric transformations, then validate formatting constraints **per cell** (not by scanning the serialized CSV text).\n\n```python\nimport re\n\n_DECIMAL_DOT_2DP = re.compile(r\"^-?\\d+\\.\\d{2}$\")\n\ndef format_fixed(x, decimals=2):\n    return '' if x is None else f\"{x:.{decimals}f}\"\n\ndef validate_cells_are_dot_decimal(series_as_str, pattern=_DECIMAL_DOT_2DP):\n    bad = [s for s in series_as_str if s != '' and not pattern.match(s)]\n    assert not bad, f\"bad formatted cells: {bad[:5]}\"\n```\n\nDecision rule: treat “no commas” \u002F “dot decimal” requirements as constraints on **field values**; never regex the whole CSV text for commas because delimiter commas guarantee matches.\n\n## Common Pitfalls\n\n- **Using broad ranges as the definition of the target unit**: a permissive `(lo, hi)` can make the wrong unit look “in range,” or can drift the target unit entirely; anchor target unit + range in an authoritative feature dictionary, then validate typicals.\n- **Per-value “try conversions until it fits”**: choosing factors per cell can silently misconvert bimodal\u002Funit-mixed features; pick a feature-level factor (or explicitly branch\u002Fquarantine) based on distribution fit.\n- **One-direction conversion only**: some unit confusions require trying both multiply and divide (i.e., include inverse factors) to find the best fit.\n- **Converting before parsing**: unit conversion on unparsed strings (scientific notation, decimal comma) can create false outliers and bad conversions.\n- **CSV-level regex checks for per-cell formatting**: scanning the whole file for patterns like `\\d,\\d` confuses separators with decimal commas; validate per field (and reload with `dtype=str` if checking post-write).\n- **Over-tolerance or clamping**: tolerance is for boundary float noise, not for rescuing clearly invalid values.\n",{"name":5,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","evaluation\u002Fresults\u002FSkillGrad\u002Fmain31_local_recovery_four_20261019_v1\u002Ftasks\u002Flab-unit-harmonization\u002Frepaired_skill\u002Flab-unit-harmonization",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill lab-unit-harmonization",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill lab-unit-harmonization",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill lab-unit-harmonization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillGrad\u002Fmain31_local_recovery_four_20261019_v1\u002Ftasks\u002Flab-unit-harmonization\u002Frepaired_skill\u002Flab-unit-harmonization\u002FSKILL.md",true,[45,51],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"reference\u002Fckd_lab_features.md","REFERENCE","参考文档",12949,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillGrad\u002Fmain31_local_recovery_four_20261019_v1\u002Ftasks\u002Flab-unit-harmonization\u002Frepaired_skill\u002Flab-unit-harmonization\u002Freference\u002Fckd_lab_features.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Frange_unit_consistency_guardrail.md",5039,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fevaluation\u002Fresults\u002FSkillGrad\u002Fmain31_local_recovery_four_20261019_v1\u002Ftasks\u002Flab-unit-harmonization\u002Frepaired_skill\u002Flab-unit-harmonization\u002Freferences\u002Frange_unit_consistency_guardrail.md",[56,63,70,77,82,87],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":78,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":83,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":88,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]