File size: 1,349 Bytes
0f21748 69c3447 fd10e96 69c3447 fd10e96 69c3447 d6d9197 69c3447 9b456ab 69c3447 479cb3f 69c3447 479cb3f 69c3447 479cb3f 69c3447 479cb3f 69c3447 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
def assign_typology(components):
# define state rules for every components
STATE_RULES = {
"PCR (Participation Coverage Ratio)": [
(50.0, "Low Alert"),
(20.0, "Medium Alert"),
(0.0, "High Alert")
],
"SPI-A (Silent Participation Inference - Silent Non-Adoption)": [
(50.0, "High Alert"),
(20.0, "Medium Alert"),
(0.0, "Low Alert")
],
"SPI-B (Silent Participation Inference - Silent Adoption)": [
(60.0, "High Alert"),
(30.0, "Medium Alert"),
(0.0, "Low Alert")
],
"PEG (Participation-to-Expression Gap)": [
(60.0, "High Alert"),
(30.0, "Medium Alert"),
(0.0, "Low Alert")
]
}
buckets = {
"High Alert": [],
"Medium Alert": [],
"Low Alert": []
}
for component, data in components.items():
value = data["Value"]
description = data.get("Description", "")
for threshold, state in STATE_RULES[component]:
if value >= threshold:
buckets[state].append({
"Component": component,
"Value": value,
"Description": description
})
break
return buckets
|