Skip to content

Commit

Permalink
Tidied code
Browse files Browse the repository at this point in the history
  • Loading branch information
ollylucl committed Jul 25, 2024
1 parent 8850527 commit 49bab87
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,9 @@ <h1>Generate text mappings files</h1>

worksheetDataByRows.forEach(worksheetRow => {

// We need to create a new object to hold the row data so we can ensure the
// field names of the object are all lower case...

var rowData = {}

const rowValues = []

columns.map(columnName => rowValues.push(rowData[columnName.toLowerCase()]
columns.map(columnName => rowValues.push(worksheetRow[columnName.toLowerCase()]
+ (!!suffix[columnName] ? suffix[columnName] : "")))

if (!(rowValues.includes("NA") || rowValues.includes("Derived") || rowValues.includes("")))
Expand Down Expand Up @@ -200,18 +195,17 @@ <h1>Generate text mappings files</h1>

const dvWorksheet = wb['Sheets'][Object.keys(wb['Sheets'])[1]]

const dvWorksheetOrderedByRows = XLSX.utils.sheet_to_json(dvWorksheet, { defval: "" });

const dvWorksheetOrderedByRows2 = columnNamesToLowerCase(dvWorksheetOrderedByRows)
const dvWorksheetOrderedByRows = columnNamesToLowerCase(
XLSX.utils.sheet_to_json(dvWorksheet, { defval: "" }))

datasetPrefixes = (getUniqueArrayValues(dvWorksheetOrderedByRows2.map(
datasetPrefixes = (getUniqueArrayValues(dvWorksheetOrderedByRows.map(
worksheetRow => worksheetRow['dataset prefix']).filter(datasetPrefixCell =>
(!!datasetPrefixCell
&& !(datasetPrefixCell.includes("NA") || datasetPrefixCell.includes("Derived") || !datasetPrefixCell))
)))

datasetPrefixes.forEach(datasetPrefix => {
var dvLinkURL = createBlobURL(dvWorksheetOrderedByRows2.filter(
var dvLinkURL = createBlobURL(dvWorksheetOrderedByRows.filter(
worksheetRow => worksheetRow['dataset prefix'] == datasetPrefix), ["dataset prefix",
"derived variable name",
"dataset prefix",
Expand Down

0 comments on commit 49bab87

Please sign in to comment.