Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/linkml/cmdr
Browse files Browse the repository at this point in the history
  • Loading branch information
sierra-moxon committed Aug 5, 2024
2 parents 953da31 + 9cf7ac2 commit 577512d
Show file tree
Hide file tree
Showing 17 changed files with 815 additions and 931 deletions.
27 changes: 27 additions & 0 deletions .env.public
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is public in git. No sensitive info allowed.

###### schema definition variables, used by makefile

LINKML_SCHEMA_NAME="cmdr"
LINKML_SCHEMA_AUTHOR="LinkML Team <[email protected]>"
LINKML_SCHEMA_DESCRIPTION="Core Model for Clinical Data Collection"
LINKML_SCHEMA_SOURCE_PATH="src/cmdr/schema/cmdr.yaml"

###### linkml generator variables, used by makefile

## gen-project configuration file
LINKML_GENERATORS_CONFIG_YAML= --config-file config.yaml

## pass args if gendoc ignores config.yaml (i.e. --no-mergeimports)
LINKML_GENERATORS_DOC_ARGS=

## pass args to workaround genowl rdfs config bug (linkml#1453)
## (i.e. --no-type-objects --no-metaclasses --metadata-profile rdfs)
LINKML_GENERATORS_OWL_ARGS=

## pass args to trigger experimental java/typescript generation
LINKML_GENERATORS_JAVA_ARGS=
LINKML_GENERATORS_TYPESCRIPT_ARGS=

LINKML_SCHEMA_GOOGLE_SHEET_ID="1wVoaiFg47aT9YWNeRfTZ8tYHN8s8PAuDx5i2HUcDpvQ"
LINKML_SCHEMA_GOOGLE_SHEET_TABS="personinfo enums"
29 changes: 15 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ SHELL := bash
.SUFFIXES:
.SECONDARY:

# environment variables
.EXPORT_ALL_VARIABLES:
ifdef LINKML_ENVIRONMENT_FILENAME
include ${LINKML_ENVIRONMENT_FILENAME}
else
include .env.public
endif

RUN = poetry run
SCHEMA_NAME = $(LINKML_SCHEMA_NAME)
SOURCE_SCHEMA_PATH = $(LINKML_SCHEMA_SOURCE_PATH)
Expand All @@ -24,11 +16,20 @@ PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel
DOCDIR = docs
EXAMPLEDIR = examples
SHEET_MODULE = from_sheets
SHEET_ID = $(shell ${SHELL} ./utils/get-value.sh google_sheet_id)
SHEET_TABS = $(shell ${SHELL} ./utils/get-value.sh google_sheet_tabs)
SHEET_ID = $(LINKML_SCHEMA_GOOGLE_SHEET_ID)
SHEET_TABS = $(LINKML_SCHEMA_GOOGLE_SHEET_TABS)
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml
CONFIG_YAML = config.yaml

# environment variables

.EXPORT_ALL_VARIABLES:
ifdef LINKML_ENVIRONMENT_FILENAME
include ${LINKML_ENVIRONMENT_FILENAME}
else
include .env.public
endif

GEN_PARGS =
ifdef LINKML_COOKIECUTTER_GEN_PROJECT_ARGS
GEN_PARGS = ${LINKML_COOKIECUTTER_GEN_PROJECT_ARGS}
Expand Down Expand Up @@ -107,9 +108,9 @@ gen-examples:

# generates all project files

gen-project: $(PYMODEL) compile-sheets
$(RUN) gen-project ${CONFIG_YAML} -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL)

gen-project: $(PYMODEL)
$(RUN) gen-project -d $(DEST) $(SOURCE_SCHEMA_PATH) && mv $(DEST)/*.py $(PYMODEL)
$(RUN) gen-pydantic --pydantic-version 2 $(SOURCE_SCHEMA_PATH) > $(PYMODEL)/pydanticmodel_v2.py

# non-empty arg triggers owl (workaround https://github.com/linkml/linkml/issues/1453)
ifneq ($(strip ${GEN_OWL_ARGS}),)
Expand All @@ -129,7 +130,7 @@ endif
test: test-schema test-python test-examples

test-schema:
$(RUN) gen-project ${CONFIG_YAML} -d tmp $(SOURCE_SCHEMA_PATH)
$(RUN) gen-project -d tmp $(SOURCE_SCHEMA_PATH)

test-python:
$(RUN) python -m unittest discover
Expand Down
46 changes: 12 additions & 34 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,19 @@
# Configuration of generators (defaults illustrated)
---
generator_args:
excel:
mergeimports: true
jsonschema: {}
owl:
mergeimports: true
metaclasses: true
type_objects: true
# throws 'Cannot handle metadata profile: rdfs'
# metadata_profile: rdfs
markdown:
mergeimports: true
graphql:
mergeimports: true
java:
mergeimports: true
metadata: true
jsonld:
mergeimports: true
jsonschema:
mergeimports: true
jsonldcontext:
mergeimports: true
python:
mergeimports: true
prefixmap:
mergeimports: true
proto:
mergeimports: true
shacl:
mergeimports: true
shex:
mergeimports: true
sqlddl:
mergeimports: true
typescript:
mergeimports: true
metadata: true

...
includes:
- jsonschema
- python
- owl
- shex
- shacl
- prefixmap
excludes:
- graphql
- sqlschema
- protobuf
29 changes: 28 additions & 1 deletion examples/Container-material-entities.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
materials:
- id: "omicsrus:m1"
name: "water"
volume:
has_raw_value: "33.3 mL"
has_numeric_value: 33.3
has_unit: "mL"
- id: "omicsrus:m2"
name: "soil"
volume:
has_raw_value: "100.2 mL"
has_numeric_value: 100.2
has_unit: "mL"
- id: "omicsrus:m3"
name: "blood"
volume:
has_raw_value: "1.2 L"
has_numeric_value: 1.2
has_unit: "L"
investigations:
- id: "omicsrus:st1"
name: "parent study"
Expand All @@ -13,10 +27,23 @@ participations:
- id: "omicsrus:p1"
name: "participant one"
includes: "omicsrus:su1"
involved_in: "omicsrus:st1"
- id: "omicsrus:p2"
name: "participant two"
includes: "omicsrus:su2"
involved_in: "omicsrus:st2"
subjects:
- id: "omicsrus:su1"
name: "subject one"
- id: "omicsrus:su2"
name: "subject two"
name: "subject two"
material_processings:
- id: "omicsrus:mp1"
name: "Material Processing 1"
has_input: "omicsrus:m1"
has_output: "omicsrus:m1"
specimen_collection_processes:
- id: "omicsrus:scp1"
name: "Specimen Collection Process 1"
has_input: "omicsrus:su1"
has_output: "omicsrus:m3"
Binary file removed project/excel/cmdr.xlsx
Binary file not shown.
77 changes: 0 additions & 77 deletions project/graphql/cmdr.graphql

This file was deleted.

92 changes: 2 additions & 90 deletions project/jsonld/cmdr.context.jsonld
Original file line number Diff line number Diff line change
@@ -1,115 +1,27 @@
{
"comments": {
"description": "Auto generated by LinkML jsonld context generator",
"generation_date": "2023-03-07T15:56:42",
"generation_date": "2024-08-05T13:47:38",
"source": "cmdr.yaml"
},
"@context": {
"OBI": {
"@id": "http://purl.obolibrary.org/obo/OBI_",
"@prefix": true
},
"OBI": "http://example.org/UNKNOWN/OBI/",
"PATO": {
"@id": "http://purl.obolibrary.org/obo/PATO_",
"@prefix": true
},
"TEMP": "https://example.org/TEMP/",
"biolink": "https://w3id.org/biolink/",
"cmdr": "https://w3id.org/linkml/cmdr/",
"example": "https://example.org/",
"linkml": "https://w3id.org/linkml/",
"schema": "http://schema.org/",
"@vocab": "https://w3id.org/linkml/cmdr/",
"comparator": {
"@id": "TEMP:comparator"
},
"concentration": {
"@id": "TEMP:concentration"
},
"has_input": {
"@id": "TEMP:has_input"
},
"has_numeric_value": {
"@id": "TEMP:has_numeric_value"
},
"has_output": {
"@id": "TEMP:has_output"
},
"has_raw_value": {
"@id": "TEMP:has_raw_value"
},
"has_unit": {
"@id": "TEMP:has_unit"
},
"id": "@id",
"includes": {
"@id": "TEMP:includes"
},
"investigations": {
"@id": "TEMP:investigations"
},
"involved_in": {
"@id": "TEMP:involved_in"
},
"material_processings": {
"@id": "TEMP:material_processings"
},
"materials": {
"@id": "TEMP:materials"
},
"name": {
"@id": "TEMP:name"
},
"part_of": {
"@id": "TEMP:part_of"
},
"participations": {
"@id": "TEMP:participations"
},
"source": {
"@id": "TEMP:source"
},
"specimen_collection_processes": {
"@id": "TEMP:specimen_collection_processes"
},
"subjects": {
"@id": "TEMP:subjects"
},
"used_in": {
"@id": "TEMP:used_in"
},
"volume": {
"@id": "TEMP:volume"
},
"Container": {
"@id": "TEMP:Container"
},
"DataObject": {
"@id": "TEMP:DataObject"
},
"Investigation": {
"@id": "TEMP:Investigation"
},
"MaterialEntity": {
"@id": "TEMP:MaterialEntity"
},
"MaterialProcessing": {
"@id": "OBI:0000094"
},
"Participation": {
"@id": "TEMP:Participation"
},
"Process": {
"@id": "TEMP:Process"
},
"Quantity": {
"@id": "TEMP:Quantity"
},
"SpecimenCollectionProcess": {
"@id": "OBI:0000659"
},
"Subject": {
"@id": "TEMP:Subject"
}
}
}
Loading

0 comments on commit 577512d

Please sign in to comment.