Commit fa11200b authored by Pithon Kabiro's avatar Pithon Kabiro
Browse files

New function: get abbreviations

Returns the abbreviated versions of building IDs, phenomenon names
and sensor sampling rates
parent afa290c1
......@@ -158,3 +158,50 @@ const getSelectedOptionsFromDropDownLists = function () {
return [selectedBuilding, selectedSensor, selectedSamplingRate];
};
/**
* Get the abbreviated form of building IDs, phenomenon names and sensor sampling rates
* @param {String} buildingFullForm A string representation of the full form of a building ID
* @param {String} phenomenonFullForm A string representation of the full form of a phenomenon name
* @param {String} samplingRateFullForm A string representation of the full form of a sensor's sampling rate
* @returns {Array} An array of abbreviated strings
*/
const getBuildingSensorSamplingRateAbbreviation = function (
buildingFullForm,
phenomenonFullForm,
samplingRateFullForm
) {
const fullFormToAbbreviationMapping = {
buildings: {
"Bau 101": "101",
"Bau 102": "102",
"Bau 107": "107",
"Bau 112": "112, 118",
"Bau 125": "125",
"Bau 225": "225",
},
phenomenon: {
Vorlauftemperatur: "vl",
Rücklauftemperatur: "rl",
Durchfluss: "flow",
Leistung: "power",
Energie: "energy",
Energie_VERBR: "energy_verb",
},
samplingRate: {
"15 min": "15min",
"60 min": "60min",
},
};
const buildingAbbrev =
fullFormToAbbreviationMapping["buildings"]?.[buildingFullForm];
const phenomenonAbbrev =
fullFormToAbbreviationMapping["phenomenon"]?.[phenomenonFullForm];
const samplingRateAbbrev =
fullFormToAbbreviationMapping["samplingRate"]?.[samplingRateFullForm];
return [buildingAbbrev, phenomenonAbbrev, samplingRateAbbrev];
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment