Skip to content

Commit

Permalink
postgresql ddl for donor-slots example
Browse files Browse the repository at this point in the history
  • Loading branch information
rsc3 committed Aug 31, 2023
1 parent 689c55e commit 1cc86e6
Show file tree
Hide file tree
Showing 3 changed files with 396 additions and 13 deletions.
187 changes: 187 additions & 0 deletions content/json_schema/donor-slots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"$defs": {
"DiagnosisType": {
"description": "",
"enum": [],
"title": "DiagnosisType",
"type": "string"
},
"Donor": {
"additionalProperties": false,
"description": "A person or organism that is the source of a biosample.",
"properties": {
"aliases": {
"items": {
"type": "string"
},
"type": "array"
},
"birth_date": {
"description": "date of birth",
"format": "date",
"type": "string"
},
"death_age": {
"description": "age at death",
"maximum": 200,
"minimum": 0,
"type": "integer"
},
"death_date": {
"description": "date of death",
"format": "date",
"type": "string"
},
"description": {
"type": "string"
},
"genetic_ancestry": {
"items": {
"type": "string"
},
"type": "array"
},
"id": {
"type": "string"
},
"image": {
"type": "string"
},
"name": {
"type": "string"
},
"organism_type": {
"description": "the type of organism, ideally the Linnean genus and species name, but also may be e.g. human, mouse, etc.",
"type": "string"
},
"phenotypic_sex": {
"type": "string"
},
"reported_ethnicity": {
"items": {
"type": "string"
},
"type": "array"
},
"strain": {
"description": "strain of organism, for non-humans only, e.g. C57BL/6J",
"type": "string"
},
"xref_id": {
"description": "other identifiers for the person, e.g. ORCID, etc.",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"organism_type",
"id"
],
"title": "Donor",
"type": "object"
},
"FamilialRelationship": {
"additionalProperties": false,
"description": "",
"properties": {
"ended_at_time": {
"format": "date",
"type": "string"
},
"related_to": {
"type": "string"
},
"started_at_time": {
"format": "date",
"type": "string"
},
"type": {
"$ref": "#/$defs/FamilialRelationshipType"
}
},
"required": [
"related_to",
"type"
],
"title": "FamilialRelationship",
"type": "object"
},
"FamilialRelationshipType": {
"description": "",
"enum": [
"SIBLING_OF",
"PARENT_OF",
"CHILD_OF"
],
"title": "FamilialRelationshipType",
"type": "string"
},
"GenderType": {
"description": "",
"enum": [
"nonbinary man",
"nonbinary woman",
"transgender woman",
"transgender man",
"cisgender man",
"cisgender woman"
],
"title": "GenderType",
"type": "string"
},
"NamedThing": {
"additionalProperties": false,
"description": "A generic grouping for any identifiable entity. This level of abstraction could be changed to RelationalTable, for example. Useful for semantic web export.",
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"image": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id"
],
"title": "NamedThing",
"type": "object"
},
"Relationship": {
"additionalProperties": false,
"description": "",
"properties": {
"ended_at_time": {
"format": "date",
"type": "string"
},
"related_to": {
"type": "string"
},
"started_at_time": {
"format": "date",
"type": "string"
},
"type": {
"type": "string"
}
},
"title": "Relationship",
"type": "object"
}
},
"$id": "https://raw.githubusercontent.com/DataBiosphere/terra-interoperability-model/master/releases/2.x/terra-core/TerraCoreDataModel.ttl#Donor",
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": true,
"metamodel_version": "1.7.0",
"title": "donor",
"type": "object",
"version": null
}
150 changes: 137 additions & 13 deletions content/linkml/donor-slots.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
id: https://raw.githubusercontent.com/DataBiosphere/terra-interoperability-model/master/releases/2.x/terra-core/TerraCoreDataModel.ttl#Donor
# id: https://w3id.org/linkml/examples/personinfo # example schema URI
# id: https://w3id.org/biocore/examples/donor # example schema URI registered with w3id.org
name: donor
description: |-
A donor is a person or organism that is the source of a biosample.
license: https://creativecommons.org/publicdomain/zero/1.0/
prefixes:
linkml: https://w3id.org/linkml/ # this is the URI of the linkml prefix
donor: https://raw.githubusercontent.com/DataBiosphere/terra-interoperability-model/master/releases/2.x/terra-core/TerraCoreDataModel.ttl#Donor
schema: http://schema.org/
rdfs: http://www.w3.org/2000/01/rdf-schema#
prov: http://www.w3.org/ns/prov#
GSSO: http://purl.obolibrary.org/obo/GSSO_
famrel: https://example.org/FamilialRelations#
default_prefix: donor
imports:
- linkml:types # this imports the linkml types schema
default_range: string # if not specified, the default range is string

emit_prefixes: # for semantic web output data
- rdf
- rdfs
- xsd
- skos

classes:
NamedThing:
description: >-
A generic grouping for any identifiable entity. This level of abstraction could be changed to RelationalTable, for example. Useful for semantic web export.
slots:
- id
- name
- description
- image
close_mappings:
- schema:Thing
Donor: # this is the name of the class, Donor could be Subject, Patient, etc.
description: >-
A person or organism that is the source of a biosample.
is_a: NamedThing # this is the parent class
mixins:
- HasAliases
slots:
- id
- birth_date
- birth_date # note all dates will be strings unless format is specified, may want to add date_at_event, etc.
- death_date
- death_age
- reported_ethnicity
Expand All @@ -20,22 +50,71 @@ classes:
- phenotypic_sex
- strain
- xref_id
Container:

HasAliases:
description: >-
A mixin applied to any class that can have aliases/alternateNames. Useful to mapping BioCore to TIM, for example.
mixin: true
attributes:
donors:
multivalued: true # the container holds a list of donors
inlined_as_list: true
range: Donor # the donors are things of class Donor
description:
the dataset is a table of donors
aliases:
multivalued: true
exact_mappings:
- schema:alternateName

Relationship:
slots:
- started_at_time
- ended_at_time
- related_to
- type
FamilialRelationship: #example from personinfo.yaml
is_a: Relationship
slot_usage:
type:
range: FamilialRelationshipType
required: true
related_to:
range: Donor
required: true
# TODO: annotate that this is a container/root class
# Container:
# tree_root: true
# slots:
# - donors
# Container:
# attributes:
# donors:
# multivalued: true # the container holds a list of donors
# inlined_as_list: true
# range: Donor # the donors are things of class Donor
# description:
# the dataset is a table of donors
slots:
id:
identifier: true # this is the primary identifier for the class
identifier: true
slot_uri: schema:identifier
name:
slot_uri: schema:name
description:
slot_uri: schema:description
image:
slot_uri: schema:image
gender:
slot_uri: schema:gender
range: GenderType
birth_date:
multivalued: false
description:
date of birth
range: date
slot_uri: schema:birthDate
is_current:
range: boolean
description: boolean flag indicating whether the donor data is current to some unspecified date
has_familial_relationships:
range: FamilialRelationship
multivalued: true
inlined_as_list: true
death_date:
multivalued: false
range: date
Expand All @@ -47,10 +126,18 @@ slots:
maximum_value: 200
description:
age at death
age_in_years: #assumes donor is alive
range: integer
minimum_value: 0
maximum_value: 999 # assumes donor is an animal (!)
ended_at_time:
slot_uri: prov:endedAtTime
range: date
related_to:
reported_ethnicity:
multivalued: true
range: string
slot_uri: BioCoreFields:hasOrganismType # we can use inheritance to define a slot_uri for an attribute, such as form BioCore data model
# slot_uri: BioCoreFields:hasOrganismType # we can use inheritance to define a slot_uri for an attribute, such as form BioCore data model
genetic_ancestry:
multivalued: true
organism_type:
Expand All @@ -65,4 +152,41 @@ slots:
multivalued: true
recommended: true # example of making a slot recommended, does NOT serialize to JSON schema!
description:
other identifiers for the person, e.g. ORCID, etc.
other identifiers for the person, e.g. ORCID, etc.
started_at_time:
slot_uri: prov:startedAtTime
range: date
duration:
range: float
type:

donors: # perhaps clearer way of defining a container
range: Donor
inlined: true
inlined_as_list: true
multivalued: true

enums:
FamilialRelationshipType:
permissible_values:
SIBLING_OF:
meaning: famrel:01
PARENT_OF:
meaning: famrel:02
CHILD_OF:
meaning: famrel:03
GenderType:
permissible_values:
nonbinary man:
meaning: GSSO:009254
nonbinary woman:
meaning: GSSO:009253
transgender woman:
meaning: GSSO:000384
transgender man:
meaning: GSSO:000372
cisgender man:
meaning: GSSO:000371
cisgender woman:
meaning: GSSO:000385
DiagnosisType:
Loading

0 comments on commit 1cc86e6

Please sign in to comment.