File size: 1,741 Bytes
1c7bc31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from typing import Dict, Any, List
from .config import PM_THRESHOLDS

def predictive_maintenance(car_year: int = None, mileage_km: int = None) -> List[str]:
    tips = []
    if mileage_km is not None:
        if mileage_km % PM_THRESHOLDS["engine_oil"] > PM_THRESHOLDS["engine_oil"] - 1000:
            tips.append("Engine oil service due soon based on mileage.")
        if mileage_km % PM_THRESHOLDS["tire_rotation"] > PM_THRESHOLDS["tire_rotation"] - 500:
            tips.append("Consider tire rotation and balancing.")
        if mileage_km > 50000:
            tips.append("Inspect suspension components (shocks/struts) for wear.")
        if mileage_km > 80000:
            tips.append("Check timing belt/chain and water pump as per manufacturer schedule.")
    if car_year is not None and car_year < 2015:
        tips.append("Vehicle age suggests comprehensive electrical & rubber parts inspection.")
    if not tips:
        tips.append("No immediate predictive maintenance items flagged.")
    return tips

def advanced_suggestions(top_issues: Dict[str, Any]) -> List[str]:
    tips = []
    if "engine_leak" in top_issues:
        tips.append("After fixing leak, clean engine bay and monitor oil level weekly for 1 month.")
    if "brake_wear" in top_issues:
        tips.append("Bed-in new pads and avoid hard braking for first 200 km.")
    if "flat_tire" in top_issues:
        tips.append("Check alignment and inspect other tires for embedded nails/screws.")
    if "rust" in top_issues:
        tips.append("Apply rust protection and inspect underbody after monsoon season.")
    if "cracked_windshield" in top_issues:
        tips.append("Avoid potholes and sudden temperature changes until replacement.")
    return tips