mirror of https://github.com/samply/bridgehead.git
feature: Ensured the mapping to legacy ids works
This commit is contained in:
parent
cdf9c359f0
commit
c88919c926
|
@ -13,25 +13,40 @@ function idManagementSetup() {
|
||||||
PATIENTLIST_SEEDS_TRANSFORMED="$(declare -p PATIENTLIST_SEEDS | tr -d '\"' | sed 's/\[/\[\"/g' | sed 's/\]/\"\]/g')"
|
PATIENTLIST_SEEDS_TRANSFORMED="$(declare -p PATIENTLIST_SEEDS | tr -d '\"' | sed 's/\[/\[\"/g' | sed 's/\]/\"\]/g')"
|
||||||
|
|
||||||
# Ensure old ids are working !!!
|
# Ensure old ids are working !!!
|
||||||
legacyIdMapping
|
export IDMANAGEMENT_FRIENDLY_ID=$(legacyIdMapping "$SITE_ID")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO: Map all old site ids to the new ones
|
# Transform into single string array, e.g. 'dktk-test' to 'dktk test'
|
||||||
|
# Usage: transformToSingleStringArray 'dktk-test' -> 'dktk test'
|
||||||
|
function transformToSingleStringArray() {
|
||||||
|
echo "${1//-/ }";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure all Words are Uppercase
|
||||||
|
# Usage: transformToUppercase 'dktk test' -> 'Dktk Test'
|
||||||
|
function transformToUppercase() {
|
||||||
|
result="";
|
||||||
|
for word in $1; do
|
||||||
|
result+=" ${word^}";
|
||||||
|
done
|
||||||
|
echo "$result";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Handle all execeptions from the norm (e.g LMU, TUM)
|
||||||
|
# Usage: applySpecialCases 'Muenchen Lmu Test' -> 'Muenchen LMU Test'
|
||||||
|
function applySpecialCases() {
|
||||||
|
result="$1";
|
||||||
|
result="${result/Lmu/LMU}";
|
||||||
|
result="${result/Tum/TUM}";
|
||||||
|
echo "$result";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Transform current siteids to legacy version
|
||||||
|
# Usage: legacyIdMapping "dktk-test" -> "DktkTest"
|
||||||
function legacyIdMapping() {
|
function legacyIdMapping() {
|
||||||
case ${SITE_ID} in
|
single_string_array=$(transformToSingleStringArray "$1");
|
||||||
"berlin")
|
uppercase_string=$(transformToUppercase "$single_string_array");
|
||||||
export IDMANAGEMENT_FRIENDLY_ID=Berlin
|
normalized_string=$(applySpecialCases "$uppercase_string");
|
||||||
;;
|
echo "$normalized_string" | tr -d ' '
|
||||||
"dresden")
|
|
||||||
export IDMANAGEMENT_FRIENDLY_ID=Dresden
|
|
||||||
;;
|
|
||||||
"frankfurt")
|
|
||||||
export IDMANAGEMENT_FRIENDLY_ID=Frankfurt
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export IDMANAGEMENT_FRIENDLY_ID=$SITE_ID
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue