haileyhalimj@gmail.com
commited on
Commit
·
9cb13fc
1
Parent(s):
d063295
🔄 Rename method: classify_product_type → standalone_master_filter
Browse files- Rename classify_product_type() method to standalone_master_filter() for better clarity
- Update all 4 method calls within the same file
- Method functionality remains unchanged - still classifies product type and checks if it's a standalone master
- Improves code readability and method naming consistency
- src/demand_filtering.py +7 -4
src/demand_filtering.py
CHANGED
|
@@ -85,7 +85,7 @@ class DemandFilter:
|
|
| 85 |
print(f"Error loading data for filtering: {str(e)}")
|
| 86 |
return False
|
| 87 |
|
| 88 |
-
def
|
| 89 |
"""
|
| 90 |
Classify product type and check if it's a standalone master.
|
| 91 |
|
|
@@ -112,6 +112,9 @@ class DemandFilter:
|
|
| 112 |
def is_product_ready_for_optimization(self, product_id: str) -> Tuple[bool, List[str]]:
|
| 113 |
"""
|
| 114 |
Check if a product is ready for optimization.
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
Returns:
|
| 117 |
Tuple[bool, List[str]]: (is_ready, exclusion_reasons)
|
|
@@ -119,7 +122,7 @@ class DemandFilter:
|
|
| 119 |
exclusion_reasons = []
|
| 120 |
|
| 121 |
# Classify product type
|
| 122 |
-
product_type, is_standalone_master = self.
|
| 123 |
|
| 124 |
# Check line assignment logic
|
| 125 |
has_line_assignment = product_id in self.line_assignments
|
|
@@ -225,7 +228,7 @@ class DemandFilter:
|
|
| 225 |
if included_without_speed > 0:
|
| 226 |
print(f"\n⚠️ DATA QUALITY WARNING: {included_without_speed} included products missing speed data (will use default 106.7 units/hour)")
|
| 227 |
|
| 228 |
-
included_without_hierarchy = sum(1 for pid in included_products if self.
|
| 229 |
if included_without_hierarchy > 0:
|
| 230 |
print(f"⚠️ DATA QUALITY WARNING: {included_without_hierarchy} included products missing hierarchy data")
|
| 231 |
|
|
@@ -257,7 +260,7 @@ class DemandFilter:
|
|
| 257 |
print(f"Warning: Could not load speed data for analysis: {e}")
|
| 258 |
|
| 259 |
for product_id, demand in all_products.items():
|
| 260 |
-
product_type, is_standalone_master = self.
|
| 261 |
is_ready, exclusion_reasons = self.is_product_ready_for_optimization(product_id)
|
| 262 |
|
| 263 |
# Get staffing info
|
|
|
|
| 85 |
print(f"Error loading data for filtering: {str(e)}")
|
| 86 |
return False
|
| 87 |
|
| 88 |
+
def standalone_master_filter(self, product_id: str) -> Tuple[str, bool]:
|
| 89 |
"""
|
| 90 |
Classify product type and check if it's a standalone master.
|
| 91 |
|
|
|
|
| 112 |
def is_product_ready_for_optimization(self, product_id: str) -> Tuple[bool, List[str]]:
|
| 113 |
"""
|
| 114 |
Check if a product is ready for optimization.
|
| 115 |
+
1) Should be right type - standalone master, subkit, prepack
|
| 116 |
+
2) Should have line assignment
|
| 117 |
+
3) Should have staffing requirements
|
| 118 |
|
| 119 |
Returns:
|
| 120 |
Tuple[bool, List[str]]: (is_ready, exclusion_reasons)
|
|
|
|
| 122 |
exclusion_reasons = []
|
| 123 |
|
| 124 |
# Classify product type
|
| 125 |
+
product_type, is_standalone_master = self.standalone_master_filter(product_id)
|
| 126 |
|
| 127 |
# Check line assignment logic
|
| 128 |
has_line_assignment = product_id in self.line_assignments
|
|
|
|
| 228 |
if included_without_speed > 0:
|
| 229 |
print(f"\n⚠️ DATA QUALITY WARNING: {included_without_speed} included products missing speed data (will use default 106.7 units/hour)")
|
| 230 |
|
| 231 |
+
included_without_hierarchy = sum(1 for pid in included_products if self.standalone_master_filter(pid)[0] == "unclassified")
|
| 232 |
if included_without_hierarchy > 0:
|
| 233 |
print(f"⚠️ DATA QUALITY WARNING: {included_without_hierarchy} included products missing hierarchy data")
|
| 234 |
|
|
|
|
| 260 |
print(f"Warning: Could not load speed data for analysis: {e}")
|
| 261 |
|
| 262 |
for product_id, demand in all_products.items():
|
| 263 |
+
product_type, is_standalone_master = self.standalone_master_filter(product_id)
|
| 264 |
is_ready, exclusion_reasons = self.is_product_ready_for_optimization(product_id)
|
| 265 |
|
| 266 |
# Get staffing info
|