{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Oil Discrimination (Basic)\n",
    "Load synthetic oil data, run FoodSpec protocol, and preview results."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from foodspec.protocol_engine import ProtocolConfig, ProtocolRunner\n",
    "from pathlib import Path\n",
    "\n",
    "data_path = Path('examples/data/oil_synthetic.csv')\n",
    "proto_path = Path('examples/protocols/EdibleOil_Classification_v1.yml') if (Path('examples/protocols/EdibleOil_Classification_v1.yml')).exists() else None\n",
    "df = pd.read_csv(data_path)\n",
    "cfg = ProtocolConfig.from_file(proto_path) if proto_path else ProtocolConfig.from_dict({\"name\": \"synthetic_oil\", \"steps\":[{\"type\":\"rq_analysis\",\"params\":{\"oil_col\":\"oil_type\",\"matrix_col\":\"matrix\",\"heating_col\":\"heating_stage\"}}, {\"type\":\"output\",\"params\":{\"output_dir\":\"runs_notebook\"}}]})\n",
    "runner = ProtocolRunner(cfg)\n",
    "res = runner.run([df])\n",
    "print('Run dir:', res.run_dir)\n",
    "# Show first lines of report\n",
    "print(res.report.split('\n')[:20])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
