How eh30/siderealkundlicraft works
Project Context and Purpose
• Project Type: This is a Python package—essentially a library for astrology calculations.
• Purpose: It calculates astrological charts using the sidereal system. Users can input datetime, location, and ayanamsa choice to compute Lagna and Moon charts, and also get planetary details.
• Key Use Cases: End users (astrology enthusiasts or related applications) call methods to compute planetary positions, chart details (like ascendant and houses), and some specialized data (e.g., Chiron information using external resources).
Analyzing the File Structure
• Top-Level Files:
• .gitignore, LICENSE, README.md, setup.py – standard for package management and distribution.
• Main Package Directory (SiderealKundliCraft):
• AstroChart.py: Contains the Chart class used to process planetary data and generate different charts (like lagnaChart and moonChart).
• SiderealAstroData.py: Implements the AstroData class to compute astrological data based on the input date, time, location, etc.
• __init__.py: Allows the package’s modules to be imported conveniently.
• Tools Submodule (SiderealKundliCraft/tools):
• JulianDate.py: Likely a utility module to convert dates into Julian Day or similar formats, which is essential in astrological calculations.
• __init__.py: Again, standard for a Python subpackage.
• Tests Directory:
• Contains unit tests to verify the functionality of chart generation and degree conversions.
Key Components
a. Data Input & Conversion Module:
• SiderealAstroData: This module captures the input (year, month, day, hour, minute, second, UTC offset, latitude, longitude, and ayanamsa) and processes it into a format used for determining planetary positions.
• Tools (JulianDate): A helper that likely assists in converting input date/time into a more workable time format (e.g., Julian dates).
b. Chart Generation Module:
• AstroChart: This module receives processed data (from AstroData’s planets_rashi() output) and creates the astrological charts. It provides separate methods to generate Lagna and Moon charts.
c. External Resources:
• The README mentions methods that require external resources such as the "resources\swefiles" directory for additional calculations like retrieving Chiron data. This informs part of the design pertaining to integration with necessary external datasets.
d. Testing Framework:
• Tests directory shows how different functionalities (such as degree conversions) are validated. This is essential for ensuring architectural reliability.
Relationships and Interactions
• The user (or a front-end script) triggers the main functionality by calling functions from the package.
• Data Flow:
• The initial input is processed by the AstroData class which computes planetary positions.
• The computed data is passed to the AstroChart class that builds and returns the desired astrological charts.
• Utility tools (like JulianDate) support these operations by providing necessary transformations.
• There is a sequential flow: Input → Data Processing → Chart Building → Output.
Architectural Patterns & Design Principles
• Modular Separation: The system is decomposed into distinct modules (data processing, chart generation, and tool utilities). This separation ensures that changes in calculation logic or chart formatting can be independently managed.
• Extensibility: The design allows easy replacement/enhancement (e.g., the README notes that SiderealKundliCraft was replaced by sideralib, hinting that extensions or forks are a part of its evolution).
• Test-Driven: A dedicated tests directory to validate the core functionalities indicates that the design values correctness and reliability.