{"data":{"slug":"github-aipoch-medical-research-skills-scientific-skills-other-lab-inventory-predictor-f9ce20b38917","title":"Lab Inventory Predictor (Python 3.8+)","summary":"Predicts reagent depletion time based on historical usage and generates purchase alerts. Requires Python 3.8+ and uses only standard library modules.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-lab-inventory-predictor-f9ce20b38917","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-lab-inventory-predictor-f9ce20b38917","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-lab-inventory-predictor-f9ce20b38917.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-other-lab-inventory-predictor-f9ce20b38917\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Ensure Python 3.8+ is installed before running the script. The script includes a version guard that exits with an error if Python 3.8+ is not detected.","instructions":"---\nname: lab-inventory-predictor\ndescription: Predict depletion time of critical lab reagents based on historical usage frequency, and automatically generate purchase alerts when stock falls below safety thresholds.\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n# Lab Inventory Predictor\n\nPredicts reagent depletion time by analyzing historical usage frequency, and automatically generates reminders when purchases are needed.\n\n## Input Validation\n\nThis skill accepts: lab reagent inventory data (stock levels, usage records) for the purpose of predicting depletion dates and generating purchase alerts.\n\nIf the user's request does not involve lab reagent inventory management or depletion prediction \u2014 for example, asking to analyze experimental results, manage equipment, or perform general data analysis \u2014 do not proceed with the workflow. Instead respond:\n> \"lab-inventory-predictor is designed to predict reagent depletion and generate purchase alerts based on usage history. Your request appears to be outside this scope. Please provide reagent inventory data, or use a more appropriate tool for your task.\"\n\nDo not continue the workflow when the request is out of scope, missing the required `--action` parameter, or would require unsupported assumptions. For missing inputs, state exactly which fields are missing.\n\n## Quick Check\n\n```bash\npython -m py_compile scripts\/main.py\npython scripts\/main.py --help\npython scripts\/main.py --action status\n```\n\n## Prerequisites\n\n- **Python 3.8+ is strictly required** (uses `dataclasses` module). On Python 3.6 the script will fail at import with `ModuleNotFoundError`. Upgrade with `pyenv install 3.8` or `conda create -n lab python=3.8`.\n- The script should include a version guard: `if sys.version_info < (3, 8): sys.exit('Error: Python 3.8+ required')` before the dataclasses import.\n- No external dependencies (uses only standard library)\n\n```text\npip install -r requirements.txt\n```\n\n## When to Use\n\n- Predict when lab reagents will run out based on historical consumption data\n- Generate purchase alerts before reagents deplete below safety thresholds\n- Track stock levels and usage history for multiple reagents\n- Generate inventory reports in text, JSON, or CSV format\n\n## Workflow\n\n1. **Validate input** \u2014 confirm the request is within scope before any processing.\n2. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.\n3. Use the packaged script path or the documented reasoning path with only the inputs that are actually available.\n4. Return a structured result that separates assumptions, deliverables, risks, and unresolved items.\n5. If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.\n\n## Core Capabilities\n\n1. **Inventory Tracking** \u2014 Record current reagent stock levels\n2. **Usage Frequency Analysis** \u2014 Calculate consumption rate based on experiment records\n3. **Depletion Prediction** \u2014 Predict reagent depletion date based on consumption rate\n4. **Purchase Alerts** \u2014 Generate alerts before reagents are about to deplete\n5. **Safety Stock Alerts** \u2014 Alert when inventory falls below safety threshold\n\n## Usage\n\n### Command Line\n\n```text\n# View all reagent status\npython scripts\/main.py --action status\n\n# Add or update reagent information\npython scripts\/main.py --action add-reagent \\\n  --name \"PBS Buffer\" \\\n  --current-stock 500 \\\n  --unit \"ml\" \\\n  --safety-days 7\n\n# Record experiment consumption\npython scripts\/main.py --action record-usage \\\n  --name \"PBS Buffer\" \\\n  --amount 50 \\\n  --experiment \"Cell Culture Experiment #2024-001\"\n\n# Get purchase alerts\npython scripts\/main.py --action alerts\n\n# Generate prediction report\npython scripts\/main.py --action report\n```\n\n### Python API\n\n```python\nfrom skills.lab_inventory_predictor import InventoryPredictor\n\npredictor = InventoryPredictor(\"\/path\/to\/inventory.json\")\npredictor.add_reagent(name=\"PBS Buffer\", current_stock=500, unit=\"ml\", safety_days=7, lead_time_days=3)\npredictor.record_usage(\"PBS Buffer\", 50, \"Experiment #001\")\nprediction = predictor.predict_depletion(\"PBS Buffer\")\nprint(f\"Predicted depletion time: {prediction['depletion_date']}\")\nalerts = predictor.get_alerts()\n```\n\n## Parameters\n\n### Global Parameters\n| Parameter | Type | Default | Required | Description |\n|-----------|------|---------|----------|-------------|\n| `--action` | string | - | Yes | Action: status, add-reagent, record-usage, alerts, report |\n| `--data-file` | string | ~\/.openclaw\/workspace\/data\/lab-inventory.json | No | Path to inventory data file (must be within workspace; `..\/` paths rejected) |\n\n### add-reagent Action\n| Parameter | Type | Default | Required | Description |\n|-----------|------|---------|----------|-------------|\n| `--name` | string | - | Yes | Reagent name |\n| `--current-stock` | float | - | Yes | Current stock quantity |\n| `--unit` | string | - | Yes | Unit of measurement (ml, mg, etc.) |\n| `--safety-days` | int | 7 | No | Safety buffer days |\n| `--lead-time-days` | int | 3 | No | Expected delivery time |\n| `--safety-stock` | float | - | No | Safety stock threshold |\n\n### record-usage Action\n| Parameter | Type | Default | Required | Description |\n|-----------|------|---------|----------|-------------|\n| `--name` | string | - | Yes | Reagent name |\n| `--amount` | float | - | Yes | Amount consumed |\n| `--experiment` | string | - | No | Experiment identifier |\n\n### report Action\n| Parameter | Type | Default | Required | Description |\n|-----------|------|---------|----------|-------------|\n| `--output`, `-o` | string | stdout | No | Output file path |\n| `--format` | string | text | No | Output format (text, json, csv) |\n\n## Prediction Algorithm\n\n### Consumption Rate\n```\ndaily_consumption = \u03a3(usage_amount) \/ days_span\n```\n\n### Depletion Date\n```\ndays_until_depletion = current_stock \/ daily_consumption\ndepletion_date = today + days_until_depletion\n```\n\n### Purchase Alert Trigger Conditions\n1. **Time-based**: When `days_until_depletion <= safety_days + lead_time_days`\n2. **Stock-based**: When `current_stock <= safety_stock`\n\n### Confidence Warning\nWhen a reagent has **fewer than 3 usage records**, the prediction is flagged as `LOW_CONFIDENCE`. The output will include:\n> \"Warning: Only [N] usage records available for [reagent]. Prediction reliability is low \u2014 collect more usage data before relying on this estimate.\"\n\nEach LOW_CONFIDENCE prediction must include an inline risk note adjacent to the prediction result, not only in the aggregate Risks section.\n\n## Fallback Behavior\n\nIf `scripts\/main.py` fails or required inputs are incomplete:\n1. Report the exact failure point and error message.\n2. State what can still be completed (e.g., status check without prediction).\n3. Manual fallback: verify the inventory JSON file exists at the configured path, then re-run with `--action status` to confirm data integrity.\n4. Do not fabricate execution outcomes or inventory data.\n\n## Output Requirements\n\nEvery final response must make these items explicit when relevant:\n\n- Objective or requested deliverable\n- Inputs used and assumptions introduced\n- Workflow or decision path\n- Core result, recommendation, or artifact\n- Constraints, risks, caveats, or validation needs (including LOW_CONFIDENCE flags for sparse data, noted inline per reagent)\n- Unresolved items and next-step checks\n\n## Error Handling\n\n- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.\n- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.\n- If `--data-file` path contains `..\/` or points outside the workspace, reject with a path traversal warning.\n- If `scripts\/main.py` fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.\n- Do not fabricate files, citations, data, search results, or execution outcomes.\n\n## Response Template\n\nUse the following fixed structure for non-trivial requests:\n\n1. Objective\n2. Inputs Received\n3. Assumptions\n4. Workflow\n5. Deliverable\n6. Risks and Limits (include LOW_CONFIDENCE flag inline per reagent if fewer than 3 usage records)\n7. Next Checks\n\nFor stress\/multi-constraint requests, also include:\n- Constraints checklist (compliance, performance, error paths)\n- Unresolved items with explicit blocking reasons\n\nIf the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.\n","use_cases":["Predict when lab reagents will run out based on historical consumption data","Generate purchase alerts before reagents deplete below safety thresholds","Track stock levels and usage history for multiple reagents","Generate inventory reports in text, JSON, or CSV format"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/scientific-skills\/Other\/lab-inventory-predictor\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-26","created_at":"2026-11-24T15:11:55.000000Z","updated_at":"2026-11-26T09:25:03.000000Z","seo_title":"Lab Inventory Predictor for Reagent Depletion (Python 3.8+)","seo_description":"Predict reagent depletion time and generate purchase alerts based on historical usage data using Python 3.8+. Automate inventory management for lab reagents with no third","seo_keywords":["reagent depletion prediction","lab inventory alerts","reagent usage tracking","inventory management tool","lab stock prediction","Python 3.8+ lab tool"]}}