Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dansand committed May 16, 2024
1 parent ebfafe9 commit 354a89f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#DOIS
MATE_DOI = 'http://dx.doi.org/10.25914/yrzp-g882'
MATE_WEBSITE = 'https://mate.science/'
MATE_GITHUB = 'https://github.com/ModelAtlasofTheEarth'
MATE_GITHUB = 'https://github.com/ModelAtlasofTheEarth/'
MATE_THREDDS_BASE = "https://dapds00.nci.org.au/thredds/catalog/nm08/MATE/{}/catalog.html"

#URIs
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/parse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def validate_slug(proposed_slug):
except AssertionError as err:
error_log += f"{err}\n"

#try a workaround for local tests
cmd = "python3 .github/scripts/generate_identifier.py"
if os.path.exists('../.github/scripts/generate_identifier.py'):
os.path.exists('../.github/scripts/generate_identifier.py')

try:
slug = subprocess.check_output(cmd, shell=True, text=True, stderr=open(os.devnull)).strip()
Expand Down
18 changes: 15 additions & 3 deletions .github/scripts/ro_crate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import string
import json
import random
from config import MATE_DOI, NCI_RECORD, AUSCOPE_RECORD, MATE_THREDDS_BASE
from config import *
import re
import glob
from collections.abc import MutableMapping
Expand Down Expand Up @@ -615,8 +615,20 @@ def defaults_and_customise_ro_crate(issue_dict, ro_crate, timestamp=False):
root_index = find_index_by_id(ro_crate, './')
ro_crate['@graph'][root_index]['isPartOf'].append(MATE_DOI)
ro_crate['@graph'][root_index]['publisher'] = [AUSCOPE_RECORD, NCI_RECORD]
thredds_string = MATE_THREDDS_BASE.format(ro_crate['@graph'][root_index]['alternateName'])
ro_crate['@graph'][root_index]['url'] = thredds_string
#add the mate.science url for this model
#the logic is that the metadata captures all of the access points:
# the root identifier is the doi that points to the geonetwork record
# the root url points to the model on the mate website and the mate github
# the model_outputs/model_outputs url is the thredds URL
mate_science_url = MATE_WEBSITE + 'models/{}/'
mate_gh_url = MATE_GITHUB + '{}/'
slug = ro_crate['@graph'][root_index]['alternateName']
ro_crate['@graph'][root_index]['url'] = [mate_science_url.format(slug), mate_gh_url.format(slug)]
thredds_string = MATE_THREDDS_BASE.format(slug)
roc_index = find_index_by_id(ro_crate, 'model_outputs')
ro_crate['@graph'][roc_index]['url'] = thredds_string
roc_index = find_index_by_id(ro_crate, 'model_inputs')
ro_crate['@graph'][roc_index]['url'] = thredds_string


#add date time as the date published ro-crate
Expand Down
9 changes: 5 additions & 4 deletions .github/scripts/yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import copy
from ruamel.yaml import YAML
import io
from config import MATE_DOI, NCI_RECORD, AUSCOPE_RECORD, MATE_THREDDS_BASE


def navigate_and_assign(source, path, value):
Expand Down Expand Up @@ -159,7 +160,6 @@ def ensure_path_starts_with_pattern(file_path, pattern='./graphics/'):

def configure_yaml_output_dict(output_dict, issue_dict,
image_path='./graphics/',
thredds_base ="dapds00.nci.org.au/thredds/catalog/nm08/MATE/{}/catalog.html",
timestamp=False):

#nci_file_path_base
Expand All @@ -180,13 +180,14 @@ def configure_yaml_output_dict(output_dict, issue_dict,
else:
path_slug = 'PENDING'

thredds_string = thredds_base.format(path_slug)
thredds_string = MATE_THREDDS_BASE.format(path_slug)
## add the NCI_file_path
if issue_dict["include_model_output"]:
output_dict['dataset']['nci_file_path'] = thredds_string + '/model_output_data'
#for now, just link both to the thredds base.
output_dict['dataset']['nci_file_path'] = thredds_string #+ '/model_output_data'

if issue_dict["include_model_code"]:
output_dict['model_files']['nci_file_path'] = thredds_string + '/model_code_inputs'
output_dict['model_files']['nci_file_path'] = thredds_string #+ '/model_code_inputs'


#change format of ORCiD ids if required
Expand Down

0 comments on commit 354a89f

Please sign in to comment.