-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #704 from CMSgov/feat/QPPA-7860
QPPA-7860: Add new benchmark build script
- Loading branch information
Showing
12 changed files
with
94 additions
and
928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
currentPerformanceYear=$(($1)) | ||
maxPerformanceYear=2023 | ||
|
||
Red='\033[0;31m' | ||
Green='\033[0;32m' | ||
bold=$(tput bold) | ||
|
||
# checks the exit code of the last command and exits if not successful code 0. | ||
function exitOnFailure () { | ||
if (( $? != 0 )); then | ||
echo -e "${Red}\n${bold}Update failed." | ||
exit | ||
fi | ||
} | ||
|
||
# This script is not made to work for years prior to 2023. | ||
if (( $currentPerformanceYear >= 2023 )) && (( $currentPerformanceYear <= $maxPerformanceYear )); then | ||
|
||
echo -e "Compiling Typescript..." | ||
tsc -p . | ||
|
||
|
||
# Convert all CSV benchmark files to JSON. | ||
for FILE in staging/$currentPerformanceYear/benchmarks/*; do | ||
re='^(.+\/)*(.+)\.(.+)$' | ||
if [[ $FILE =~ $re ]]; then | ||
echo -e "Converting $FILE.csv to JSON..." | ||
node dist/scripts/benchmarks/csv-json-converter.js \ | ||
staging/$currentPerformanceYear/benchmarks/${BASH_REMATCH[2]}.csv $currentPerformanceYear \ | ||
> staging/$currentPerformanceYear/benchmarks/json/${BASH_REMATCH[2]}.json | ||
|
||
# validate the JSON files before combining | ||
node dist/scripts/benchmarks/validation.business.js \ | ||
${BASH_REMATCH[2]}.json $currentPerformanceYear | ||
|
||
exitOnFailure | ||
fi | ||
done | ||
|
||
|
||
# merge all benchmark files into one. | ||
echo -e "Merging individual JSON files..." | ||
node dist/scripts/benchmarks/merge-benchmark-files.js \ | ||
staging/$currentPerformanceYear/benchmarks/json/ \ | ||
> ./benchmarks/$currentPerformanceYear.json | ||
|
||
|
||
# Validate benchmarks. | ||
echo -e "Validating new benchmarks JSON." | ||
cat benchmarks/$currentPerformanceYear.json | node scripts/validate-data.js benchmarks $currentPerformanceYear | ||
exitOnFailure | ||
|
||
echo -e "${Green}\n${bold}Update complete." | ||
exit | ||
|
||
else | ||
echo -e "${Red}${bold}Performance year ${currentPerformanceYear} not valid." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.