# Repository structure and calculation boundaries [简体中文](../zh-CN/architecture.md) · [Project](../../README.md) · [Knowledge](knowledge.md) Birth records, modern time resolution, requested configuration, tropical natal and moment charts, major aspects, text output and independent knowledge are implemented; their usage and constraints are in the [birth](birth.md), [configuration](configuration.md), [chart](chart.md), [aspect](aspects.md), [cross-chart](cross_aspects.md), [result](records.md) and [knowledge](knowledge.md) guides. [Exact transit hits](transits.md) search moving objects against fixed source-chart degrees over a UTC interval. Charts use modern tropical, geocentric coordinates; the underlying knowledge can also be queried without a chart. [Moment charts](moments.md) use explicit instants/locations instead of birth records. Natal and moment results share validation and the concrete UTC/location snapshot. Fixed-instant transit aspects reuse cross geometry, with local motion against zero fixed-side rates; their source/result construction remains native-free. [Solar and lunar returns](returns.md) select same-body conjunction events against a natal chart, then reuse the moment-chart boundary for an explicit location. ## Organization The intended package layout is below. Create modules as their first functionality arrives; a name in this map does not require an empty package or an extra layer. ```text src/astrology/ birth.py Original records and resolved instants objects.py Body, node and axis identities; consumer-specific admission config.py Requested chart and tradition choices celestial.py Concrete adapter to celestial-calendar zodiac.py Zodiac definitions and sign classification houses.py House-placement rules over supplied geometry aspects.py Aspect definitions, orbs, and local motion chart.py Composition and immutable chart results _comparison.py Source compatibility and stored-chart object selection cross_aspects.py Static comparison of supplied charts, retaining both sources transits.py Exact moving-to-fixed-source interval events returns.py Solar/lunar return selection over exact transit hits transit_aspects.py Fixed-instant moving-to-natal geometry and local motion house_overlays.py Directional house placement between supplied charts lunar_phase.py Oriented solar/lunar arc and named lunation types dignities.py Traditional dignities, house rulers and dispositor chains summaries.py Explicit-population statistics and supplied-chart summaries text.py Result tables with supplied vocabulary knowledge/ Concepts, sources, entries, and independent queries tests/ Domain tests and installed-consumer tests docs/en/ English guides and explanations docs/zh-CN/ Matching Chinese guides and explanations ``` Executable definitions live with their domain. `chart.py` composes them and owns the success contract of a complete chart; it does not become the owner of every shared definition. Common values move to a shared module only when actual users need them. `cross_aspects.py` calculates static aspects from two existing charts. It shares the angle and orb calculations in `aspects.py` with natal aspects, but `find_aspects` separately handles single-chart pair eligibility and local motion. `house_overlays.py` passes one chart's longitudes and the other chart's cusps to `house_of` to calculate placements in both directions. `objects.py` defines body, node and axis identities. It distinguishes body/node-only types from the types that also include axes, used by aspects and house overlays. The astronomy adapter maps these identities to calculation targets; the text module looks up names in the supplied catalog. `chart.py` extracts the selected stored longitudes for natal aspects, static cross-chart aspects and house overlays. `_comparison.py` checks coordinate compatibility and object selections for both cross-chart consumers and validates natal target selections for transits. `transits.py` composes the adapter's independent longitude-event queries with selected natal degrees and the aspect branches in `aspects.py`. It retains the source chart without creating a moving-side birth record or house geometry. `returns.py` owns the natal-only, Sun/Moon-only return selection. It delegates to `transit_hits` and returns the same `TransitHits`; chart construction stays with `moment_chart`. Retaining both results preserves the reference search and the chosen chart's location/configuration without a separate return-result family. `dignities.py` owns the sign-ruler table and the house-ruler and dispositor results derived from it. These supplied-chart operations use existing placements without initializing astronomy. `summaries.py` keeps sign distributions and natal lunar phase. Knowledge and calculation remain connected by stable identifiers, described in [Knowledge organization](knowledge.md). Additional UI applications can consume the result later without moving calculation into a frontend. ## Effects boundary Package imports, knowledge queries, classifications, summaries and supplied-chart comparisons do not initialize native astronomy. `natal_chart`, `moment_chart` and `transit_hits` load the astronomy adapter only when called. `return_hits` delegates to `transit_hits` after validating its source/body. `resolve_birth_time` reads timezone data, and `load_catalog` reads packaged knowledge; formatters use a caller-supplied catalog without resource I/O. The [isolation checks](contributing.md#run-the-checks) exercise these boundaries. ## Birth data and time Preserve the original date, calendar, clock reading, precision, location, source, and timezone information. Store the resolved instant and the choices used to resolve it separately. An explicit offset and an IANA timezone are distinct input forms; timezone attachment alone does not detect a DST gap or choose a fold. The current `prepare_natal_input` validates known time, timezone and location; it does not calculate a chart. The `natal_chart` entry point requires that input. Unknown time remains representable and is rejected by preparation rather than replaced with noon. Historical inputs need their own calendar and time-scale contract, including the difference between pre-1972 UT1 and modern UTC. ## Astronomy and astrology The adapter returns astronomical values with their units, coordinate conventions, and provenance. The astrology modules derive signs, house membership, and aspects without discarding those values. Keep these choices distinct: | Choice | Example | What changes | |---|---|---| | Model for a quantity | Ephemeris or Delta T model | Method and supported domain | | Definition or tradition | Whole Sign versus Placidus; tropical versus sidereal | The question being calculated | | Implementation | Cache or an equivalent numerical implementation | Internal execution, unless the public numerical contract changes | An object's identity also survives model selection. Mean nodes, Meeus five-term true nodes, and osculating nodes cannot silently substitute for one another. Constructed composite points retain their construction identity rather than pretending to be physical bodies at a birth instant. ## Composition and failures Represent positions, axes/house geometry, and astrological classifications separately. A complete natal calculation may require all requested components; future partial-chart entry points must state their own success contract. celestial-calendar provides a strict fourteen-object snapshot with rates and houses. The adapter uses it within its joint domain. Selecting seven output objects does not widen that domain. Independent position and house queries are also available upstream; natal calculation continues to use the joint snapshot. Transit searches instead use each selected moving target's event domain and either complete every selected query or fail without a partial result. If requested Placidus geometry is unavailable, the adapter reports that result explicitly and never falls back. Any future fallback requires an explicit policy and must record both requested and effective systems. Equal and Whole Sign also retain the upstream restrictions on undefined axes; they are not universal fallbacks. ## Reproducibility Retain input and resolved configuration, actual models and versions, TT/UT1 values, raw astronomy, and derived results. Defaults must resolve to named choices before being recorded. Results remain in memory. Constructors validate types, ranges and derived-value consistency; they do not authenticate supplied astronomical values, timezone choices or software-version labels, or establish that the values came from the stated instant and location. Cross-chart constructors check all derived hits or placements against their retained sources, under the same limitation. Transit constructors check supplied hit metadata and order without re-running native searches or establishing that a supplied list is complete. A new natal calculation uses resolved UTC and the requested configuration without re-resolving timezones. Structured results, provenance and text output are described in the [result guide](records.md). Numerical agreement with celestial checks composition. Independent cases check the complete result under matched conventions. Tests must exercise timezone ambiguities, wrap, cusp ownership, rounding carry, retrograde motion, exact aspects, and undefined house geometry. ## Delivery order Birth/configuration values, the independent knowledge catalog, the tropical natal chart, major aspects and text output are implemented, with bilingual documentation and installed-package verification. The [project milestones](https://github.com/0xf3cd/astrology/milestones) track task status. The source layout can evolve as these concrete implementations reveal shared needs; a general backend/plugin framework is not a prerequisite.