Skip to content

Commit c743fd0

Browse files
authored
metamodel docs (#133)
* Adding metamodel docs * Adding docs target. Sphinx update * docs-target
1 parent 8428e9c commit c743fd0

File tree

7 files changed

+491
-608
lines changed

7 files changed

+491
-608
lines changed

.github/workflows/doc_pages.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
run: |
2828
mkdir gh-pages
2929
touch gh-pages/.nojekyll
30+
make all-docs
3031
cd docs/
3132
poetry run sphinx-build -b html . _build
3233
cp -r _build/* ../gh-pages/
@@ -37,4 +38,4 @@ jobs:
3738
with:
3839
branch: gh-pages
3940
force: true
40-
folder: gh-pages
41+
folder: gh-pages

Makefile

+18-55
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,39 @@
11
RUN = poetry run
22
VERSION = $(shell git tag | tail -1)
3+
MODELS = cadsr frictionless
34

4-
.PHONY: all clean test
5+
.PHONY: all clean test all-docs sphinx-html
56

6-
all: clean test target/soil_meanings.yaml
7+
all: clean test
78

89

9-
clean:
10-
rm -rf target/soil_meanings.yaml
11-
rm -rf target/soil_meanings_generated.yaml
12-
rm -rf target/availabilities_g_s_strain_202112151116.yaml
13-
rm -rf target/availabilities_g_s_strain_202112151116_org_meanings.yaml
14-
1510
test:
1611
$(RUN) pytest tests/
1712

1813
schema_automator/metamodels/%.py: schema_automator/metamodels/%.yaml
1914
$(RUN) gen-python $< > $@.tmp && mv $@.tmp $@
2015

21-
# tried to find a single meaning for each permissible value
22-
# unlike term mapping, which can tolerate multiple mapped terms
23-
target/soil_meanings.yaml: tests/resources/mixs/terms.yaml
24-
poetry run enum_annotator \
25-
--modelfile $< \
26-
--requested_enum_name fao_class_enum \
27-
--ontology_string ENVO > $@
28-
29-
# validate that it's still valid LinkML
30-
# FileNotFoundError: [Errno 2] No such file or directory: '/Users/MAM/Documents/gitrepos/linkml-model-enrichment/target/ranges.yaml'
31-
# cp tests/resources/mixs/*yaml target
32-
target/soil_meanings_generated.yaml: target/soil_meanings.yaml
33-
poetry run gen-yaml $< > $@
34-
35-
# requires Felix files
36-
# add demonstration SQL file
37-
target/availabilities_g_s_strain_202112151116.yaml: local/availabilities_g_s_strain_202112151116.tsv
38-
poetry run tsv2linkml \
39-
--enum-columns organism \
40-
--output $@ \
41-
--class_name availabilities \
42-
--schema_name availabilities $<
43-
44-
# KeyError: 'iri' could mean that an unrecognized ontology name was used
45-
target/availabilities_g_s_strain_202112151116_org_meanings.yaml: target/availabilities_g_s_strain_202112151116.yaml
46-
poetry run enum_annotator \
47-
--modelfile $< \
48-
--requested_enum_name organism_enum \
49-
--ontology_string NCBITAXON > $@
50-
51-
target/availabilities_g_s_strain_202112151116_org_meanings_curateable.tsv: target/availabilities_g_s_strain_202112151116_org_meanings.yaml
52-
poetry run enums_to_curateable \
53-
--modelfile $< \
54-
--enum organism_enum \
55-
--tsv_out $@
56-
57-
# do some curation on target/availabilities_g_s_strain_202112151116_org_meanings_curateable.tsv
58-
# and save as target/availabilities_g_s_strain_202112151116_org_meanings_curated.txt
59-
# Excel wants to call it "*.txt". I'm saving as UTF 16 so I can be sure about the encoding at import time.
60-
61-
target/availabilities_g_s_strain_202112151116_org_meanings_curated.yaml: target/availabilities_g_s_strain_202112151116_org_meanings_curated.txt
62-
poetry run curated_to_enums \
63-
--tsv_in $< \
64-
--tsv_encoding utf_16 \
65-
--model_in target/availabilities_g_s_strain_202112151116_org_meanings.yaml \
66-
--curated_yaml $@ \
67-
--selected_enum organism_enum
6816

6917
# create a convenient wrapper script;
7018
# this can be used outside the poetry environment
7119
bin/schemauto:
7220
echo `poetry run which schemauto` '"$$@"' > $@ && chmod +x $@
7321

22+
########################
23+
#### Metamodel docs ####
24+
########################
25+
26+
all-docs: $(patsubst %,docs-%,$(MODELS))
27+
28+
docs-dosdp: schema_automator/metamodels/dosdp/dosdp_linkml.yaml
29+
$(RUN) gen-doc -d docs/metamodels/dosdp $<
30+
31+
docs-%: schema_automator/metamodels/%.yaml
32+
$(RUN) gen-doc -d docs/metamodels/$* $<
33+
34+
sphinx-%:
35+
cd docs && $(RUN) make $*
36+
.PHONY: sphinx-%
7437

7538
################################################
7639
#### Commands for building the Docker image ####

docs/conf.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,43 @@
3333
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3434
# ones.
3535
extensions = [
36-
'sphinx.ext.autodoc',
37-
'sphinx.ext.githubpages',
38-
'sphinx.ext.autosectionlabel',
39-
'sphinx_pdj_theme',
40-
'sphinx_click',
41-
'sphinx.ext.viewcode',
42-
'sphinx.ext.todo',
43-
'sphinx.ext.coverage',
44-
'sphinx.ext.autosummary',
45-
'myst_parser',
46-
'sphinx.ext.intersphinx',
47-
'sphinxcontrib.mermaid'
36+
"sphinx.ext.autodoc",
37+
"sphinx.ext.githubpages",
38+
"sphinx.ext.autosectionlabel",
39+
"sphinx_pdj_theme",
40+
"sphinx_click",
41+
"sphinx.ext.viewcode",
42+
"sphinx.ext.todo",
43+
"sphinx.ext.coverage",
44+
"sphinx.ext.autosummary",
45+
"myst_parser",
46+
"sphinx.ext.intersphinx",
47+
"sphinxcontrib.mermaid"
4848
]
4949

5050
# The suffix(es) of source filenames.
5151
# You can specify multiple suffix as a list of string:
52-
# source_suffix = ['.rst', '.md']
53-
source_suffix = ['.rst', '.md']
52+
# source_suffix = [".rst", ".md"]
53+
source_suffix = [".rst", ".md"]
5454

5555
# Add any paths that contain templates here, relative to this directory.
56-
templates_path = ['_templates']
56+
templates_path = ["_templates"]
5757

5858
# List of patterns, relative to source directory, that match files and
5959
# directories to ignore when looking for source files.
6060
# This pattern also affects html_static_path and html_extra_path.
61-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
61+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
6262

6363

6464
# -- Options for HTML output -------------------------------------------------
6565

6666
# The theme to use for HTML and HTML Help pages. See the documentation for
6767
# a list of builtin themes.
6868
#
69-
#html_theme = 'sphinx_pdj_theme'
69+
#html_theme = "sphinx_pdj_theme"
7070
#html_theme_path = [sphinx_pdj_theme.get_html_theme_path()]
7171

7272
# Add any paths that contain custom static files (such as style sheets) here,
7373
# relative to this directory. They are copied after the builtin static files,
7474
# so a file named "default.css" will overwrite the builtin "default.css".
75-
html_static_path = ['_static']
75+
html_static_path = ["_static"]

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ schema frameworks, including:
2828
install
2929
cli
3030
packages/index
31+
metamodels/index
3132

3233

3334
Indices and tables

docs/metamodels/index.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Source Metamodels
2+
=================
3+
4+
Schema Automator makes use of LinkML Schema representations of source
5+
metamodels in order to define transformations.
6+
7+
.. toctree::
8+
:maxdepth: 3
9+
:caption: Contents:
10+
11+
index
12+
cadsr/index
13+
frictionless/index
14+
dosdp/index
15+
fhir/index
16+
17+
18+
Indices and tables
19+
==================
20+
21+
* :ref:`genindex`
22+
* :ref:`modindex`
23+
* :ref:`search`

0 commit comments

Comments
 (0)