Skip to content

Commit

Permalink
some updates to website YAML names, add nci file path
Browse files Browse the repository at this point in the history
  • Loading branch information
dansand committed May 7, 2024
1 parent 914285c commit 06f8ac3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
16 changes: 10 additions & 6 deletions .github/scripts/crosswalk_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,15 @@
#but for the website they should point to the NCI collection
'model_setup_info.url':'foo',
'model_setup_info.summary':'model_setup_description',
'model_files.url':'foo',
'model_files.notes':'foo',
'model_files.url':'model_code_inputs.url',
'model_files.notes':'model_code_inputs.notes',
'model_files.file_tree':'foo',
"dataset.url":"model_data.url",
"dataset.notes":"model_data.notes",
"dataset.doi":"model_data.doi",
"dataset.notes":"model_data.notes"
'model_files.existing_identifier':'model_code_inputs.doi',
'model_files.nci_file_path':'foo',
'model_files.include':'include_model_code',
"dataset.url":"model_output_data.url",
"dataset.notes":"model_output_data.notes",
'dataset.existing_identifier':'model_output_data.doi',
'dataset.nci_file_path':'foo',
'dataset.include':'include_model_output'
}
5 changes: 5 additions & 0 deletions .github/scripts/parse_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def parse_issue(issue):

# slug
proposed_slug = data["-> slug"].strip()
data_dict["proposed_slug"] = proposed_slug

slug, log = validate_slug(proposed_slug)
data_dict["slug"] = slug
Expand Down Expand Up @@ -451,8 +452,12 @@ def parse_issue(issue):

# include model output data
model_output = data["-> include model output data?"].strip()
#having this outside the record
#anticipates that we might choose not to build the record if False
data_dict["include_model_output"] = parse_yes_no_choice(model_output)



# model output data
model_output_record = {}

Expand Down
43 changes: 23 additions & 20 deletions .github/scripts/yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,41 +158,44 @@ def ensure_path_starts_with_pattern(file_path, pattern='./graphics/'):
return file_path

def configure_yaml_output_dict(output_dict, issue_dict,
image_path='./graphics/', old_yaml=True, timestamp=False):
image_path='./graphics/',
nci_file_path_base='/g/data/nm08/MATE/',
timestamp=False):

#nci_file_path_base

#make some changes (in-place) to output_dict, to help wrangle the yaml output dict
#many of these simply enforce formatting that is required by the Gatsby YAML frontmatter

#add in the template key for this page
output_dict['templateKey'] = 'model'

#include_model_code
if issue_dict['slug']:
path_slug = issue_dict['slug']
elif issue_dict['proposed_slug']:
path_slug = issue_dict['proposed_slug']
else:
path_slug = 'PENDING'

## add the NCI_file_path
if issue_dict["include_model_output"]:
data_file_path = nci_file_path_base + path_slug + '/model_output_data'
output_dict['dataset']['nci_file_path'] = data_file_path

if issue_dict["include_model_code"]:
code_file_path = nci_file_path_base + path_slug + '/model_code_inputs'
output_dict['model_files']['nci_file_path'] = code_file_path


#change format of ORCiD ids if required
for creator in output_dict['creators']:
creator['ORCID'] = extract_orcid_id(creator['ORCID'])

#change format of ORCiD ids if required
#for contributor in output_dict['contributors']:
# contributor['ORCID'] = extract_orcid_id(contributor['ORCID'])



########################
#Now we're going to to a hotfix to sync the names with the website terminology
########################
#if old_yaml is True:
# output_dict['authors'] = copy.deepcopy(output_dict['creators']) + copy.deepcopy(output_dict['contributors'])
# output_dict['contributor'] = copy.deepcopy(output_dict['submitter'])
# del output_dict['contributors']
# del output_dict['creators']
########################
#... remove this when we've update website code
########################

# Format the datetime as specified, with milliseconds set to .000
if timestamp:
output_dict['date'] = timestamp
#
#

#enforce list and sytax for FOR codes
updated_codes = extract_integers(output_dict['for_codes'])
Expand Down

0 comments on commit 06f8ac3

Please sign in to comment.