diff --git a/lib/DataHarmonizer.js b/lib/DataHarmonizer.js index b34a1822..4c012c40 100644 --- a/lib/DataHarmonizer.js +++ b/lib/DataHarmonizer.js @@ -1763,14 +1763,27 @@ class DataHarmonizer { } /** + * Given a table row, output a value based on the following conditional: + * ``` + * if (value in headerNameToCheck == valToMatch) { + * return value in headerNameToOutput; + * } else { + * return ""; + * } + * ``` * TODO is there any need for additional complexities in getMappedField? * i.e., transforming field - * @param headerNameToCheck - * @param valToMatch - * @param headerNameToOutput - * @param inputRow - * @param sourceFieldNameMap - * @return TODO + * @param {string} headerNameToCheck Field name of user-inputted vals to check + * against `valToMatch`. + * @param {string} valToMatch Value to match user-inputted vals against during + * conditional. + * @param {string} headerNameToOutput Field name of user-inputted vals to + * return if conditional is satisfied. + * @param {string[]} inputRow Table row. + * @param {Object} sourceFieldNameMap `getFieldNameMap` return + * val. + * @return {string} `valToMatch` if condition is satisfied; empty str + * otherwise. */ getIfThenField( headerNameToCheck, @@ -1785,12 +1798,17 @@ class DataHarmonizer { } /** - * TODO - * @param headerNameToCheck - * @param matchedValsSet - * @param inputRow - * @param sourceFieldNameMap - * @return {string} + * Given a table row, find the intersection of user-inputted values in + * `headerNameToCheck` and vals in `matchedValsSet`. + * @param {string} headerNameToCheck Field name of user-inputted vals to + * intersect against `matchedValsSet`. + * @param {Set} matchedValsSet Set of values that user-inputted vals + * are intersected against. + * @param {string[]} inputRow Table row. + * @param {Object} sourceFieldNameMap `getFieldNameMap` return + * val. + * @return {string} Intersection of user-inputted values in + * `headerNameToCheck` and vals in `matchedValsSet`. */ getMatchedValsField( headerNameToCheck, @@ -1809,11 +1827,14 @@ class DataHarmonizer { } /** - * TODO - * @param headerNamesToCheck - * @param inputRow - * @param sourceFieldNameMap - * @return {string} + * Given a table row, and an ordered collection of field names, return the + * first non-null field val. + * @param {string[]} headerNamesToCheck Field names of user-inputted vals to + * check for non-null vals, in 0-indexed order. + * @param {string[]} inputRow Table row. + * @param {Object} sourceFieldNameMap `getFieldNameMap` return + * val. + * @return {string} First non-null val in `headerNamesToCheck`. */ getFirstNonNullField(headerNamesToCheck, inputRow, sourceFieldNameMap) { const nullValsSet = new Set(