﻿{
    "cells":  [
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "# Module 9 Self-Driven Lab\n",
                                     "\n",
                                     "Use this notebook as your workspace for **Compliance \u0026 Data Privacy**. The answer-key notebook sits next to this file. Work through each checkpoint before comparing against the completed version.\n"
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "# Module 9 â€” Compliance \u0026 Data Privacy\n",
                                     "\n",
                                     "Three things to internalize before deploying to a regulated client:\n",
                                     "\n",
                                     "1. The **ZDR eligibility matrix** â€” which features keep zero data retention, which don\u0027t.\n",
                                     "2. **HIPAA schema-caching risk** â€” never put PHI in tool/output schemas; their cache lifetime differs from message content.\n",
                                     "3. The **1.1Ã— US-inference multiplier** â€” how `inference_geo: \"us\"` affects price and Priority-Tier burndown."
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "## 1. ZDR matrix as a queryable dict\n",
                                     "\n",
                                     "Run this cell to look up any feature\u0027s ZDR status without re-reading the table."
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "## Checkpoint 1\n",
                                     "\n",
                                     "Implement this step yourself. Use the preceding explanation and the module page as your guide, then compare your approach with the answer key after you have a working version.\n"
                                 ]
                  },
                  {
                      "cell_type":  "code",
                      "execution_count":  null,
                      "metadata":  {

                                   },
                      "outputs":  [

                                  ],
                      "source":  [
                                     "# TODO: Implement checkpoint 1 for Module 9.\n",
                                     "# Keep the cell focused, run it, inspect the output, then move to the next checkpoint.\n",
                                     "\n",
                                     "raise NotImplementedError(\u0027Complete checkpoint 1\u0027)\n"
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "## 2. HIPAA-safe schema (generic field names)\n",
                                     "\n",
                                     "Schema property names are compiled and cached separately from message content. Real PHI values must only ever appear in message content â€” never in field names or descriptions."
                                 ]
                  },
                  {
                      "cell_type":  "code",
                      "execution_count":  null,
                      "metadata":  {

                                   },
                      "outputs":  [

                                  ],
                      "source":  [
                                     "# Setup cell. Run this before the exercise cells below.\n",
                                     "# BAD â€” PHI-shaped names leak through schema cache:\n",
                                     "bad = {\"properties\": {\"patient_id\": {\"type\": \"string\"}, \"diagnosis_code\": {\"type\": \"string\"}}}\n",
                                     "\n",
                                     "# GOOD â€” generic names; PHI values still flow through message content only:\n",
                                     "good = {\"properties\": {\"record_id\":  {\"type\": \"string\"}, \"category_code\":  {\"type\": \"string\"}}}\n",
                                     "\n",
                                     "import json\n",
                                     "print(\"BAD:\\n\",  json.dumps(bad, indent=2))\n",
                                     "print(\"GOOD:\\n\", json.dumps(good, indent=2))"
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "## 3. Cost impact of `inference_geo: \"us\"`\n",
                                     "\n",
                                     "The 1.1Ã— multiplier applies to **Opus 4.6 and above** (not Haiku or Sonnet below that threshold). It also affects Priority-Tier burndown â€” every token counts as 1.1 against committed TPM. Use the helper below to estimate the markup on a workload."
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "## Checkpoint 2\n",
                                     "\n",
                                     "Implement this step yourself. Use the preceding explanation and the module page as your guide, then compare your approach with the answer key after you have a working version.\n"
                                 ]
                  },
                  {
                      "cell_type":  "code",
                      "execution_count":  null,
                      "metadata":  {

                                   },
                      "outputs":  [

                                  ],
                      "source":  [
                                     "# TODO: Implement checkpoint 2 for Module 9.\n",
                                     "# Keep the cell focused, run it, inspect the output, then move to the next checkpoint.\n",
                                     "\n",
                                     "raise NotImplementedError(\u0027Complete checkpoint 2\u0027)\n"
                                 ]
                  },
                  {
                      "cell_type":  "markdown",
                      "metadata":  {

                                   },
                      "source":  [
                                     "## Reflection\n",
                                     "\n",
                                     "Before opening the answer key, write down what worked, what failed, and which API behavior or agent-design rule you would rely on in production.\n"
                                 ]
                  }
              ],
    "metadata":  {
                     "kernelspec":  {
                                        "display_name":  "Python 3",
                                        "language":  "python",
                                        "name":  "python3"
                                    },
                     "language_info":  {
                                           "name":  "python",
                                           "version":  "3.9"
                                       }
                 },
    "nbformat":  4,
    "nbformat_minor":  5
}
