Skip to content

Commit 58eb62e

Browse files
committed
fix(docs): improve mermaid graph & use of mermaid2
1 parent 7dbdcbf commit 58eb62e

File tree

3 files changed

+86
-22
lines changed

3 files changed

+86
-22
lines changed

docs/CONTRIBUTING.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,45 @@ Pre-commit hooks enforce standards by running checks (like `ruff`) before commit
359359

360360
`UrbanMapper`’s pipeline flows like this:
361361

362-
```mermaid
363-
graph TD
364-
A[Loader] --> B[Urban Layer]
365-
B --> C[Imputers]
366-
C --> D[Filters]
367-
D --> E[Enrichers]
368-
E --> F[Visualiser]
369-
```
362+
<div class="mermaid">
363+
%%{init: {
364+
'theme': 'base',
365+
'themeVariables': {
366+
'primaryColor': '#57068c',
367+
'primaryTextColor': '#fff',
368+
'primaryBorderColor': '#F49BAB',
369+
'lineColor': '#F49BAB',
370+
'secondaryColor': '#9B7EBD',
371+
'tertiaryColor': '#E5D9F2'
372+
}
373+
}}%%
374+
graph LR
375+
subgraph "Data Ingestion"
376+
A["Loader (1)"]
377+
B["Urban Layer (1)"]
378+
A -->|Raw data| B
379+
end
380+
subgraph "Data Preprocessing"
381+
direction TB
382+
C["Imputers (0..*)"]
383+
D["Filters (0..*)"]
384+
C -->|Imputed data| D
385+
end
386+
subgraph "Data Processing"
387+
E["Enrichers (1..*)"]
388+
end
389+
subgraph "Data Output"
390+
F["Visualiser (0..1)"]
391+
end
392+
393+
B -->|Spatial data| C
394+
D -->|Filtered data| E
395+
E -->|Enriched data| F
396+
</div>
397+
398+
<p style="text-align: center; font-style: italic;">
399+
Notation: (1) = exactly one instance, (0..*) = zero or more instances, (1..*) = one or more instances, (0..1) = zero or one instance
400+
</p>
370401

371402
Each step processes the data sequentially, transforming it from raw input to enriched urban insights. New components
372403
should slot into this sequence (see `urban_mapper/pipeline/`).

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ markdown_extensions:
7474
custom_fences:
7575
- name: mermaid
7676
class: mermaid
77-
format: !!python/name:pymdownx.superfences.fence_code_format
77+
format: !!python/name:mermaid2.fence_mermaid
7878
- pymdownx.inlinehilite
7979
- pymdownx.tabbed:
8080
alternate_style: true
@@ -116,6 +116,7 @@ plugins:
116116
- privacy
117117
- social
118118
- minify
119+
- mermaid2
119120

120121
extra:
121122
social:

src/urban_mapper/pipeline/pipeline.py

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,51 @@ class UrbanPipeline:
2828
"""`Scikit-Learn` Inspired `Pipeline` for `Urban Mapper`.
2929
3030
Constructs and manages pipelines integrating various urban mapper components into a cohesive workflow,
31-
handling execution order and data flow. As a bonus, you can `save`, `share`, `export`, and `load pipelines`,
32-
is not that great for reprodcuibility?
33-
34-
Representation of a pipeline using Mermaid:
35-
36-
```mermaid
37-
graph TD
38-
A[Loader] --> B[Urban Layer]
39-
B --> C[Imputers]
40-
C --> D[Filters]
41-
D --> E[Enrichers]
42-
E --> F[Visualiser]
43-
```
31+
handling execution order and data flow. Yet, not only, you also can `save`, `share`, `export`, and `load pipelines`,
32+
is not that great for reproducibility?
33+
34+
Have a look at how a pipeline could look like:
35+
36+
<div class="mermaid">
37+
%%{init: {
38+
'theme': 'base',
39+
'themeVariables': {
40+
'primaryColor': '#57068c',
41+
'primaryTextColor': '#fff',
42+
'primaryBorderColor': '#F49BAB',
43+
'lineColor': '#F49BAB',
44+
'secondaryColor': '#9B7EBD',
45+
'tertiaryColor': '#E5D9F2'
46+
}
47+
}}%%
48+
graph LR
49+
subgraph "Data Ingestion"
50+
A["Loader (1)"]
51+
B["Urban Layer (1)"]
52+
A -->|Raw data| B
53+
end
54+
subgraph "Data Preprocessing"
55+
direction TB
56+
C["Imputers (0..*)"]
57+
D["Filters (0..*)"]
58+
C -->|Imputed data| D
59+
end
60+
subgraph "Data Processing"
61+
E["Enrichers (1..*)"]
62+
end
63+
subgraph "Data Output"
64+
F["Visualiser (0..1)"]
65+
end
66+
67+
B -->|Spatial data| C
68+
D -->|Filtered data| E
69+
E -->|Enriched data| F
70+
</div>
71+
72+
<p style="text-align: center; font-style: italic;">
73+
Notation: (1) = exactly one instance, (0..*) = zero or more instances, (1..*) = one or more instances, (0..1) = zero or one instance
74+
</p>
75+
4476
4577
!!! note
4678
`Pipelines` must be `composed` before `transforming` or `visualising` data.

0 commit comments

Comments
 (0)