Skip to content

Commit cd278bf

Browse files
Merge pull request #13 from dimitri-yatsenko/main
Harmonize exercises.
2 parents a7dbc84 + 3bab8a9 commit cd278bf

File tree

6 files changed

+25
-1298
lines changed

6 files changed

+25
-1298
lines changed

book/80-examples/000-example-designs.ipynb

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -8,105 +8,7 @@
88
{
99
"cell_type": "markdown",
1010
"metadata": {},
11-
"source": [
12-
"## Overview of Examples\n",
13-
"\n",
14-
"This section presents a variety of schema examples that demonstrate different aspects of DataJoint design principles. Each example showcases specific patterns, relationships, and use cases ranging from classic database tutorials to real-world scientific applications.\n",
15-
"\n",
16-
"### Classic Database Examples\n",
17-
"\n",
18-
"These examples are adapted from well-known database tutorials to show how traditional relational designs map to DataJoint's entity-workflow model.\n",
19-
"\n",
20-
"#### [Classic Sales Database](010-classic-sales.ipynb)\n",
21-
"The classic MySQL tutorial sales database featuring customers, orders, products, and employees. This example demonstrates:\n",
22-
"- Traditional business database design\n",
23-
"- Many-to-many relationships through order details\n",
24-
"- Employee management hierarchies\n",
25-
"- Product lines and order fulfillment\n",
26-
"\n",
27-
"#### [University Database](015-university.ipynb)\n",
28-
"A university course enrollment system with students, courses, instructors, and enrollments. This example illustrates:\n",
29-
"- Academic record keeping\n",
30-
"- Course registration workflows\n",
31-
"- Student-course many-to-many relationships\n",
32-
"- Grade tracking and prerequisites\n",
33-
"\n",
34-
"#### [Nations Database](030-nations.ipynb)\n",
35-
"A geographical database with countries, regions, and continents from the MariaDB tutorial. This example shows:\n",
36-
"- Hierarchical geographical relationships\n",
37-
"- Lookup tables for standardized data\n",
38-
"- Regional groupings and classifications\n",
39-
"\n",
40-
"### Conceptual Examples\n",
41-
"\n",
42-
"These examples focus on specific design patterns and conceptual challenges in database modeling.\n",
43-
"\n",
44-
"#### [Hotel Reservation System](040-hotel.ipynb)\n",
45-
"A complete hotel management system with rooms, reservations, check-ins, and check-outs. This design exercise demonstrates:\n",
46-
"- Time-series data (room availability and pricing)\n",
47-
"- Business rule enforcement (no double-booking, check-in requires reservation)\n",
48-
"- Guest management and payment processing\n",
49-
"- Temporal queries (who stayed when, room history)\n",
50-
"\n",
51-
"#### [Social Generations](044-generations.ipynb)\n",
52-
"Defines social generations as birth cohorts sharing cultural and historical experiences. This example explores:\n",
53-
"- Lookup tables for reference data\n",
54-
"- Birth year ranges and generational characteristics\n",
55-
"- Cultural archetypes and life principles\n",
56-
"- Using DataJoint to model sociological concepts\n",
57-
"\n",
58-
"#### [Languages and Proficiency](050-languages.ipynb)\n",
59-
"A many-to-many relationship design tracking people and their language skills using international standards. This comprehensive example demonstrates:\n",
60-
"- **ISO 639-1 language codes**: Standardized two-letter codes for major world languages\n",
61-
"- **CEFR proficiency levels**: Common European Framework of Reference for Languages (A1-C2)\n",
62-
"- **Association tables**: `Proficiency` as a workflow step linking people, languages, and levels\n",
63-
"- **Lookup tables**: Both `Language` and `CEFRLevel` with predefined, standardized content\n",
64-
"- **International standards**: Using established frameworks ensures consistency and compatibility\n",
65-
"- **Sample queries**: Finding multilingual individuals, proficient speakers, and language statistics\n",
66-
"\n",
67-
"### Organizational Examples\n",
68-
"\n",
69-
"These examples model organizational structures and hierarchies.\n",
70-
"\n",
71-
"#### [Management Hierarchy](060-management.ipynb)\n",
72-
"Demonstrates self-referencing tables and organizational relationships. This example shows:\n",
73-
"- Employees managing other employees (recursive relationships)\n",
74-
"- Department structure with chairs and budgets\n",
75-
"- Organizational hierarchies and reporting chains\n",
76-
"- One-to-one relationships (department chairs)\n",
77-
"- Normalized department data (codes, names, budgets, locations)\n",
78-
"\n",
79-
"### Scientific Examples\n",
80-
"\n",
81-
"Real-world scientific applications demonstrating DataJoint in research contexts.\n",
82-
"\n",
83-
"#### [Allen Common Coordinate Framework](065-allen-ccf.ipynb)\n",
84-
"The Allen Brain Atlas coordinate system for mouse brain anatomy. This example illustrates:\n",
85-
"- 3D spatial coordinates and brain structure atlases\n",
86-
"- Hierarchical anatomical relationships\n",
87-
"- Integration with neuroimaging data\n",
88-
"- Real scientific data pipeline from the DataJoint Elements project\n",
89-
"- Published standards in neuroscience research\n",
90-
"\n",
91-
"#### [Julia Sets](070-julia.ipynb)\n",
92-
"Computational visualization of Julia sets from fractal mathematics. This example demonstrates:\n",
93-
"- Computed tables for mathematical functions\n",
94-
"- Parameter spaces and computational workflows\n",
95-
"- Image generation and visualization\n",
96-
"- Using DataJoint for reproducible computational art\n",
97-
"- Automatic computation with `populate()`\n",
98-
"\n",
99-
"---\n",
100-
"\n",
101-
"Each example is self-contained with:\n",
102-
"- Complete schema definitions\n",
103-
"- Sample data population\n",
104-
"- Example queries demonstrating key concepts\n",
105-
"- Visual diagrams showing table relationships\n",
106-
"- Code that you can run and modify\n",
107-
"\n",
108-
"Browse through these examples to see different design patterns in action and learn how to apply DataJoint principles to your own domains.\n"
109-
]
11+
"source": "## Overview of Examples\n\nThis section presents a variety of schema examples that demonstrate different aspects of DataJoint design principles. Each example showcases specific patterns, relationships, and use cases ranging from classic database tutorials to real-world scientific applications.\n\n### Classic Database Examples\n\nThese examples are adapted from well-known database tutorials to show how traditional relational designs map to DataJoint's entity-workflow model.\n\n#### [Classic Sales Database](010-classic-sales.ipynb)\nThe classic MySQL tutorial sales database featuring customers, orders, products, and employees. This example demonstrates:\n- Traditional business database design\n- Many-to-many relationships through order details\n- Employee management hierarchies\n- Product lines and order fulfillment\n\n#### [University Database](015-university.ipynb)\nA university course enrollment system with students, courses, instructors, and enrollments. This example illustrates:\n- Academic record keeping\n- Course registration workflows\n- Student-course many-to-many relationships\n- Grade tracking and prerequisites\n\n#### [Nations Database](030-nations.ipynb)\nA geographical database with countries, regions, and continents from the MariaDB tutorial. This example shows:\n- Hierarchical geographical relationships\n- Lookup tables for standardized data\n- Regional groupings and classifications\n\n### Conceptual Examples\n\nThese examples focus on specific design patterns and conceptual challenges in database modeling.\n\n#### [Hotel Reservation System](040-hotel.ipynb)\nA complete hotel management system with rooms, reservations, check-ins, and check-outs. This design exercise demonstrates:\n- Time-series data (room availability and pricing)\n- Business rule enforcement (no double-booking, check-in requires reservation)\n- Guest management and payment processing\n- Temporal queries (who stayed when, room history)\n\n#### [Social Generations](044-generations.ipynb)\nDefines social generations as birth cohorts sharing cultural and historical experiences. This example explores:\n- Lookup tables for reference data\n- Birth year ranges and generational characteristics\n- Cultural archetypes and life principles\n- Using DataJoint to model sociological concepts\n\n#### [Languages and Proficiency](050-languages.ipynb)\nA many-to-many relationship design tracking people and their language skills using international standards. This comprehensive example demonstrates:\n- **ISO 639-1 language codes**: Standardized two-letter codes for major world languages\n- **CEFR proficiency levels**: Common European Framework of Reference for Languages (A1-C2)\n- **Association tables**: `Proficiency` as a workflow step linking people, languages, and levels\n- **Lookup tables**: Both `Language` and `CEFRLevel` with predefined, standardized content\n- **International standards**: Using established frameworks ensures consistency and compatibility\n- **Sample queries**: Finding multilingual individuals, proficient speakers, and language statistics\n\n### Organizational Examples\n\nThese examples model organizational structures and hierarchies.\n\n#### [Management Hierarchy](060-management.ipynb)\nDemonstrates self-referencing tables and organizational relationships. This example shows:\n- Employees managing other employees (recursive relationships)\n- Department structure with chairs and budgets\n- Organizational hierarchies and reporting chains\n- One-to-one relationships (department chairs)\n- Normalized department data (codes, names, budgets, locations)\n\n### Scientific Examples\n\nReal-world scientific applications demonstrating DataJoint in research contexts.\n\n#### [Allen Common Coordinate Framework](065-allen-ccf.ipynb)\nThe Allen Brain Atlas coordinate system for mouse brain anatomy. This example illustrates:\n- 3D spatial coordinates and brain structure atlases\n- Hierarchical anatomical relationships\n- Integration with neuroimaging data\n- Real scientific data pipeline from the DataJoint Elements project\n- Published standards in neuroscience research\n\n#### [Julia Fractals](070-fractals.ipynb)\nComputational visualization of Julia sets from fractal mathematics. This example demonstrates:\n- Computed tables for mathematical functions\n- Parameter spaces and computational workflows\n- Image generation and visualization\n- Using DataJoint for reproducible computational art\n- Automatic computation with `populate()`\n\n#### [Blob Detection Pipeline](075-blob-detection.ipynb)\nAn image analysis pipeline that detects bright blobs in images. This example demonstrates:\n- Master-part table relationships for computational workflows\n- Lookup tables for algorithm parameters\n- Computed tables with automatic population\n- Visualization of detection results\n- Atomic transactions for workflow integrity\n\n---\n\nEach example is self-contained with:\n- Complete schema definitions\n- Sample data population\n- Example queries demonstrating key concepts\n- Visual diagrams showing table relationships\n- Code that you can run and modify\n\nBrowse through these examples to see different design patterns in action and learn how to apply DataJoint principles to your own domains."
11012
}
11113
],
11214
"metadata": {

book/80-examples/010-classic-sales.ipynb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131
"Because we run against the canonical SQL definitions, you can compare the DataJoint diagrams directly with the diagrams that appear in business-database textbooks. It also illustrates how DataJoint fits into an existing workflow—you can adopt legacy schemas while gaining the benefits of workflow execution, cascading deletes, and DAG-based querying.\n"
3232
]
3333
},
34-
{
35-
"cell_type": "markdown",
36-
"metadata": {},
37-
"source": []
38-
},
3934
{
4035
"cell_type": "code",
4136
"execution_count": 6,
@@ -587,11 +582,6 @@
587582
"\n",
588583
"From here you can explore the database using either SQL (`%sql`) or DataJoint operators. Because the schema follows the relational workflow model, joins such as `Order * Payment` or `Product * Order.Details` naturally trace the same business processes that the foreign keys encode. Try recreating some of the analytical queries from the MySQL tutorial using DataJoint’s restriction (`&`), projection (`.proj()`), and aggregation (`.aggr()`) operators to see how workflow-aware queries feel in a classic OLTP dataset.\n"
589584
]
590-
},
591-
{
592-
"cell_type": "markdown",
593-
"metadata": {},
594-
"source": []
595585
}
596586
],
597587
"metadata": {

book/80-examples/016-university-queries.ipynb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,11 +1808,6 @@
18081808
"The restriction operators & and - can use other queries as conditions."
18091809
]
18101810
},
1811-
{
1812-
"cell_type": "markdown",
1813-
"metadata": {},
1814-
"source": []
1815-
},
18161811
{
18171812
"cell_type": "code",
18181813
"execution_count": 16,
@@ -2521,11 +2516,6 @@
25212516
"# Joins"
25222517
]
25232518
},
2524-
{
2525-
"cell_type": "markdown",
2526-
"metadata": {},
2527-
"source": []
2528-
},
25292519
{
25302520
"cell_type": "code",
25312521
"execution_count": 22,
@@ -3528,4 +3518,4 @@
35283518
},
35293519
"nbformat": 4,
35303520
"nbformat_minor": 2
3531-
}
3521+
}

0 commit comments

Comments
 (0)