Skip to content

Commit

Permalink
Finalize changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anngvu committed Nov 26, 2024
1 parent e429341 commit dfcf96f
Show file tree
Hide file tree
Showing 8 changed files with 1,323 additions and 1,305 deletions.
18 changes: 1 addition & 17 deletions .github/workflows/propagate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,4 @@ jobs:
- name: Push to Synapse schema registry only JSON schemas that changed
run: |
CHANGED=$(git diff --name-only HEAD HEAD~1 registered-json-schemas)
for FILE in $CHANGED
do
REQUEST_BODY=$(jq '. + { concreteType: "org.sagebionetworks.repo.model.schema.CreateSchemaRequest", dryRun: false }' $FILE)
RESPONSE=$(curl -X POST https://repo-prod.prod.sagebase.org/repo/v1/schema/type/create/async/start \
-H "Authorization: Bearer $SYNAPSE_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d "$REQUEST_BODY")
# Will error if token not within response
TOKEN=$( echo $RESPONSE | jq -e -r '.token')
sleep 1
STATUS=$(curl "https://repo-prod.prod.sagebase.org/repo/v1/schema/type/create/async/get/$TOKEN" \
-H "Authorization: Bearer $SYNAPSE_AUTH_TOKEN")
echo $STATUS | jq -e '.newVersionInfo'
done
.github/workflows/register-schema.sh $CHANGED
26 changes: 9 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@ PortalDataset:
yq '.slots |= with_entries(select(.value.in_subset[] == "portal"))' modules/props.yaml > relevant_props.yaml
yq ea '. as $$item ireduce ({}; . * $$item )' modules/Data/Data.yaml modules/Assay/Assay.yaml modules/Sample/Species.yaml modules/DCC/Portal.yaml > relevant_enums.yaml
cat header.yaml relevant_props.yaml relevant_enums.yaml modules/Template/PortalDataset.yaml > temp.yaml
gen-json-schema --inline --no-metadata --not-closed temp.yaml > tmp.json
rm relevant_props.yaml relevant_enums.yaml temp.yaml
gen-json-schema --inline --no-metadata --title-from=title --not-closed temp.yaml > tmp.json
json-dereference -s tmp.json -o tmp.json
jq '{ schema: { "$$schema": "http://json-schema.org/draft-07/schema#", "$$id": "https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-portaldataset", properties: ."$$defs".PortalDataset.properties, required: ."$$defs".PortalDataset.required }}' tmp.json > registered-json-schemas/PortalDataset.json
rm tmp.json
# There is a LinkML bug that needs some titles to be adjusted manually
yq -iP '.schema.properties.accessType.title="accessType"' registered-json-schemas/PortalDataset.json -o json
yq -iP '.schema.properties.assay.title="assay"' registered-json-schemas/PortalDataset.json -o json
yq -iP '.schema.properties.dataType.title="dataType"' registered-json-schemas/PortalDataset.json -o json
yq -iP '.schema.properties.fundingAgency.title="fundingAgency"' registered-json-schemas/PortalDataset.json -o json
yq -iP '.schema.properties.license.title="license"' registered-json-schemas/PortalDataset.json -o json
yq -iP '.schema.properties.manifestation.title="manifestation"' registered-json-schemas/PortalDataset.json -o json
yq -iP '.schema.properties.species.title="species"' registered-json-schemas/PortalDataset.json -o json
jq '."$$defs".PortalDataset | ."$$id"="https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-portaldataset"' tmp.json > registered-json-schemas/PortalDataset.json
rm -f relevant_props.yaml relevant_enums.yaml temp.yaml tmp.json
@echo "--- Saved registered-json-schemas/PortalDataset.json ---"


Expand All @@ -34,10 +25,9 @@ PortalStudy:
yq eval-all '. as $$item ireduce ({}; . * $$item )' modules/Data/Data.yaml modules/DCC/Portal.yaml modules/Other/Organization.yaml > relevant_enums.yaml
cat header.yaml relevant_enums.yaml modules/Template/PortalStudy.yaml > temp.yaml
gen-json-schema --inline --no-metadata --not-closed temp.yaml > tmp.json
rm relevant_enums.yaml temp.yaml
json-dereference -s tmp.json -o tmp.json
jq '{ schema: { "$$schema": "http://json-schema.org/draft-07/schema#", "$$id": "https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-portalstudy", properties: ."$$defs".PortalStudy.properties, required: ."$$defs".PortalStudy.required }}' tmp.json > registered-json-schemas/PortalStudy.json
rm tmp.json
jq '."$$defs".PortalStudy | ."$$id"="https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-portalstudy"' tmp.json > registered-json-schemas/PortalStudy.json
rm -f relevant_enums.yaml temp.yaml tmp.json
@echo "--- Saved registered-json-schemas/PortalStudy.json ---"

Protocol:
Expand All @@ -46,12 +36,13 @@ Protocol:
cat header.yaml relevant_props.yaml relevant_enums.yaml modules/Template/Protocol.yaml > temp.yaml
gen-json-schema --inline --no-metadata --not-closed temp.yaml > tmp.json
json-dereference -s tmp.json -o tmp.json
jq '.["$$defs"].ProtocolTemplate' tmp.json > registered-json-schemas/Protocol.json
jq '."$$defs".Protocol | ."$$id"="https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-protocol"' tmp.json > registered-json-schemas/Protocol.json
rm -f relevant_props.yaml relevant_enums.yaml temp.yaml tmp.json
@echo "--- Saved registered-json-schemas/Protocol.json ---"

Superdataset:
jq '.schema += input | del('.schema.required') | .schema["$$id"] = "https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-superdataset"' registered-json-schemas/PortalDataset.json registered-json-schemas/super_rules.json > registered-json-schemas/Superdataset.json
jq '. += input | del(.required) | ."$$id"="https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-superdataset"' registered-json-schemas/PortalDataset.json registered-json-schemas/super_rules.json > registered-json-schemas/Superdataset.json
@echo "--- Saved registered-json-schemas/Superdataset.json ---"

PortalPublication:
yq ea '. as $$item ireduce ({}; . * $$item )' modules/DCC/Portal.yaml modules/Other/PublicationEnum.yaml > relevant_enums.yaml
Expand All @@ -61,3 +52,4 @@ PortalPublication:
jq '."$$defs".PortalPublication | ."$$id"="https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-portalpublication"' tmp.json > registered-json-schemas/PortalPublication.json
rm -f tmp.json temp.yaml relevant_enums.yaml
@echo "--- Saved registered-json-schemas/PortalPublication.json ---"

20 changes: 18 additions & 2 deletions modules/Template/PortalDataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,82 @@ classes:
# - datasetSizeInBytes
# - publisher # should be autoset
title:
title: Title
range: string
required: true
creator:
title: Creator
range: string
required: true
contributor:
title: Contributor(s)
range: string
multivalued: true
required: false
description:
title: Description
range: string
required: false
accessType:
title: accessType
title: Access Type
range: AccessTypeEnum
required: true
license:
title: License
range: License
required: true
assay:
title: assay
title: Assay
range: AssayEnum
required: false # not applicable for curated data, e.g. dataset of compounds from a database and then enhanced for machine learning or other exploration
dataType:
title: Data Type
range: Data
multivalued: true
required: true
species:
title: Species
range: SpeciesEnum
multivalued: true
required: false # not all datasets from assays that use biological samples
studyId:
title: Study ID
range: string
required: true
manifestation:
title: Manifestation(s)
range: ManifestationEnum
multivalued: true
required: false
diseaseFocus:
title: Disease Focus
range: DiseaseFocusEnum
multivalued: true
required: true
fundingAgency:
title: Funding Agency
range: FundingAgencyEnum
multivalued: true
required: true
series:
title: Catalog Series
range: string
required: false
visualizeDataOn:
title: Visualize Data On
range: string
multivalued: true
required: false
yearProcessed:
title: Year Processed
range: integer
required: false
yearPublished:
title: Year Published
range: integer
required: false
includedInDataCatalog:
title: Included In Data Catalog
range: string
required: false

2 changes: 1 addition & 1 deletion modules/Template/Protocol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ classes:
# Protocols and other documents
#######################################

ProtocolTemplate:
Protocol:
description: Template for describing a protocol document.
source: https://bioschemas.org/profiles/LabProtocol/0.7-DRAFT
slots:
Expand Down
Loading

0 comments on commit dfcf96f

Please sign in to comment.