Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement clean up strategies #128

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,9 @@ docserve: gen-docs
$(RUN) mkdocs serve


# Regenerate from Google Sheets. Note that this uses a *separate* Pipenv in the
# generators/google-sheets directory, so we have to run pipenv install on it separately.
# Generate LinkML schema from Google Sheet data model using sheet2linkml.
generate-model: install install-dev
CDM_GOOGLE_SHEET_ID=$(CDM_GOOGLE_SHEET_ID) $(RUN) python vendor/sheet2linkml/sheet2linkml.py --output model/schema/crdch_model.yaml
CDM_GOOGLE_SHEET_ID=$(CDM_GOOGLE_SHEET_ID) $(RUN) sheet2linkml --output linkml_model/schema/crdch_model.yaml --logging-config ./logging.ini
Copy link
Member

Choose a reason for hiding this comment

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

I haven't run this within this repo, but I have run it directly in cancerDHC/sheet2linkml, so I trust it

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the output file should be --output model/schema/crdch_model.yaml, unless we're moving the directory we store crdch_model.yaml in?


# MAM 20210806 not sure how this fits into the linkml model template's doc building/publsihing approach
# Deploy changes to the `dev` version on the gh-pages branch.
Expand Down
11 changes: 1 addition & 10 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,20 @@ name = "pypi"
# For LinkML, we use the `ccdh-dev` branch, which we manually keep in sync with LinkML's main branch
# as well as some additional changes required for CRDCH generation.
linkml = {editable = true, ref = "ccdh-dev", git = "https://github.com/cancerDHC/linkml.git"}

# Since we use the development version of LinkML, we also use the development version of linkml-runtime.
# This may sometimes cause issues between this and LinkML.
linkml-runtime = {editable = true, git = "https://github.com/linkml/linkml-runtime.git"}

pyparsing = "<=2.4.7"
rdflib-pyld-compat = "*" # resinstating after removal by migration to linkml model template
sheet2linkml = ">=1.1.0" # used for converting spreadsheet data model to LinkML schema

[dev-packages]
pyyaml = "*" # For reading and writing YAML files.

# Packages needed for testing.
pytest = "~=6.2.4"
tox = "*"
typing_extensions = "*" # This is a tox prereq for Python 3.7, but not installed by Pipenv.
twine = "*" # should this go in make-venv/Pipfile ?

# Packages needed by sheet2linkml.
black = "==v21.5b1" # Used for code linting.
requests = "*" # For making HTTP requests.
pygsheets = "*" # For accessing Google Sheets.
python-dotenv = "*" # For reading .env files.

# Packages needed for building and publishing documentation.
mike = "*"
mkdocs-material = "*"
Expand Down
1,180 changes: 671 additions & 509 deletions Pipfile.lock

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ This repository stores the [LinkML](https://linkml.github.io/) representation of

This repository includes [the LinkML model itself](./model/schema/crdch_model.yaml) (in [YAML](https://en.wikipedia.org/wiki/YAML) format) as well as a number of artifacts produced automatically by LinkML, including a JSON Schema, JSON-LD context, a GraphQL description, a CSV description and ShEx validation shapes.

Model documentation in Markdown can also be generated for this repository, and is currently hosted on GitHub Pages at https://cancerdhc.github.io/ccdhmodel/. A set of Python Data Classes can also be generated and are [available for use](./crdch_model/crdch_model.py). Examples of their use are available in the [Example Data](https://github.com/cancerDHC/example-data/) repository.
Model documentation in Markdown can also be generated for this repository, and is currently hosted on [GitHub Pages](https://cancerdhc.github.io/ccdhmodel/). A set of Python Data Classes can also be generated and are [available for use](./crdch_model/crdch_model.py). Examples of their use are available in the [Example Data](https://github.com/cancerDHC/example-data/) repository.

## Setup

### Automated generation of YAML
### Automated generation of LinkML YAML

The CRDC-H model is currently in development on [a Google Sheet](https://docs.google.com/spreadsheets/d/1oWS7cao-fgz2MKWtyr8h2dEL9unX__0bJrWKv6mQmM4/).
This repository contains a program in the [`./vendor/sheet2linkml`](./vendor/sheet2linkml) directory
that can read the Google Sheet using the Google Drive API and generate a LinkML representation of the model.
The [sheet2linkml](https://github.com/cancerDHC/sheet2linkml/) package can read the Google Sheet and generate a LinkML representation of the model.

In order to run this program, you will need to create and download Google Drive client credentials. First,
[enable the Google Drive API](https://developers.google.com/drive/api/v3/enable-drive-api). After the API is enabled,
Expand All @@ -22,9 +21,15 @@ the root directory of this project. [Detailed instructions and screenshots](http
are also available from the [`pygsheets` documentation](https://pygsheets.readthedocs.io/), which is the package we use to
access Google Sheets.

Once this is setup, run `make generate-model` to update the schema from Google Sheets. The first time you run this script,
Once this is setup, run from the root of the project:

```
make generate-model
```

to create the schema from Google Sheet. The first time you run this script,
you will see a browser page asking you to log in. Follow the instructions. The script will download a token and store it
locally. You won't need to log in in the future.
locally, so you won't need to login again after that.

### Generation of LinkML artifacts

Expand Down
File renamed without changes.
18 changes: 0 additions & 18 deletions from_template/MakeConfig

This file was deleted.

2 changes: 0 additions & 2 deletions local/.keep

This file was deleted.

4 changes: 0 additions & 4 deletions vendor/sheet2linkml/.gitignore

This file was deleted.

18 changes: 0 additions & 18 deletions vendor/sheet2linkml/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions vendor/sheet2linkml/sheet2linkml.py

This file was deleted.

Empty file.
121 changes: 0 additions & 121 deletions vendor/sheet2linkml/sheet2linkml/cli.py

This file was deleted.

55 changes: 0 additions & 55 deletions vendor/sheet2linkml/sheet2linkml/model.py

This file was deleted.

Empty file.
Empty file.
Loading