[d869a2]: / Notebooks / 06_get_nsrr_AHI_definitions.ipynb

Download this file

77 lines (76 with data), 2.1 kB

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "variables = pd.read_csv('/vol/sleepstudy/datasets/mesa/datasets/mesa-data-dictionary-0.7.0-variables.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "ahis = []\n",
    "for _, row in variables.iterrows():\n",
    "    id_name = row.loc['id']\n",
    "    if 'ahi' in id_name.lower():\n",
    "        ahis.append(id_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"nsrr_ahi_hp3r_aasm15', 'nsrr_ahi_hp3u', 'nsrr_ahi_hp4r', 'nsrr_ahi_hp4u_aasm15', 'ahi4p_nrem5', 'ahi4p_nsup5', 'ahi4p_rem5', 'ahi4p_sup5', 'ahi4pa_nrem5', 'ahi4pa_nsup5', 'ahi4pa_rem5', 'ahi4pa_sup5', 'ahi_a0h3', 'ahi_a0h3a', 'ahi_a0h4', 'ahi_a0h4a', 'ahi_c0h3', 'ahi_c0h3a', 'ahi_c0h4', 'ahi_c0h4a', 'ahi_o0h3', 'ahi_o0h3a', 'ahi_o0h4', 'ahi_o0h4a', 'ahiu35', 'oahi35', 'oahi3_nrem5', 'oahi3_nsup5', 'oahi3_rem5', 'oahi3_sup5', 'oahi3pa5', 'oahi3pa_nrem5', 'oahi3pa_nsup5', 'oahi3pa_rem5', 'oahi3pa_sup5', 'oahi45', 'oahi4_nrem5', 'oahi4_nsup5', 'oahi4_rem5', 'oahi4_sup5', 'oahi4pa5', 'oahi4pa_nrem5', 'oahi4pa_nsup5', 'oahi4pa_rem5', 'oahi4pa_sup5', 'ahiov505\""
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'\\', \\''.join(ahis)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "master",
   "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.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}