Skip to content

Commit

Permalink
adds ability to render mermaid in markdown and script to export SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
btylerburton committed Dec 13, 2023
1 parent 34f2f00 commit 73435d4
Show file tree
Hide file tree
Showing 32 changed files with 1,280 additions and 22 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pytest-coverage.txt
__pycache__/
venv/

# node
node_modules/
# any previous versions of schemas
**/dataset_**.json
**/catalog_**.json
Expand All @@ -15,4 +17,4 @@ venv/
tmp/

# vscode debugger
.vscode/
.vscode/
1 change: 0 additions & 1 deletion docs/arcgis.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/dcat.svg

This file was deleted.

1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/arcgis-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/arcgis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![diagram](./arcgis-1.svg)
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/dcat-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/dcat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![diagram](./dcat-1.svg)
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/new_harvesting-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/new_harvesting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![diagram](./new_harvesting-1.svg)
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/old_harvesting-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/old_harvesting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![diagram](./old_harvesting-1.svg)
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/single_xml-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/single_xml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![diagram](./single_xml-1.svg)
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/waf_xml-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/diagrams/mermaid/dest/waf_xml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
![diagram](./waf_xml-1.svg)
19 changes: 19 additions & 0 deletions docs/diagrams/mermaid/makeDoc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { run } from "@mermaid-js/mermaid-cli"
import { readdir } from 'node:fs/promises';
import { resolve } from 'node:path';

(async (req, res) => {
try {
let fileSrc = resolve('./docs/diagrams/mermaid/src')
let fileDest = resolve('./docs/diagrams/mermaid/dest')
const files = await readdir(fileSrc);
for (const file of files) {
console.log(`Found file: ${file}`);
await run(
`${fileSrc}/${file}`, `${fileDest}/${file}`, {puppeteerConfig: {"headless": "old"}},
)
}
} catch (err) {
console.error(err)
}
})();
File renamed without changes.
2 changes: 2 additions & 0 deletions docs/dcat.mmd → docs/diagrams/mermaid/src/dcat.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
```mermaid
flowchart LR
%% Algorithm
Expand Down Expand Up @@ -221,3 +222,4 @@ flowchart LR
has_title{Does the dataset have a title?}
does_parent_exist{Does Parent exist?}
is_title_valid{Is the title valid?}
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
```mermaid
flowchart TD
%% Operations
sc([SOURCE CREATION])
extract([Extract Catalog Source])
extract([Extract Faceted Catalog Source])
compare([Compare Source Catalog to Data.gov Catalog])
load([Load into Data.gov Catalog])
validate([Validate Dataset])
Expand Down Expand Up @@ -30,3 +31,4 @@ flowchart TD
load --> completed
compare --> nochanges
nochanges --> completed
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
```mermaid
flowchart LR
%% Operations
sc([SOURCE CREATION])
Expand All @@ -15,3 +16,4 @@ flowchart LR
scheduled --> gs
gs --> fs
fs --> is
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
```mermaid
flowchart LR
%% Algorithm
Expand Down Expand Up @@ -140,3 +141,4 @@ flowchart LR
is_source_private{Is the Harvest Source Private?}
is_source_part_of_topic{Is the Harvest Source part of a Topic?}
is_status_new{Is the Status new?}
```
2 changes: 2 additions & 0 deletions docs/waf_xml.mmd → docs/diagrams/mermaid/src/waf_xml.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
```mermaid
flowchart LR
%% Algorithm
Expand Down Expand Up @@ -192,3 +193,4 @@ flowchart LR
is_source_private{Is the Harvest Source Private?}
is_source_part_of_topic{Is the Harvest Source part of a Topic?}
is_status_new{Is the Status new?}
```
File renamed without changes
File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions docs/harvesting.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/new_harvesting.svg

This file was deleted.

Loading

1 comment on commit 73435d4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
harvester
   __init__.py30100% 
harvester/db/models
   __init__.py50100% 
   models.py530100% 
harvester/extract
   __init__.py1922 89%
   dcatus.py1122 82%
harvester/utils
   __init__.py00100% 
   json.py2266 73%
   pg.py3544 89%
   s3.py2466 75%
harvester/validate
   __init__.py00100% 
   dcat_us.py240100% 
TOTAL1962090% 

Tests Skipped Failures Errors Time
29 0 💤 0 ❌ 0 🔥 23.893s ⏱️

Please sign in to comment.