Spaces:
Sleeping
Sleeping
Apply Patch 1.1: Offline Astrology Module - Hardcoded city coordinates for deterministic planetary calculations
Browse files- defrag_engine.py +24 -33
defrag_engine.py
CHANGED
|
@@ -5,6 +5,22 @@ import math
|
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
class DefragDeepCompute:
|
| 9 |
def __init__(self):
|
| 10 |
self.user_profile = {}
|
|
@@ -60,39 +76,14 @@ class DefragDeepCompute:
|
|
| 60 |
day=day,
|
| 61 |
hour=hour,
|
| 62 |
minute=minute,
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
"moon_sign": subject.moon.sign if hasattr(subject, 'moon') else "Unknown",
|
| 72 |
-
"rising_sign": subject.first_house.sign if hasattr(subject, 'first_house') else "Unknown",
|
| 73 |
-
"planets": {
|
| 74 |
-
"sun": {"sign": subject.sun.sign, "position": subject.sun.position} if hasattr(subject, 'sun') else {},
|
| 75 |
-
"moon": {"sign": subject.moon.sign, "position": subject.moon.position} if hasattr(subject, 'moon') else {},
|
| 76 |
-
"mercury": {"sign": subject.mercury.sign, "position": subject.mercury.position} if hasattr(subject, 'mercury') else {},
|
| 77 |
-
"venus": {"sign": subject.venus.sign, "position": subject.venus.position} if hasattr(subject, 'venus') else {},
|
| 78 |
-
"mars": {"sign": subject.mars.sign, "position": subject.mars.position} if hasattr(subject, 'mars') else {}
|
| 79 |
-
}
|
| 80 |
-
}
|
| 81 |
-
except Exception as e:
|
| 82 |
-
return {"error": str(e)}
|
| 83 |
-
|
| 84 |
-
# --- MASTER COMPUTE ---
|
| 85 |
-
def execute_defrag(self, birth_data, system_status="normal"):
|
| 86 |
-
"""Master function that runs all engines and returns Soul Log."""
|
| 87 |
-
try:
|
| 88 |
-
# Parse birth data
|
| 89 |
-
name = birth_data.get("name", "User")
|
| 90 |
-
dob_str = birth_data.get("dob")
|
| 91 |
-
year = birth_data.get("year")
|
| 92 |
-
month = birth_data.get("month")
|
| 93 |
-
day = birth_data.get("day")
|
| 94 |
-
hour = birth_data.get("hour", 12)
|
| 95 |
-
minute = birth_data.get("minute", 0)
|
| 96 |
city = birth_data.get("city", "Unknown")
|
| 97 |
nation = birth_data.get("nation", "US")
|
| 98 |
|
|
|
|
| 5 |
import json
|
| 6 |
import os
|
| 7 |
|
| 8 |
+
# PATCH 1.1: OFFLINE COORDINATE SYSTEM
|
| 9 |
+
# Hardcoded city coordinates for deterministic astrology
|
| 10 |
+
CITY_COORDINATES = {
|
| 11 |
+
"Los Angeles": {"lat": 34.0522, "lng": -118.2437, "tz": "America/Los_Angeles"},
|
| 12 |
+
"New York": {"lat": 40.7128, "lng": -74.0060, "tz": "America/New_York"},
|
| 13 |
+
"Chicago": {"lat": 41.8781, "lng": -87.6298, "tz": "America/Chicago"},
|
| 14 |
+
"London": {"lat": 51.5074, "lng": -0.1278, "tz": "Europe/London"},
|
| 15 |
+
"Tokyo": {"lat": 35.6762, "lng": 139.6503, "tz": "Asia/Tokyo"},
|
| 16 |
+
"Paris": {"lat": 48.8566, "lng": 2.3522, "tz": "Europe/Paris"},
|
| 17 |
+
"Berlin": {"lat": 52.5200, "lng": 13.4050, "tz": "Europe/Berlin"},
|
| 18 |
+
"Sydney": {"lat": -33.8688, "lng": 151.2093, "tz": "Australia/Sydney"},
|
| 19 |
+
"Mumbai": {"lat": 19.0760, "lng": 72.8777, "tz": "Asia/Kolkata"},
|
| 20 |
+
"Dubai": {"lat": 25.2048, "lng": 55.2708, "tz": "Asia/Dubai"},
|
| 21 |
+
"Unknown": {"lat": 34.0522, "lng": -118.2437, "tz": "America/Los_Angeles"} # Default fallback
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
class DefragDeepCompute:
|
| 25 |
def __init__(self):
|
| 26 |
self.user_profile = {}
|
|
|
|
| 76 |
day=day,
|
| 77 |
hour=hour,
|
| 78 |
minute=minute,
|
| 79 |
+
|
| 80 |
+
# PATCH 1.1: Use hardcoded coordinates
|
| 81 |
+
coords = CITY_COORDINATES.get(city, CITY_COORDINATES["Unknown"])
|
| 82 |
+
lng=coords["lng"],
|
| 83 |
+
lat=coords["lat"],
|
| 84 |
+
tz_str=coords["tz"],
|
| 85 |
+
online=False
|
| 86 |
+
) minute = birth_data.get("minute", 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
city = birth_data.get("city", "Unknown")
|
| 88 |
nation = birth_data.get("nation", "US")
|
| 89 |
|