|
292 | 292 | "This workflow-centric view fundamentally shapes normalization principles and explains why DataJoint emphasizes immutability and avoidance of updates.\n" |
293 | 293 | ] |
294 | 294 | }, |
295 | | - { |
296 | | - "cell_type": "markdown", |
297 | | - "metadata": {}, |
298 | | - "source": [ |
299 | | - "## Practical Example: Animal Research Lab\n", |
300 | | - "\n", |
301 | | - "Let's apply these principles to design a schema for tracking mice in a research lab.\n", |
302 | | - "\n", |
303 | | - "### ❌ Poor Design (Violates Normalization)\n", |
304 | | - "\n", |
305 | | - "```python\n", |
306 | | - "@schema\n", |
307 | | - "class Mouse(dj.Manual):\n", |
308 | | - " definition = \"\"\"\n", |
309 | | - " mouse_id : int\n", |
310 | | - " ---\n", |
311 | | - " date_of_birth : date # ✓ Permanent property of mouse\n", |
312 | | - " sex : enum('M', 'F') # ✓ Permanent property of mouse\n", |
313 | | - " cage_id : int # ✗ CHANGEABLE - violates Rule 3\n", |
314 | | - " current_weight : decimal(5,2) # ✗ CHANGEABLE - violates Rule 3\n", |
315 | | - " cage_location : varchar(50) # ✗ Property of CAGE, not mouse - violates Rule 2\n", |
316 | | - " cage_capacity : int # ✗ Property of CAGE, not mouse - violates Rule 2\n", |
317 | | - " \"\"\"\n", |
318 | | - "```" |
319 | | - ] |
320 | | - }, |
321 | 295 | { |
322 | 296 | "cell_type": "markdown", |
323 | 297 | "metadata": {}, |
|
623 | 597 | "**UPDATE exists** for the rare cases when data corruption or entry errors must be corrected surgically. It's a maintenance tool, not an operational tool.\n" |
624 | 598 | ] |
625 | 599 | }, |
| 600 | + { |
| 601 | + "cell_type": "markdown", |
| 602 | + "metadata": {}, |
| 603 | + "source": [ |
| 604 | + "## Practical Example: Animal Research Lab\n", |
| 605 | + "\n", |
| 606 | + "Let's apply these principles to design a schema for tracking mice in a research lab.\n", |
| 607 | + "\n", |
| 608 | + "### ❌ Poor Design (Violates Normalization)\n", |
| 609 | + "\n", |
| 610 | + "```python\n", |
| 611 | + "@schema\n", |
| 612 | + "class Mouse(dj.Manual):\n", |
| 613 | + " definition = \"\"\"\n", |
| 614 | + " mouse_id : int\n", |
| 615 | + " ---\n", |
| 616 | + " date_of_birth : date # ✓ Permanent property of mouse\n", |
| 617 | + " sex : enum('M', 'F') # ✓ Permanent property of mouse\n", |
| 618 | + " cage_id : int # ✗ CHANGEABLE - violates Rule 3\n", |
| 619 | + " current_weight : decimal(5,2) # ✗ CHANGEABLE - violates Rule 3\n", |
| 620 | + " cage_location : varchar(50) # ✗ Property of CAGE, not mouse - violates Rule 2\n", |
| 621 | + " cage_capacity : int # ✗ Property of CAGE, not mouse - violates Rule 2\n", |
| 622 | + " \"\"\"\n", |
| 623 | + "```" |
| 624 | + ] |
| 625 | + }, |
626 | 626 | { |
627 | 627 | "cell_type": "markdown", |
628 | 628 | "metadata": {}, |
|
0 commit comments