{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CDISC Library API Hands-on 上手\n",
    "C3C, John Wang, on 2026-01-23"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "内容：\n",
    "1）CDISC Library 概述\n",
    "   如何注册和获取 API Key\n",
    "2）简单的示例，SDTM Domain List, Variable List, Code List 等等\n",
    "3）有啥用？\n",
    "\n"
   ]
  },
  {
   "attachments": {
    "cdisc_lib_api.png": {
     "image/png": "[encoded data, 183780 characters]"
    },
    "cdisc_lib_browser.png": {
     "image/png": "[encoded data, 239040 characters]"
    },
    "image.png": {
     "image/png": "[encoded data, 545240 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1) CDISC Library 概述\n",
    "\n",
    "主要内容\n",
    "![image.png](attachment:image.png)\n",
    "\n",
    "Browser:\n",
    "https://library.cdisc.org/browser/#/\n",
    "![cdisc_lib_browser.png](attachment:cdisc_lib_browser.png)\n",
    "\n",
    "API:\n",
    "https://api.developer.library.cdisc.org/api-details#api=cdisc-library-api&operation=api-products-qrs-get_version\n",
    "![cdisc_lib_api.png](attachment:cdisc_lib_api.png)\n",
    "\n",
    "How to article:\n",
    "https://wiki.cdisc.org/display/LIBSUPRT/How-to+articles\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2）简单的示例，SDTM Domain List, Variable List, Code List 等等"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import requests\n",
    "import json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import JSON"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "[encoded data, 87020 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 设置API KEY\n",
    "\n",
    "在 \".env\"文件中，放入自己的api key内容：\n",
    "\n",
    "    CDISC_LIBRARY_API_KEY = \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n",
    "\n",
    "\n",
    "\n",
    "![image.png](attachment:image.png)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "导入api-key"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from dotenv import load_dotenv\n",
    "load_dotenv()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "api_key = os.getenv(\"CDISC_LIBRARY_API_KEY\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### SDTM IG 3.4 Domain List"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "standard = \"sdtmig\"\n",
    "standard_version = \"3-4\"\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/{standard}/{standard_version}/datasets\"\n",
    "\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "datasets": [
         {
          "href": "/mdr/sdtmig/3-4/datasets/AG",
          "title": "Procedure Agents",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/CM",
          "title": "Concomitant/Prior Medications",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/EC",
          "title": "Exposure as Collected",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/EX",
          "title": "Exposure",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/ML",
          "title": "Meal Data",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/PR",
          "title": "Procedures",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SU",
          "title": "Substance Use",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/AE",
          "title": "Adverse Events",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/BE",
          "title": "Biospecimen Events",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/CE",
          "title": "Clinical Events",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DS",
          "title": "Disposition",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DV",
          "title": "Protocol Deviations",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/HO",
          "title": "Healthcare Encounters",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/MH",
          "title": "Medical History",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/BS",
          "title": "Biospecimen Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/CP",
          "title": "Cell Phenotype Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/CV",
          "title": "Cardiovascular System Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DA",
          "title": "Product Accountability",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DD",
          "title": "Death Details",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/EG",
          "title": "ECG Test Results",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/FT",
          "title": "Functional Tests",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/GF",
          "title": "Genomics Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/IE",
          "title": "Inclusion/Exclusion Criteria Not Met",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/IS",
          "title": "Immunogenicity Specimen Assessments",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/LB",
          "title": "Laboratory Test Results",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/MB",
          "title": "Microbiology Specimen",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/MI",
          "title": "Microscopic Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/MK",
          "title": "Musculoskeletal System Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/MS",
          "title": "Microbiology Susceptibility",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/NV",
          "title": "Nervous System Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/OE",
          "title": "Ophthalmic Examinations",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/PC",
          "title": "Pharmacokinetics Concentrations",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/PE",
          "title": "Physical Examination",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/PP",
          "title": "Pharmacokinetics Parameters",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/QS",
          "title": "Questionnaires",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/RE",
          "title": "Respiratory System Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/RP",
          "title": "Reproductive System Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/RS",
          "title": "Disease Response and Clin Classification",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SC",
          "title": "Subject Characteristics",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SS",
          "title": "Subject Status",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TR",
          "title": "Tumor/Lesion Results",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TU",
          "title": "Tumor/Lesion Identification",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/UR",
          "title": "Urinary System Findings",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/VS",
          "title": "Vital Signs",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/FA",
          "title": "Findings About Events or Interventions",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SR",
          "title": "Skin Response",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/CO",
          "title": "Comments",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM",
          "title": "Demographics",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SE",
          "title": "Subject Elements",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SM",
          "title": "Subject Disease Milestones",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SV",
          "title": "Subject Visits",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TA",
          "title": "Trial Arms",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TD",
          "title": "Trial Disease Assessments",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TE",
          "title": "Trial Elements",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TI",
          "title": "Trial Inclusion/Exclusion Criteria",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TM",
          "title": "Trial Disease Milestones",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TS",
          "title": "Trial Summary",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/TV",
          "title": "Trial Visits",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/OI",
          "title": "Non-host Organism Identifiers",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/RELREC",
          "title": "Related Records",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/RELSPEC",
          "title": "Related Specimens",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/RELSUB",
          "title": "Related Subjects",
          "type": "SDTM Dataset"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/SUPPQUAL",
          "title": "Supplemental Qualifiers for [domain name]",
          "type": "SDTM Dataset"
         }
        ],
        "parentProduct": {
         "href": "/mdr/sdtmig/3-4",
         "title": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
         "type": "Implementation Guide"
        },
        "priorVersion": {
         "href": "/mdr/sdtmig/3-3/datasets",
         "title": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
         "type": "SDTMIG Dataset List"
        },
        "self": {
         "href": "/mdr/sdtmig/3-4/datasets",
         "title": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
         "type": "SDTMIG Dataset List"
        }
       },
       "description": "This is the implementation guide for human clinical trials corresponding to Version 2.0 of the CDISC Study Data Tabulation Model.",
       "effectiveDate": "2021-11-29",
       "label": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
       "name": "SDTMIG v3.4",
       "registrationStatus": "Final",
       "source": "Prepared by the CDISC Submission Data Standards Team",
       "version": "3-4"
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 6,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "attachments": {
    "best_trees_for_birds_759cfec4-76bf-4340-b0d9-ffc0a5835590.jpg": {
     "image/jpeg": "[encoded data, 1223640 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### JSON数据格式， vs 树\n",
    "\n",
    "有**层级**的数据结构\n",
    "\n",
    "![best_trees_for_birds_759cfec4-76bf-4340-b0d9-ffc0a5835590.jpg](attachment:best_trees_for_birds_759cfec4-76bf-4340-b0d9-ffc0a5835590.jpg)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### SDTM IG 3.4 Domain - DM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "dataset_name = \"DM\"\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/{standard}/{standard_version}/datasets/{dataset_name}\"\n",
    "\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\n",
      "  \"_links\": {\n",
      "    \"modelDataset\": {\n",
      "      \"href\": \"/mdr/sdtm/2-0/datasets/DM\",\n",
      "      \"title\": \"Demographics\",\n",
      "      \"type\": \"SDTM Dataset\"\n",
      "    },\n",
      "    \"parentClass\": {\n",
      "      \"href\": \"/mdr/sdtmig/3-4/classes/SpecialPurpose\",\n",
      "      \"title\": \"Special-Purpose\",\n",
      "      \"type\": \"Class\"\n",
      "    },\n",
      "    \"parentProduct\": {\n",
      "      \"href\": \"/mdr/sdtmig/3-4\",\n",
      "      \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "      \"type\": \"Implementation Guide\"\n",
      "    },\n",
      "    \"priorVersion\": {\n",
      "      \"href\": \"/mdr/sdtmig/3-3/datasets/DM\",\n",
      "      \"title\": \"Demographics\",\n",
      "      \"type\": \"SDTM Dataset\"\n",
      "    },\n",
      "    \"self\": {\n",
      "      \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "      \"title\": \"Demographics\",\n",
      "      \"type\": \"SDTM Dataset\"\n",
      "    }\n",
      "  },\n",
      "  \"datasetStructure\": \"One record per subject\",\n",
      "  \"datasetVariables\": [\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/STUDYID\",\n",
      "          \"title\": \"Study Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/STUDYID\",\n",
      "          \"title\": \"Study Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/STUDYID\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.STUDYID\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/STUDYID\",\n",
      "          \"title\": \"Study Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Unique identifier for a study.\",\n",
      "      \"label\": \"Study Identifier\",\n",
      "      \"name\": \"STUDYID\",\n",
      "      \"ordinal\": \"1\",\n",
      "      \"role\": \"Identifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/DOMAIN\",\n",
      "          \"title\": \"Domain Abbreviation\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/DOMAIN\",\n",
      "          \"title\": \"Domain Abbreviation\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/DOMAIN\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.DOMAIN\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/DOMAIN\",\n",
      "          \"title\": \"Domain Abbreviation\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Two-character abbreviation for the domain.\",\n",
      "      \"label\": \"Domain Abbreviation\",\n",
      "      \"name\": \"DOMAIN\",\n",
      "      \"ordinal\": \"2\",\n",
      "      \"role\": \"Identifier\",\n",
      "      \"simpleDatatype\": \"Char\",\n",
      "      \"valueList\": [\n",
      "        \"DM\"\n",
      "      ]\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/USUBJID\",\n",
      "          \"title\": \"Unique Subject Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/USUBJID\",\n",
      "          \"title\": \"Unique Subject Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/USUBJID\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.USUBJID\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/USUBJID\",\n",
      "          \"title\": \"Unique Subject Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Identifier used to uniquely identify a subject across all studies for all applications or submissions involving the product. This must be a unique value, and could be a compound identifier formed by concatenating STUDYID-SITEID-SUBJID.\",\n",
      "      \"label\": \"Unique Subject Identifier\",\n",
      "      \"name\": \"USUBJID\",\n",
      "      \"ordinal\": \"3\",\n",
      "      \"role\": \"Identifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/SUBJID\",\n",
      "          \"title\": \"Subject Identifier for the Study\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/SUBJID\",\n",
      "          \"title\": \"Subject Identifier for the Study\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/SUBJID\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.SUBJID\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/SUBJID\",\n",
      "          \"title\": \"Subject Identifier for the Study\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Subject identifier, which must be unique within the study. Often the ID of the subject as recorded on a CRF.\",\n",
      "      \"label\": \"Subject Identifier for the Study\",\n",
      "      \"name\": \"SUBJID\",\n",
      "      \"ordinal\": \"4\",\n",
      "      \"role\": \"Topic\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFSTDTC\",\n",
      "          \"title\": \"Subject Reference Start Date/Time\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RFSTDTC\",\n",
      "          \"title\": \"Subject Reference Start Date/Time\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFSTDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFSTDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFSTDTC\",\n",
      "          \"title\": \"Subject Reference Start Date/Time\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Reference start date/time for the subject in ISO 8601 character format. Usually equivalent to date/time when subject was first exposed to study treatment. See assumption 9 for additional detail on when RFSTDTC may be null.\",\n",
      "      \"label\": \"Subject Reference Start Date/Time\",\n",
      "      \"name\": \"RFSTDTC\",\n",
      "      \"ordinal\": \"5\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFENDTC\",\n",
      "          \"title\": \"Subject Reference End Date/Time\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RFENDTC\",\n",
      "          \"title\": \"Subject Reference End Date/Time\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFENDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFENDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFENDTC\",\n",
      "          \"title\": \"Subject Reference End Date/Time\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Reference end date/time for the subject in ISO 8601 character format. Usually equivalent to the date/time when subject was determined to have ended the trial, and often equivalent to date/time of last exposure to study treatment. Required for all randomized subjects; null for screen failures or unassigned subjects.\",\n",
      "      \"label\": \"Subject Reference End Date/Time\",\n",
      "      \"name\": \"RFENDTC\",\n",
      "      \"ordinal\": \"6\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFXSTDTC\",\n",
      "          \"title\": \"Date/Time of First Study Treatment\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RFXSTDTC\",\n",
      "          \"title\": \"Date/Time of First Study Treatment\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFXSTDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFXSTDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFXSTDTC\",\n",
      "          \"title\": \"Date/Time of First Study Treatment\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"First date/time of exposure to any protocol-specified treatment or therapy, equal to the earliest value of EXSTDTC.\",\n",
      "      \"label\": \"Date/Time of First Study Treatment\",\n",
      "      \"name\": \"RFXSTDTC\",\n",
      "      \"ordinal\": \"7\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFXENDTC\",\n",
      "          \"title\": \"Date/Time of Last Study Treatment\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RFXENDTC\",\n",
      "          \"title\": \"Date/Time of Last Study Treatment\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFXENDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFXENDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFXENDTC\",\n",
      "          \"title\": \"Date/Time of Last Study Treatment\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Last date/time of exposure to any protocol-specified treatment or therapy, equal to the latest value of EXENDTC (or the latest value of EXSTDTC if EXENDTC was not collected or is missing).\",\n",
      "      \"label\": \"Date/Time of Last Study Treatment\",\n",
      "      \"name\": \"RFXENDTC\",\n",
      "      \"ordinal\": \"8\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFCSTDTC\",\n",
      "          \"title\": \"Date/Time of First Challenge Agent Admin\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFCSTDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFCSTDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFCSTDTC\",\n",
      "          \"title\": \"Date/Time of First Challenge Agent Admin\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Used only when protocol specifies a challenge agent to induce a condition that the investigational treatment is intended to cure, mitigate, treat, or prevent. Equal to the earliest value of AGSTDTC for the challenge agent.\",\n",
      "      \"label\": \"Date/Time of First Challenge Agent Admin\",\n",
      "      \"name\": \"RFCSTDTC\",\n",
      "      \"ordinal\": \"9\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFCENDTC\",\n",
      "          \"title\": \"Date/Time of Last Challenge Agent Admin\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFCENDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFCENDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFCENDTC\",\n",
      "          \"title\": \"Date/Time of Last Challenge Agent Admin\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Used only when protocol specifies a challenge agent to induce a condition that the investigational treatment is intended to cure, mitigate, treat, or prevent. Equal to the latest value of AGENDTC for the challenge agent (or the latest value of AGSTDTC if AGENDTC was not collected or is missing).\",\n",
      "      \"label\": \"Date/Time of Last Challenge Agent Admin\",\n",
      "      \"name\": \"RFCENDTC\",\n",
      "      \"ordinal\": \"10\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFICDTC\",\n",
      "          \"title\": \"Date/Time of Informed Consent\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RFICDTC\",\n",
      "          \"title\": \"Date/Time of Informed Consent\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFICDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFICDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFICDTC\",\n",
      "          \"title\": \"Date/Time of Informed Consent\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Date/time of informed consent in ISO 8601 character format. This will be the same as the date of informed consent in the Disposition domain, if that protocol milestone is documented. Would be null only in studies not collecting the date of informed consent.\",\n",
      "      \"label\": \"Date/Time of Informed Consent\",\n",
      "      \"name\": \"RFICDTC\",\n",
      "      \"ordinal\": \"11\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RFPENDTC\",\n",
      "          \"title\": \"Date/Time of End of Participation\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RFPENDTC\",\n",
      "          \"title\": \"Date/Time of End of Participation\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RFPENDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RFPENDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RFPENDTC\",\n",
      "          \"title\": \"Date/Time of End of Participation\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Date/time when subject ended participation or follow-up in a trial, as defined in the protocol, in ISO 8601 character format. Should correspond to the last known date of contact. Examples include completion date, withdrawal date, last follow-up, date recorded for lost to follow up, and death date.\",\n",
      "      \"label\": \"Date/Time of End of Participation\",\n",
      "      \"name\": \"RFPENDTC\",\n",
      "      \"ordinal\": \"12\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/DTHDTC\",\n",
      "          \"title\": \"Date/Time of Death\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/DTHDTC\",\n",
      "          \"title\": \"Date/Time of Death\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/DTHDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.DTHDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/DTHDTC\",\n",
      "          \"title\": \"Date/Time of Death\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Date/time of death for any subject who died, in ISO 8601 format. Should represent the date/time that is captured in the clinical-trial database.\",\n",
      "      \"label\": \"Date/Time of Death\",\n",
      "      \"name\": \"DTHDTC\",\n",
      "      \"ordinal\": \"13\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"codelist\": [\n",
      "          {\n",
      "            \"href\": \"/mdr/root/ct/sdtmct/codelists/C66742\",\n",
      "            \"title\": \"Version-agnostic anchor resource for codelist C66742\",\n",
      "            \"type\": \"Root Value Domain\"\n",
      "          }\n",
      "        ],\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/DTHFL\",\n",
      "          \"title\": \"Subject Death Flag\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/DTHFL\",\n",
      "          \"title\": \"Subject Death Flag\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/DTHFL\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.DTHFL\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/DTHFL\",\n",
      "          \"title\": \"Subject Death Flag\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Indicates the subject died. Should be \\\"Y\\\" or null. Should be populated even when the death date is unknown.\",\n",
      "      \"label\": \"Subject Death Flag\",\n",
      "      \"name\": \"DTHFL\",\n",
      "      \"ordinal\": \"14\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/SITEID\",\n",
      "          \"title\": \"Study Site Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/SITEID\",\n",
      "          \"title\": \"Study Site Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/SITEID\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.SITEID\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/SITEID\",\n",
      "          \"title\": \"Study Site Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Unique identifier for a site within a study.\",\n",
      "      \"label\": \"Study Site Identifier\",\n",
      "      \"name\": \"SITEID\",\n",
      "      \"ordinal\": \"15\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/INVID\",\n",
      "          \"title\": \"Investigator Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/INVID\",\n",
      "          \"title\": \"Investigator Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/INVID\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.INVID\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/INVID\",\n",
      "          \"title\": \"Investigator Identifier\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"description\": \"An identifier to describe the Investigator for the study. May be used in addition to SITEID. Not needed if SITEID is equivalent to INVID.\",\n",
      "      \"label\": \"Investigator Identifier\",\n",
      "      \"name\": \"INVID\",\n",
      "      \"ordinal\": \"16\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/INVNAM\",\n",
      "          \"title\": \"Investigator Name\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/INVNAM\",\n",
      "          \"title\": \"Investigator Name\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/INVNAM\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.INVNAM\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/INVNAM\",\n",
      "          \"title\": \"Investigator Name\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"description\": \"Name of the investigator for a site.\",\n",
      "      \"label\": \"Investigator Name\",\n",
      "      \"name\": \"INVNAM\",\n",
      "      \"ordinal\": \"17\",\n",
      "      \"role\": \"Synonym Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/BRTHDTC\",\n",
      "          \"title\": \"Date/Time of Birth\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/BRTHDTC\",\n",
      "          \"title\": \"Date/Time of Birth\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/BRTHDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.BRTHDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/BRTHDTC\",\n",
      "          \"title\": \"Date/Time of Birth\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Date/time of birth of the subject.\",\n",
      "      \"label\": \"Date/Time of Birth\",\n",
      "      \"name\": \"BRTHDTC\",\n",
      "      \"ordinal\": \"18\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/AGE\",\n",
      "          \"title\": \"Age\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/AGE\",\n",
      "          \"title\": \"Age\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/AGE\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.AGE\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/AGE\",\n",
      "          \"title\": \"Age\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Age expressed in AGEU. May be derived from RFSTDTC and BRTHDTC, but BRTHDTC may not be available in all cases (due to subject privacy concerns).\",\n",
      "      \"label\": \"Age\",\n",
      "      \"name\": \"AGE\",\n",
      "      \"ordinal\": \"19\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Num\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"codelist\": [\n",
      "          {\n",
      "            \"href\": \"/mdr/root/ct/sdtmct/codelists/C66781\",\n",
      "            \"title\": \"Version-agnostic anchor resource for codelist C66781\",\n",
      "            \"type\": \"Root Value Domain\"\n",
      "          }\n",
      "        ],\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/AGEU\",\n",
      "          \"title\": \"Age Units\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/AGEU\",\n",
      "          \"title\": \"Age Units\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/AGEU\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.AGEU\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/AGEU\",\n",
      "          \"title\": \"Age Units\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Units associated with AGE.\",\n",
      "      \"label\": \"Age Units\",\n",
      "      \"name\": \"AGEU\",\n",
      "      \"ordinal\": \"20\",\n",
      "      \"role\": \"Variable Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"codelist\": [\n",
      "          {\n",
      "            \"href\": \"/mdr/root/ct/sdtmct/codelists/C66731\",\n",
      "            \"title\": \"Version-agnostic anchor resource for codelist C66731\",\n",
      "            \"type\": \"Root Value Domain\"\n",
      "          }\n",
      "        ],\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/SEX\",\n",
      "          \"title\": \"Sex\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/SEX\",\n",
      "          \"title\": \"Sex\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/SEX\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.SEX\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/SEX\",\n",
      "          \"title\": \"Sex\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Sex of the subject.\",\n",
      "      \"label\": \"Sex\",\n",
      "      \"name\": \"SEX\",\n",
      "      \"ordinal\": \"21\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"codelist\": [\n",
      "          {\n",
      "            \"href\": \"/mdr/root/ct/sdtmct/codelists/C74457\",\n",
      "            \"title\": \"Version-agnostic anchor resource for codelist C74457\",\n",
      "            \"type\": \"Root Value Domain\"\n",
      "          }\n",
      "        ],\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/RACE\",\n",
      "          \"title\": \"Race\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/RACE\",\n",
      "          \"title\": \"Race\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/RACE\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.RACE\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/RACE\",\n",
      "          \"title\": \"Race\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Race of the subject. Sponsors should refer to the FDA guidance2 regarding the collection of race. See assumption below regarding RACE.\",\n",
      "      \"label\": \"Race\",\n",
      "      \"name\": \"RACE\",\n",
      "      \"ordinal\": \"22\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"codelist\": [\n",
      "          {\n",
      "            \"href\": \"/mdr/root/ct/sdtmct/codelists/C66790\",\n",
      "            \"title\": \"Version-agnostic anchor resource for codelist C66790\",\n",
      "            \"type\": \"Root Value Domain\"\n",
      "          }\n",
      "        ],\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ETHNIC\",\n",
      "          \"title\": \"Ethnicity\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ETHNIC\",\n",
      "          \"title\": \"Ethnicity\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ETHNIC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ETHNIC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ETHNIC\",\n",
      "          \"title\": \"Ethnicity\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"description\": \"The ethnicity of the subject. Sponsors should refer to the FDA guidance1 regarding the collection of ethnicity.\",\n",
      "      \"label\": \"Ethnicity\",\n",
      "      \"name\": \"ETHNIC\",\n",
      "      \"ordinal\": \"23\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ARMCD\",\n",
      "          \"title\": \"Planned Arm Code\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ARMCD\",\n",
      "          \"title\": \"Planned Arm Code\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ARMCD\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ARMCD\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ARMCD\",\n",
      "          \"title\": \"Planned Arm Code\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"ARMCD is limited to 20 characters. It is not subject to the character restrictions that apply to TESTCD. The maximum length of ARMCD is longer than for other \\\"short\\\" variables to accommodate the kind of values that are likely to be needed for crossover trials. For example, if ARMCD values for a 7-period crossover were constructed using 2-character abbreviations for each treatment and separating hyphens, the length of ARMCD values would be 20. If the subject was not assigned to a trial arm, ARMCD is null and ARMNRS is populated. \\\\n With the exception of studies which use multistage arm assignments, must be a value of ARMCD in the Trial Arms dataset.\",\n",
      "      \"label\": \"Planned Arm Code\",\n",
      "      \"name\": \"ARMCD\",\n",
      "      \"ordinal\": \"24\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ARM\",\n",
      "          \"title\": \"Description of Planned Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ARM\",\n",
      "          \"title\": \"Description of Planned Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ARM\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ARM\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ARM\",\n",
      "          \"title\": \"Description of Planned Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Name of the arm to which the subject was assigned. If the subject was not assigned to an arm, ARM is null and ARMNRS is populated. \\\\n With the exception of studies which use multistage arm assignments, must be a value of ARM in the Trial Arms dataset.\",\n",
      "      \"label\": \"Description of Planned Arm\",\n",
      "      \"name\": \"ARM\",\n",
      "      \"ordinal\": \"25\",\n",
      "      \"role\": \"Synonym Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ACTARMCD\",\n",
      "          \"title\": \"Actual Arm Code\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ACTARMCD\",\n",
      "          \"title\": \"Actual Arm Code\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ACTARMCD\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ACTARMCD\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ACTARMCD\",\n",
      "          \"title\": \"Actual Arm Code\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Code of actual arm. ACTARMCD is limited to 20 characters. It is not subject to the character restrictions that apply to TESTCD. The maximum length of ACTARMCD is longer than for other short variables to accommodate the kind of values that are likely to be needed for crossover trials. \\\\n With the exception of studies which use multistage arm assignments, must be a value of ARMCD in the Trial Arms dataset. \\\\n If the subject was not assigned to an arm or followed a course not described by any planned arm, ACTARMCD is null and ARMNRS is populated.\",\n",
      "      \"label\": \"Actual Arm Code\",\n",
      "      \"name\": \"ACTARMCD\",\n",
      "      \"ordinal\": \"26\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ACTARM\",\n",
      "          \"title\": \"Description of Actual Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ACTARM\",\n",
      "          \"title\": \"Description of Actual Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ACTARM\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ACTARM\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ACTARM\",\n",
      "          \"title\": \"Description of Actual Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"Description of actual arm. \\\\n With the exception of studies which use multistage arm assignments, must be a value of ARM in the Trial Arms dataset. \\\\n If the subject was not assigned to an arm or followed a course not described by any planned arm, ACTARM is null and ARMNRS is populated.\",\n",
      "      \"label\": \"Description of Actual Arm\",\n",
      "      \"name\": \"ACTARM\",\n",
      "      \"ordinal\": \"27\",\n",
      "      \"role\": \"Synonym Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"codelist\": [\n",
      "          {\n",
      "            \"href\": \"/mdr/root/ct/sdtmct/codelists/C142179\",\n",
      "            \"title\": \"Version-agnostic anchor resource for codelist C142179\",\n",
      "            \"type\": \"Root Value Domain\"\n",
      "          }\n",
      "        ],\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ARMNRS\",\n",
      "          \"title\": \"Reason Arm and/or Actual Arm is Null\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ARMNRS\",\n",
      "          \"title\": \"Reason Arm and/or Actual Arm is Null\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ARMNRS\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ARMNRS\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ARMNRS\",\n",
      "          \"title\": \"Reason Arm and/or Actual Arm is Null\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"A coded reason that arm variables (ARM and ARMCD) and/or actual arm variables (ACTARM and ACTARMCD) are null. Examples: \\\"SCREEN FAILURE\\\", \\\"NOT ASSIGNED\\\", \\\"ASSIGNED, NOT TREATED\\\", \\\"UNPLANNED TREATMENT\\\". It is assumed that if the arm and actual arm variables are null, the same reason applies to both arm and actual arm.\",\n",
      "      \"label\": \"Reason Arm and/or Actual Arm is Null\",\n",
      "      \"name\": \"ARMNRS\",\n",
      "      \"ordinal\": \"28\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/ACTARMUD\",\n",
      "          \"title\": \"Description of Unplanned Actual Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/ACTARMUD\",\n",
      "          \"title\": \"Description of Unplanned Actual Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/ACTARMUD\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.ACTARMUD\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/ACTARMUD\",\n",
      "          \"title\": \"Description of Unplanned Actual Arm\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Exp\",\n",
      "      \"description\": \"A description of actual treatment for a subject who did not receive treatment described in a planned trial arm.\",\n",
      "      \"label\": \"Description of Unplanned Actual Arm\",\n",
      "      \"name\": \"ACTARMUD\",\n",
      "      \"ordinal\": \"29\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/COUNTRY\",\n",
      "          \"title\": \"Country\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/COUNTRY\",\n",
      "          \"title\": \"Country\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/COUNTRY\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.COUNTRY\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/COUNTRY\",\n",
      "          \"title\": \"Country\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Req\",\n",
      "      \"description\": \"Country of the investigational site in which the subject participated in the trial. \\\\n \\\\n Generally represented using ISO 3166-1 Alpha-3. Note that regulatory agency specific requirements (e.g., US FDA) may require other terminologies; in such cases, follow regulatory requirements.\",\n",
      "      \"label\": \"Country\",\n",
      "      \"name\": \"COUNTRY\",\n",
      "      \"ordinal\": \"30\",\n",
      "      \"role\": \"Record Qualifier\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/DMDTC\",\n",
      "          \"title\": \"Date/Time of Collection\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/DMDTC\",\n",
      "          \"title\": \"Date/Time of Collection\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/DMDTC\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.DMDTC\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/DMDTC\",\n",
      "          \"title\": \"Date/Time of Collection\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"describedValueDomain\": \"ISO 8601 datetime or interval\",\n",
      "      \"description\": \"Date/time of demographic data collection.\",\n",
      "      \"label\": \"Date/Time of Collection\",\n",
      "      \"name\": \"DMDTC\",\n",
      "      \"ordinal\": \"31\",\n",
      "      \"role\": \"Timing\",\n",
      "      \"simpleDatatype\": \"Char\"\n",
      "    },\n",
      "    {\n",
      "      \"_links\": {\n",
      "        \"modelDatasetVariable\": {\n",
      "          \"href\": \"/mdr/sdtm/2-0/datasets/DM/variables/DMDY\",\n",
      "          \"title\": \"Study Day of Collection\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"parentDataset\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM\",\n",
      "          \"title\": \"Demographics\",\n",
      "          \"type\": \"SDTM Dataset\"\n",
      "        },\n",
      "        \"parentProduct\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4\",\n",
      "          \"title\": \"Study Data Tabulation Model Implementation Guide: Human Clinical Trials\",\n",
      "          \"type\": \"Implementation Guide\"\n",
      "        },\n",
      "        \"priorVersion\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-3/datasets/DM/variables/DMDY\",\n",
      "          \"title\": \"Study Day of Collection\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        },\n",
      "        \"rootItem\": {\n",
      "          \"href\": \"/mdr/root/sdtmig/datasets/DM/variables/DMDY\",\n",
      "          \"title\": \"Version-agnostic anchor resource for SDTMIG variable DM.DMDY\",\n",
      "          \"type\": \"Root Data Element\"\n",
      "        },\n",
      "        \"self\": {\n",
      "          \"href\": \"/mdr/sdtmig/3-4/datasets/DM/variables/DMDY\",\n",
      "          \"title\": \"Study Day of Collection\",\n",
      "          \"type\": \"SDTM Dataset Variable\"\n",
      "        }\n",
      "      },\n",
      "      \"core\": \"Perm\",\n",
      "      \"description\": \"Study day of collection measured as integer days.\",\n",
      "      \"label\": \"Study Day of Collection\",\n",
      "      \"name\": \"DMDY\",\n",
      "      \"ordinal\": \"32\",\n",
      "      \"role\": \"Timing\",\n",
      "      \"simpleDatatype\": \"Num\"\n",
      "    }\n",
      "  ],\n",
      "  \"description\": \"A special-purpose domain that includes a set of essential standard variables that describe each subject in a clinical study. It is the parent domain for all other observations for human clinical subjects.\",\n",
      "  \"label\": \"Demographics\",\n",
      "  \"name\": \"DM\",\n",
      "  \"ordinal\": \"12\"\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "#JSON(data, expanded=True)\n",
    "print(json.dumps(data, indent=2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### SDTM IG 3.4 Domain - DM Variable List"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "# show dataset variables\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/{standard}/{standard_version}/datasets/{dataset_name}/variables\"\n",
    "\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "datasetVariables": [
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/STUDYID",
          "title": "Study Identifier",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/DOMAIN",
          "title": "Domain Abbreviation",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/USUBJID",
          "title": "Unique Subject Identifier",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/SUBJID",
          "title": "Subject Identifier for the Study",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFSTDTC",
          "title": "Subject Reference Start Date/Time",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFENDTC",
          "title": "Subject Reference End Date/Time",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFXSTDTC",
          "title": "Date/Time of First Study Treatment",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFXENDTC",
          "title": "Date/Time of Last Study Treatment",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFCSTDTC",
          "title": "Date/Time of First Challenge Agent Admin",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFCENDTC",
          "title": "Date/Time of Last Challenge Agent Admin",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFICDTC",
          "title": "Date/Time of Informed Consent",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RFPENDTC",
          "title": "Date/Time of End of Participation",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/DTHDTC",
          "title": "Date/Time of Death",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/DTHFL",
          "title": "Subject Death Flag",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/SITEID",
          "title": "Study Site Identifier",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/INVID",
          "title": "Investigator Identifier",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/INVNAM",
          "title": "Investigator Name",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/BRTHDTC",
          "title": "Date/Time of Birth",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/AGE",
          "title": "Age",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/AGEU",
          "title": "Age Units",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/SEX",
          "title": "Sex",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/RACE",
          "title": "Race",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ETHNIC",
          "title": "Ethnicity",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ARMCD",
          "title": "Planned Arm Code",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ARM",
          "title": "Description of Planned Arm",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ACTARMCD",
          "title": "Actual Arm Code",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ACTARM",
          "title": "Description of Actual Arm",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ARMNRS",
          "title": "Reason Arm and/or Actual Arm is Null",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/ACTARMUD",
          "title": "Description of Unplanned Actual Arm",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/COUNTRY",
          "title": "Country",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/DMDTC",
          "title": "Date/Time of Collection",
          "type": "SDTM Dataset Variable"
         },
         {
          "href": "/mdr/sdtmig/3-4/datasets/DM/variables/DMDY",
          "title": "Study Day of Collection",
          "type": "SDTM Dataset Variable"
         }
        ],
        "modelDataset": {
         "href": "/mdr/sdtm/2-0/datasets/DM",
         "title": "Demographics",
         "type": "SDTM Dataset"
        },
        "parentClass": {
         "href": "/mdr/sdtmig/3-4/classes/SpecialPurpose",
         "title": "Special-Purpose",
         "type": "Class"
        },
        "parentProduct": {
         "href": "/mdr/sdtmig/3-4",
         "title": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
         "type": "Implementation Guide"
        },
        "priorVersion": {
         "href": "/mdr/sdtmig/3-3/datasets/DM/variables",
         "title": "Demographics",
         "type": "SDTMIG Dataset Variable List"
        },
        "self": {
         "href": "/mdr/sdtmig/3-4/datasets/DM/variables",
         "title": "Demographics",
         "type": "SDTMIG Dataset Variable List"
        }
       },
       "datasetStructure": "One record per subject",
       "description": "A special-purpose domain that includes a set of essential standard variables that describe each subject in a clinical study. It is the parent domain for all other observations for human clinical subjects.",
       "label": "Demographics",
       "name": "DM",
       "ordinal": "12"
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 10,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### SDTM IG 3.4 Domain - DM.USUBJID Variable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "# show specific variable details\n",
    "variable_name = \"USUBJID\"\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/{standard}/{standard_version}/datasets/{dataset_name}/variables/{variable_name}\"\n",
    "\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "modelDatasetVariable": {
         "href": "/mdr/sdtm/2-0/datasets/DM/variables/USUBJID",
         "title": "Unique Subject Identifier",
         "type": "SDTM Dataset Variable"
        },
        "parentDataset": {
         "href": "/mdr/sdtmig/3-4/datasets/DM",
         "title": "Demographics",
         "type": "SDTM Dataset"
        },
        "parentProduct": {
         "href": "/mdr/sdtmig/3-4",
         "title": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
         "type": "Implementation Guide"
        },
        "priorVersion": {
         "href": "/mdr/sdtmig/3-3/datasets/DM/variables/USUBJID",
         "title": "Unique Subject Identifier",
         "type": "SDTM Dataset Variable"
        },
        "rootItem": {
         "href": "/mdr/root/sdtmig/datasets/DM/variables/USUBJID",
         "title": "Version-agnostic anchor resource for SDTMIG variable DM.USUBJID",
         "type": "Root Data Element"
        },
        "self": {
         "href": "/mdr/sdtmig/3-4/datasets/DM/variables/USUBJID",
         "title": "Unique Subject Identifier",
         "type": "SDTM Dataset Variable"
        }
       },
       "core": "Req",
       "description": "Identifier used to uniquely identify a subject across all studies for all applications or submissions involving the product. This must be a unique value, and could be a compound identifier formed by concatenating STUDYID-SITEID-SUBJID.",
       "label": "Unique Subject Identifier",
       "name": "USUBJID",
       "ordinal": "3",
       "role": "Identifier",
       "simpleDatatype": "Char"
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 12,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### SDTM IG 3.4 Domain - DM.SEX Variable, with Code List"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "# show specific variable details with CT\n",
    "variable_name = \"SEX\"\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/{standard}/{standard_version}/datasets/{dataset_name}/variables/{variable_name}\"\n",
    "\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "codelist": [
         {
          "href": "/mdr/root/ct/sdtmct/codelists/C66731",
          "title": "Version-agnostic anchor resource for codelist C66731",
          "type": "Root Value Domain"
         }
        ],
        "modelDatasetVariable": {
         "href": "/mdr/sdtm/2-0/datasets/DM/variables/SEX",
         "title": "Sex",
         "type": "SDTM Dataset Variable"
        },
        "parentDataset": {
         "href": "/mdr/sdtmig/3-4/datasets/DM",
         "title": "Demographics",
         "type": "SDTM Dataset"
        },
        "parentProduct": {
         "href": "/mdr/sdtmig/3-4",
         "title": "Study Data Tabulation Model Implementation Guide: Human Clinical Trials",
         "type": "Implementation Guide"
        },
        "priorVersion": {
         "href": "/mdr/sdtmig/3-3/datasets/DM/variables/SEX",
         "title": "Sex",
         "type": "SDTM Dataset Variable"
        },
        "rootItem": {
         "href": "/mdr/root/sdtmig/datasets/DM/variables/SEX",
         "title": "Version-agnostic anchor resource for SDTMIG variable DM.SEX",
         "type": "Root Data Element"
        },
        "self": {
         "href": "/mdr/sdtmig/3-4/datasets/DM/variables/SEX",
         "title": "Sex",
         "type": "SDTM Dataset Variable"
        }
       },
       "core": "Req",
       "description": "Sex of the subject.",
       "label": "Sex",
       "name": "SEX",
       "ordinal": "21",
       "role": "Record Qualifier",
       "simpleDatatype": "Char"
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 14,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "[encoded data, 415036 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "SEX变量的收款术语\n",
    "\n",
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Code List, SEX"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "# CT, SEX\n",
    "\n",
    "ct_type = \"sdtmct\"\n",
    "ct_version = \"2025-09-26\"\n",
    "ct_codelist = \"C66731\"\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/root/ct/{ct_type}/codelists/{ct_codelist}\"\n",
    "\n",
    "ct_package= \"sdtmct-2025-09-26\"\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/ct/packages/{ct_package}/codelists/{ct_codelist}\"\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "parentPackage": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26",
         "title": "SDTM Controlled Terminology Package 60 Effective 2025-09-26",
         "type": "Terminology"
        },
        "priorVersion": {
         "href": "/mdr/ct/packages/sdtmct-2025-03-28/codelists/C66731",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Code List"
        },
        "rootItem": {
         "href": "/mdr/root/ct/sdtmct/codelists/C66731",
         "title": "Version-agnostic anchor resource for codelist C66731",
         "type": "Root Value Domain"
        },
        "self": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Code List"
        }
       },
       "conceptId": "C66731",
       "definition": "A terminology codelist relevant to the assemblage of physical properties or qualities by which male is distinguished from female; the physical difference between male and female; the distinguishing peculiarity of male or female.",
       "extensible": "false",
       "name": "Sex",
       "preferredTerm": "CDISC SDTM Sex of Individual Terminology",
       "submissionValue": "SEX",
       "synonyms": [
        "Sex"
       ],
       "terms": [
        {
         "conceptId": "C16576",
         "definition": "A person who belongs to the sex that normally produces ova. The term is used to indicate biological sex distinctions, or cultural gender role distinctions, or both. [The NCI Thesaurus contains biomedical terminologies that NCI does not own or control. This concept contains gender-related content that does not comply with Executive Order 14168.]",
         "preferredTerm": "Female",
         "submissionValue": "F",
         "synonyms": [
          "Female"
         ]
        },
        {
         "conceptId": "C45908",
         "definition": "A person (one of unisexual specimens) who is born with genitalia and/or secondary sexual characteristics of indeterminate sex, or which combine features of both sexes. (NCI)",
         "preferredTerm": "Intersex",
         "submissionValue": "INTERSEX"
        },
        {
         "conceptId": "C20197",
         "definition": "A person who belongs to the sex that normally produces sperm. The term is used to indicate biological sex distinctions, cultural gender role distinctions, or both. [The NCI Thesaurus contains biomedical terminologies that NCI does not own or control. This concept contains gender-related content that does not comply with Executive Order 14168.]",
         "preferredTerm": "Male",
         "submissionValue": "M",
         "synonyms": [
          "Male"
         ]
        },
        {
         "conceptId": "C17998",
         "definition": "Not known, not observed, not recorded, or refused. (NCI)",
         "preferredTerm": "Unknown",
         "submissionValue": "U",
         "synonyms": [
          "U",
          "UNK",
          "Unknown"
         ]
        }
       ]
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 16,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Code List, SEX, term list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "# show specific CT codelist details\n",
    "ct_type = \"sdtmct\"\n",
    "ct_package= \"sdtmct-2025-09-26\"\n",
    "ct_codelist = \"C66731\"\n",
    "\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/ct/packages/{ct_package}/codelists/{ct_codelist}\"\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "parentPackage": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26",
         "title": "SDTM Controlled Terminology Package 60 Effective 2025-09-26",
         "type": "Terminology"
        },
        "priorVersion": {
         "href": "/mdr/ct/packages/sdtmct-2025-03-28/codelists/C66731",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Code List"
        },
        "rootItem": {
         "href": "/mdr/root/ct/sdtmct/codelists/C66731",
         "title": "Version-agnostic anchor resource for codelist C66731",
         "type": "Root Value Domain"
        },
        "self": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Code List"
        }
       },
       "conceptId": "C66731",
       "definition": "A terminology codelist relevant to the assemblage of physical properties or qualities by which male is distinguished from female; the physical difference between male and female; the distinguishing peculiarity of male or female.",
       "extensible": "false",
       "name": "Sex",
       "preferredTerm": "CDISC SDTM Sex of Individual Terminology",
       "submissionValue": "SEX",
       "synonyms": [
        "Sex"
       ],
       "terms": [
        {
         "conceptId": "C16576",
         "definition": "A person who belongs to the sex that normally produces ova. The term is used to indicate biological sex distinctions, or cultural gender role distinctions, or both. [The NCI Thesaurus contains biomedical terminologies that NCI does not own or control. This concept contains gender-related content that does not comply with Executive Order 14168.]",
         "preferredTerm": "Female",
         "submissionValue": "F",
         "synonyms": [
          "Female"
         ]
        },
        {
         "conceptId": "C45908",
         "definition": "A person (one of unisexual specimens) who is born with genitalia and/or secondary sexual characteristics of indeterminate sex, or which combine features of both sexes. (NCI)",
         "preferredTerm": "Intersex",
         "submissionValue": "INTERSEX"
        },
        {
         "conceptId": "C20197",
         "definition": "A person who belongs to the sex that normally produces sperm. The term is used to indicate biological sex distinctions, cultural gender role distinctions, or both. [The NCI Thesaurus contains biomedical terminologies that NCI does not own or control. This concept contains gender-related content that does not comply with Executive Order 14168.]",
         "preferredTerm": "Male",
         "submissionValue": "M",
         "synonyms": [
          "Male"
         ]
        },
        {
         "conceptId": "C17998",
         "definition": "Not known, not observed, not recorded, or refused. (NCI)",
         "preferredTerm": "Unknown",
         "submissionValue": "U",
         "synonyms": [
          "U",
          "UNK",
          "Unknown"
         ]
        }
       ]
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 18,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "ct_type = \"sdtmct\"\n",
    "ct_package= \"sdtmct-2025-09-26\"\n",
    "ct_codelist = \"C66731\"\n",
    "\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/ct/packages/{ct_package}/codelists/{ct_codelist}/terms\"\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "parentPackage": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26",
         "title": "SDTM Controlled Terminology Package 60 Effective 2025-09-26",
         "type": "Terminology"
        },
        "priorVersion": {
         "href": "/mdr/ct/packages/sdtmct-2025-03-28/codelists/C66731/terms",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Codelist Term List"
        },
        "rootItem": {
         "href": "/mdr/root/ct/sdtmct/codelists/C66731",
         "title": "Version-agnostic anchor resource for codelist C66731",
         "type": "Root Value Domain"
        },
        "self": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Codelist Term List"
        },
        "terms": [
         {
          "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms/C16576",
          "title": "Female",
          "type": "Code List Value"
         },
         {
          "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms/C45908",
          "title": "Intersex",
          "type": "Code List Value"
         },
         {
          "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms/C20197",
          "title": "Male",
          "type": "Code List Value"
         },
         {
          "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms/C17998",
          "title": "Unknown",
          "type": "Code List Value"
         }
        ]
       },
       "conceptId": "C66731",
       "definition": "A terminology codelist relevant to the assemblage of physical properties or qualities by which male is distinguished from female; the physical difference between male and female; the distinguishing peculiarity of male or female.",
       "extensible": "false",
       "name": "Sex",
       "preferredTerm": "CDISC SDTM Sex of Individual Terminology",
       "submissionValue": "SEX",
       "synonyms": [
        "Sex"
       ]
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 20,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "[encoded data, 329552 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Code List, SEX, term Female"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "# show specific CT term details\n",
    "ct_type = \"sdtmct\"\n",
    "ct_package= \"sdtmct-2025-09-26\"\n",
    "ct_codelist = \"C66731\"\n",
    "ct_term = \"C16576\"\n",
    "\n",
    "url = f\"https://api.library.cdisc.org/api/mdr/ct/packages/{ct_package}/codelists/{ct_codelist}/terms/{ct_term}\"\n",
    "params = {\"accept\": \"application/json\", \"api-key\":api_key}\n",
    "response = requests.get(url, params=params)\n",
    "\n",
    "print(response.status_code)\n",
    "\n",
    "if response.status_code == 200:\n",
    "    data = response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "_links": {
        "parentCodelist": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731",
         "title": "CDISC SDTM Sex of Individual Terminology",
         "type": "Code List"
        },
        "parentPackage": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26",
         "title": "SDTM Controlled Terminology Package 60 Effective 2025-09-26",
         "type": "Terminology"
        },
        "priorVersion": {
         "href": "/mdr/ct/packages/sdtmct-2025-03-28/codelists/C66731/terms/C16576",
         "title": "Female",
         "type": "Code List Value"
        },
        "rootItem": {
         "href": "/mdr/root/ct/sdtmct/codelists/C66731/terms/C16576",
         "title": "Version-agnostic anchor resource for codelist term C66731.C16576",
         "type": "Root Value"
        },
        "self": {
         "href": "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms/C16576",
         "title": "Female",
         "type": "Code List Value"
        }
       },
       "conceptId": "C16576",
       "definition": "A person who belongs to the sex that normally produces ova. The term is used to indicate biological sex distinctions, or cultural gender role distinctions, or both. [The NCI Thesaurus contains biomedical terminologies that NCI does not own or control. This concept contains gender-related content that does not comply with Executive Order 14168.]",
       "preferredTerm": "Female",
       "submissionValue": "F",
       "synonyms": [
        "Female"
       ]
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 29,
     "metadata": {
      "application/json": {
       "expanded": true,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "JSON(data, expanded=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 提取json格式数据中的节点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A person who belongs to the sex that normally produces ova. The term is used to indicate biological sex distinctions, or cultural gender role distinctions, or both. [The NCI Thesaurus contains biomedical terminologies that NCI does not own or control. This concept contains gender-related content that does not comply with Executive Order 14168.]\n"
     ]
    }
   ],
   "source": [
    "print(data[\"definition\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "F\n"
     ]
    }
   ],
   "source": [
    "print(data[\"submissionValue\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Female\n"
     ]
    }
   ],
   "source": [
    "print(data[\"preferredTerm\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/mdr/ct/packages/sdtmct-2025-09-26/codelists/C66731/terms/C16576\n"
     ]
    }
   ],
   "source": [
    "print(data[\"_links\"][\"self\"][\"href\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Female\n"
     ]
    }
   ],
   "source": [
    "print(data[\"_links\"][\"self\"][\"title\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3）有啥用？"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "a)和公司自己的MDR同步\n",
    "b)对比不同版本差异，升级版本时用。\n",
    "c)和AI协调。 让AI调用用CDISC的内容。 MCP 服务。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "References:\n",
    "\n",
    "CDISC Library: https://www.cdisc.org/cdisc-library\n",
    "Get Started: https://www.cdisc.org/cdisc-library/getting-started\n"
   ]
  },
  {
   "attachments": {
    "image-2.png": {
     "image/png": "[encoded data, 493984 characters]"
    },
    "image.png": {
     "image/png": "[encoded data, 750760 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "MCP\n",
    "\n",
    "![image.png](attachment:image.png)\n",
    "\n",
    "\n",
    "![image-2.png](attachment:image-2.png)"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "[encoded data, 2162248 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "[encoded data, 182944 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![image.png](attachment:image.png)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "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.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
