-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add directional flagging, change default target type
- Loading branch information
Showing
8 changed files
with
121 additions
and
67 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
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,33 @@ | ||
export default function checkFlagDirection(outlierStatus: string, | ||
flagSettings: { process_flag_type: string, | ||
improvement_direction: string}): string { | ||
if (outlierStatus === "none") { | ||
return outlierStatus; | ||
} | ||
|
||
const increaseDirectionMap: Record<string, string> = { | ||
"upper" : "improvement", | ||
"lower" : "deterioration" | ||
} | ||
const decreaseDirectionMap: Record<string, string> = { | ||
"lower" : "improvement", | ||
"upper" : "deterioration" | ||
} | ||
const neutralDirectionMap: Record<string, string> = { | ||
"lower" : "neutral_low", | ||
"upper" : "neutral_high" | ||
} | ||
const flagDirectionMap: Record<string, string> = { | ||
"increase" : increaseDirectionMap[outlierStatus], | ||
"decrease" : decreaseDirectionMap[outlierStatus], | ||
"neutral" : neutralDirectionMap[outlierStatus] | ||
} | ||
|
||
const mappedFlag: string = flagDirectionMap[flagSettings.improvement_direction]; | ||
|
||
if (flagSettings.process_flag_type !== "both") { | ||
return mappedFlag === flagSettings.process_flag_type ? mappedFlag : "none"; | ||
} else { | ||
return mappedFlag; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,24 +1,12 @@ | ||
import type { limitData } from "../Classes"; | ||
import { between } from "../Functions" | ||
|
||
export default function three_sigma(value: number, flag_direction: string, | ||
limits: limitData): boolean { | ||
if (limits.ul99 === null && limits.ll99 === null) { | ||
return false; | ||
} else if (limits.ul99 === null) { | ||
flag_direction = "lower" | ||
} else if (limits.ll99 === null) { | ||
flag_direction = "upper" | ||
export default function three_sigma(value: number, | ||
limits: limitData): string { | ||
if (value < limits.ll99) { | ||
return "lower"; | ||
} else if (value > limits.ul99) { | ||
return "upper"; | ||
} else { | ||
return "none"; | ||
} | ||
|
||
if (!between(value, limits.ll99, limits.ul99)) { | ||
if (flag_direction === "both") { | ||
return true; | ||
} else if (flag_direction == "upper") { | ||
return value > limits.ul99; | ||
} else if (flag_direction == "lower") { | ||
return value < limits.ll99; | ||
} | ||
} | ||
return false; | ||
} |
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 |
---|---|---|
@@ -1,24 +1,12 @@ | ||
import type { limitData } from "../Classes"; | ||
import { between } from "../Functions" | ||
|
||
export default function two_sigma(value: number, flag_direction: string, | ||
limits: limitData): boolean { | ||
if (limits.ul95 === null && limits.ll95 === null) { | ||
return false; | ||
} else if (limits.ul95 === null) { | ||
flag_direction = "lower" | ||
} else if (limits.ll95 === null) { | ||
flag_direction = "upper" | ||
export default function two_sigma(value: number, | ||
limits: limitData): string { | ||
if (value < limits.ll99) { | ||
return "lower"; | ||
} else if (value > limits.ul99) { | ||
return "upper"; | ||
} else { | ||
return "none"; | ||
} | ||
|
||
if (!between(value, limits.ll95, limits.ul95)) { | ||
if (flag_direction === "both") { | ||
return true; | ||
} else if (flag_direction === "upper") { | ||
return value > limits.ul95; | ||
} else if (flag_direction === "lower") { | ||
return value < limits.ll95; | ||
} | ||
} | ||
return false; | ||
} |
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