{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d2701d07",
   "metadata": {},
   "source": [
    "# Helper notebook to allow pushing data on S3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "5c8fc6c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import s3fs\n",
    "\n",
    "def push_file(local_path, s3_path):\n",
    "    fs = s3fs.S3FileSystem(\n",
    "        client_kwargs={'endpoint_url': 'https://' + 'minio-simple.lab.groupe-genes.fr'},\n",
    "        key=os.environ[\"AWS_ACCESS_KEY_ID\"],\n",
    "        secret=os.environ[\"AWS_SECRET_ACCESS_KEY\"],\n",
    "        token=os.environ[\"AWS_SESSION_TOKEN\"]\n",
    "    )\n",
    "\n",
    "    with open(local_path, 'rb') as local_f, fs.open(s3_path, 'wb') as s3_f:\n",
    "        s3_f.write(local_f.read())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d43b725e",
   "metadata": {},
   "outputs": [],
   "source": [
    "push_file('repair_challenge/alpha_5%/carmignac_broken_months.csv', 'projet-bdc-carmignac-g3//paco/carmignac_broken_months.csv')\n",
    "push_file('repair_challenge/alpha_5%/carmignac_error_account_agg.csv', 'projet-bdc-carmignac-g3//paco/carmignac_error_account_agg.csv')\n",
    "push_file('repair_challenge/alpha_5%/carmignac_error_account.csv', 'projet-bdc-carmignac-g3//paco/carmignac_error_account.csv')\n",
    "push_file('AUM_repaired.csv', 'projet-bdc-carmignac-g3//paco/AUM_repaired.csv')\n",
    "push_file('AUM_paths.csv', 'projet-bdc-carmignac-g3//paco/AUM_paths.csv')\n",
    "push_file('AUM_repair_audit.csv', 'projet-bdc-carmignac-g3//paco/AUM_repair_audit.csv')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
