Skip to content

Commit 816f58d

Browse files
committed
feat: organize JSON schemas by version in subdirectories
- Create versioned directories (e.g., JSON_Schemas/v0.1.8/) - Update all schema generation paths to use versioned folders - Update Synapse registration to process versioned schemas - Update release asset upload to use versioned schemas - Add schema organization info to release notes This improves schema version tracking and makes it easier for htan2-project-setup to reference specific schema versions.
1 parent 8a94856 commit 816f58d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

.github/workflows/json-schema-synapse.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ jobs:
6262
6363
- name: Generate JSON Schemas
6464
run: |
65-
# Create output directory
66-
mkdir -p JSON_Schemas
65+
# Create versioned output directory
66+
mkdir -p JSON_Schemas/${{ steps.version.outputs.version }}
6767
6868
# Generate schemas for individual Clinical domains
6969
echo "Generating Clinical domain schemas..."
@@ -72,63 +72,63 @@ jobs:
7272
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
7373
"modules/Clinical/domains/demographics.yaml" \
7474
--class-name "Demographics" \
75-
--output "JSON_Schemas/HTAN.Demographics-${{ steps.version.outputs.version }}-schema.json"
75+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.Demographics-${{ steps.version.outputs.version }}-schema.json"
7676
7777
# Diagnosis
7878
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
7979
"modules/Clinical/domains/diagnosis.yaml" \
8080
--class-name "Diagnosis" \
81-
--output "JSON_Schemas/HTAN.Diagnosis-${{ steps.version.outputs.version }}-schema.json"
81+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.Diagnosis-${{ steps.version.outputs.version }}-schema.json"
8282
8383
# Therapy
8484
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
8585
"modules/Clinical/domains/therapy.yaml" \
8686
--class-name "Therapy" \
87-
--output "JSON_Schemas/HTAN.Therapy-${{ steps.version.outputs.version }}-schema.json"
87+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.Therapy-${{ steps.version.outputs.version }}-schema.json"
8888
8989
# FollowUp
9090
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
9191
"modules/Clinical/domains/followup.yaml" \
9292
--class-name "FollowUp" \
93-
--output "JSON_Schemas/HTAN.FollowUp-${{ steps.version.outputs.version }}-schema.json"
93+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.FollowUp-${{ steps.version.outputs.version }}-schema.json"
9494
9595
# MolecularTest
9696
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
9797
"modules/Clinical/domains/molecular.yaml" \
9898
--class-name "MolecularTest" \
99-
--output "JSON_Schemas/HTAN.MolecularTest-${{ steps.version.outputs.version }}-schema.json"
99+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.MolecularTest-${{ steps.version.outputs.version }}-schema.json"
100100
101101
# Exposure
102102
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
103103
"modules/Clinical/domains/exposure.yaml" \
104104
--class-name "Exposure" \
105-
--output "JSON_Schemas/HTAN.Exposure-${{ steps.version.outputs.version }}-schema.json"
105+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.Exposure-${{ steps.version.outputs.version }}-schema.json"
106106
107107
# FamilyHistory
108108
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
109109
"modules/Clinical/domains/family_history.yaml" \
110110
--class-name "FamilyHistory" \
111-
--output "JSON_Schemas/HTAN.FamilyHistory-${{ steps.version.outputs.version }}-schema.json"
111+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.FamilyHistory-${{ steps.version.outputs.version }}-schema.json"
112112
113113
# VitalStatus
114114
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
115115
"modules/Clinical/domains/vital_status.yaml" \
116116
--class-name "VitalStatus" \
117-
--output "JSON_Schemas/HTAN.VitalStatus-${{ steps.version.outputs.version }}-schema.json"
117+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.VitalStatus-${{ steps.version.outputs.version }}-schema.json"
118118
119119
# WES Level 1 (file-based schema)
120120
poetry run python scripts/linkml_to_flat_synapse_jsonschema.py \
121121
"modules/WES/domains/level_1.yaml" \
122122
--class-name "BulkWESLevel1" \
123-
--output "JSON_Schemas/HTAN.BulkWESLevel1-${{ steps.version.outputs.version }}-schema.json"
123+
--output "JSON_Schemas/${{ steps.version.outputs.version }}/HTAN.BulkWESLevel1-${{ steps.version.outputs.version }}-schema.json"
124124
125125
- name: Register schemas in Synapse
126126
env:
127127
SYNAPSE_USERNAME: ${{ secrets.SYNAPSE_USERNAME }}
128128
SYNAPSE_AUTH_TOKEN: ${{ secrets.SYNAPSE_AUTH_TOKEN }}
129129
run: |
130130
# Register each generated schema
131-
for schema_file in JSON_Schemas/*.json; do
131+
for schema_file in JSON_Schemas/${{ steps.version.outputs.version }}/*.json; do
132132
if [ -f "$schema_file" ]; then
133133
schema_name=$(basename "$schema_file" .json)
134134
echo "Processing schema: $schema_name"
@@ -161,6 +161,9 @@ jobs:
161161
162162
This release includes updated JSON schemas for the HTAN2 data model.
163163
164+
### Schema Organization:
165+
All schemas are organized in versioned directories: \`JSON_Schemas/${{ steps.version.outputs.version }}/\`
166+
164167
### Generated Schemas:
165168
- Demographics Schema
166169
- Diagnosis Schema
@@ -182,7 +185,7 @@ jobs:
182185
GH_TOKEN: ${{ github.token }}
183186
run: |
184187
# Upload each schema file as a release asset
185-
for schema_file in JSON_Schemas/*.json; do
188+
for schema_file in JSON_Schemas/${{ steps.version.outputs.version }}/*.json; do
186189
if [ -f "$schema_file" ]; then
187190
echo "Uploading $schema_file as release asset..."
188191
gh release upload ${{ github.ref_name }} "$schema_file"

0 commit comments

Comments
 (0)