Skip to content

Commit

Permalink
Merge branch 'master' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
ddooley authored Jun 21, 2022
2 parents 767abd4 + 52a2265 commit ea261bf
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# version requirement?
dpath==2.0.6
black
linkml_runtime
linkml-runtime
5 changes: 4 additions & 1 deletion script/data-harmonizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ let DataHarmonizer = {
return template_name;
}
catch(err) {
console.log(err);
console.log(err);
$('#missing-template-msg').text(`Unable to load template at path "${template_path}". Path should consist of [template folder name]/[template name] with correct capitalization.`);
$('#missing-template-modal').modal('show');
return false;
}

},
Expand Down
43 changes: 33 additions & 10 deletions template/export.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@

// A list of the export functions keyed by the Export menu name they should appear as:
var EXPORT_FORMATS = {
/*
Example_Format_Name: {
'fileType': 'xls', // or 'xlsx', 'tsv', 'csv'
'status': 'published', // or 'draft'
method: function (dh) {
// Conversion code
const ExportHeaders = new Map([
['sample_name', [optional list of source fields to join values from; delimiter is usually semicolon]],
/// ... list of export table fields in order.
])
};
const sourceFields = dh.getFields(dh.table);
const sourceFieldNameMap = dh.getFieldNameMap(sourceFields);
// Fills in the above mapping (or just set manually above)
dh.getHeaderMap(ExportHeaders, sourceFields, 'BIOSAMPLE');
/*
// Examples:
var EXPORT_FORMATS = {
"IRIDA": {'method': exportIRIDA, 'fileType': 'xls', 'status': 'published'},
"GISAID": {'method': exportGISAID,'fileType': 'xls', 'status': 'published'},
"BioSample": {'method': exportBioSample,'fileType': 'xls', 'status': 'published'},
"CNPHI LaSER": {'method': exportLASER, 'fileType': 'csv (ASCII)', 'status': 'published'}
// Copy headers to 1st row of new export table
const outputMatrix = [[...ExportHeaders.keys()]];
for (const inputRow of dh.getTrimmedData(dh.hot)) {
const outputRow = [];
for (const [headerName, sources] of ExportHeaders) {
// Any custom rules here for data conversions
// Otherwise apply source (many to one) to target field transform:
const value = dh.getMappedField(headerName, inputRow, sources, sourceFields,sourceFieldNameMap, ':', 'Example_Format_Name')
outputRow.push(value);
}
outputMatrix.push(outputRow);
}
return outputMatrix
}
*/
};
*/
2 changes: 1 addition & 1 deletion template/monkeypox/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ var EXPORT_FORMATS = {
['PH_RELATED_RELATIONSHIP_TYPE', []],
['PH_ISOLATION_SITE_DESC', []],
['PH_ISOLATION_SITE', []],
//['PH_SPECIMEN_SOURCE', []], // Calculated field (not in import)
['PH_SPECIMEN_SOURCE', []], // Calculated field (not in import)
['PH_SPECIMEN_SOURCE_DESC', []],
//['PH_ENVIRONMENTAL_MATERIAL', []],
//['PH_ENVIRONMENTAL_SITE', []],
Expand Down

0 comments on commit ea261bf

Please sign in to comment.