{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7fb27b941602401d91542211134fc71a",
   "metadata": {},
   "source": [
    "# Oil vs Chips Matrix Effects\n",
    "Compare oils vs chips synthetic datasets using a multi-input protocol."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "acae54e37e7d407bbb7b55eff062a284",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import pandas as pd\n",
    "\n",
    "from foodspec.protocol_engine import ProtocolConfig, ProtocolRunner\n",
    "\n",
    "oil_df = pd.read_csv('examples/data/oil_synthetic.csv')\n",
    "chips_df = pd.read_csv('examples/data/chips_synthetic.csv')\n",
    "proto = {\n",
    "    'name': 'oil_vs_chips_demo',\n",
    "    'steps': [\n",
    "        {\"type\":\"rq_analysis\",\"params\":{\"oil_col\":\"oil_type\",\"matrix_col\":\"matrix\",\"heating_col\":\"heating_stage\"}},\n",
    "        {\"type\":\"output\",\"params\":{\"output_dir\":\"runs_notebook\"}}\n",
    "    ],\n",
    "    'expected_columns': {'oil_col':'oil_type','matrix_col':'matrix','heating_col':'heating_stage'}\n",
    "}\n",
    "cfg = ProtocolConfig.from_dict(proto)\n",
    "runner = ProtocolRunner(cfg)\n",
    "res = runner.run([oil_df])\n",
    "print('Run dir:', res.run_dir)\n",
    "print('Tables:', list(res.tables.keys()))\n",
    "print('Top oil vs chips divergence (if present):')\n",
    "if 'oil_vs_chips_summary' in res.tables:\n",
    "    print(res.tables['oil_vs_chips_summary'].head())\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
