Yearly forecast: solar return, transits, progressions, profection, eclipses
CI / test (push) Successful in 56s
CI / build (push) Successful in 4m41s
CI / deploy (push) Skipped

- astro-engine: forecast module (solar return moment, slow-planet transits
  with exact dates and periods, natal house ingresses, secondary
  progressions, annual profection, eclipses via Swiss Ephemeris)
- horoscope-api: POST /v1/forecast, solar return chart cast for the place
  of the birthday
- backend: forecasts table, /v1/charts/{id}/forecasts, /v1/forecasts/{id}
  and its analyses using a new 'forecast' unit; current year of life open,
  the next one 30 days before the birthday
- packages: Páros and Család include forecasts (6 000 / 11 000 Ft),
  +1 éves előrejelzés add-on 2 500 Ft; Egy elemzés unchanged
- worker and prompt: forecast kind with five sections and forecast rules
  (trends, no event predictions); no birth data, place or exact age sent
- frontend: /kepletek/{id}/elorejelzes with the solar return wheel, the
  keys of the year, a monthly timeline, transit list and detailed forecast
- data export: forecasts added, model name removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-18 08:19:13 +00:00
co-authored by Claude Opus 5.5
parent 829c33e52f
commit f1bd34c394
42 changed files with 4764 additions and 85 deletions
@@ -4,10 +4,18 @@ import { Paragraphs, Rich } from "./Rich";
const NATAL_ORDER = ["personality", "emotions", "mind", "love", "work", "growth"];
const SYNASTRY_ORDER = ["attraction", "communication", "emotional_bond", "friction", "long_term"];
const FORECAST_ORDER = ["theme", "love", "work", "growth", "timeline"];
const ORDER = { natal: NATAL_ORDER, synastry: SYNASTRY_ORDER, forecast: FORECAST_ORDER };
/** A finished detailed analysis (natal or synastry). */
export function AnalysisView({ content, kind = "natal" }: { content: AnalysisContent; kind?: "natal" | "synastry" }) {
const order = kind === "synastry" ? SYNASTRY_ORDER : NATAL_ORDER;
/** A finished detailed analysis (natal, synastry or yearly forecast). */
export function AnalysisView({
content,
kind = "natal",
}: {
content: AnalysisContent;
kind?: "natal" | "synastry" | "forecast";
}) {
const order = ORDER[kind];
const sections = order.map((key) => content.sections?.[key]).filter((s) => s !== undefined);
return (
<article className="analysis">
@@ -28,7 +36,7 @@ export function AnalysisView({ content, kind = "natal" }: { content: AnalysisCon
<div className="analysis-lists">
{content.strengths && content.strengths.length > 0 && (
<section>
<h3>Erősségek</h3>
<h3>{kind === "forecast" ? "Lehetőségek" : "Erősségek"}</h3>
<ul>
{content.strengths.map((t, i) => (
<li key={i}>
@@ -83,7 +83,15 @@ export function arcPath(r1: number, r2: number, from: number, to: number, start:
}
/** The natal chart as a wheel: zodiac, houses, planets and aspect lines. */
export function ChartWheel({ chart, timeKnown }: { chart: ChartResult; timeKnown: boolean }) {
export function ChartWheel({
chart,
timeKnown,
title = "Születési képlet",
}: {
chart: ChartResult;
timeKnown: boolean;
title?: string;
}) {
const angle = (key: string): Position | null => {
const a = chart.angles?.[key];
return typeof a === "object" && a !== null ? a : null;
@@ -128,7 +136,7 @@ export function ChartWheel({ chart, timeKnown }: { chart: ChartResult; timeKnown
role="img"
aria-labelledby="wheel-title wheel-desc"
>
<title id="wheel-title">Születési képlet</title>
<title id="wheel-title">{title}</title>
<desc id="wheel-desc">
{timeKnown && asc ? `Aszcendens ${signName(asc.sign)}. ` : "Születési idő nélkül, házak nélkül. "}
{description}
@@ -16,8 +16,11 @@ const MAX_POLLS = 120; // 10 minutes
type Step = "offer" | "confirm" | "pay";
/** What is analysed: a natal chart, or a comparison of two charts. */
export type AnalysisTarget = { kind: "natal"; chartId: string } | { kind: "synastry"; synastryId: string };
/** What is analysed: a natal chart, a comparison of two charts, or one year of a chart. */
export type AnalysisTarget =
| { kind: "natal"; chartId: string }
| { kind: "synastry"; synastryId: string }
| { kind: "forecast"; forecastId: string };
const TEXTS = {
natal: {
@@ -46,8 +49,32 @@ const TEXTS = {
unitName: "kapcsolati elemzés",
packages: ["addon_synastry", "couple", "family"],
},
forecast: {
eyebrow: "Éves előrejelzés",
title: "Az éved, fejezetekre bontva",
about:
"Kb. 1800 szó öt fejezetben: az év fő témája, kapcsolatok, munka és pénz, belső fejlődés, és negyedévenként az év menete " +
"a fontos dátumokkal. A végén lehetőségek, kihívások és útravaló. Trendekről és lehetőségekről szól, nem jósol meg biztos eseményeket.",
loadingTitle: "Készül az éves előrejelzésed",
loading:
"Most íródik az öt fejezet a szolár képlet, a tranzitok és a progresszió alapján. Ez általában 1–3 perc; nyugodtan elhagyhatod az oldalt, az előrejelzés elkészül és itt vár.",
item: "Részletes éves előrejelzés",
unitName: "előrejelzés",
packages: ["addon_forecast", "couple", "family"],
},
};
function targetPath(target: AnalysisTarget): string {
switch (target.kind) {
case "natal":
return `/charts/${target.chartId}`;
case "synastry":
return `/synastries/${target.synastryId}`;
case "forecast":
return `/forecasts/${target.forecastId}`;
}
}
/**
* The detailed analysis of a chart or a comparison. A saved one is shown at once; otherwise
* the offer: admins start it free, users with units confirm, others pay
@@ -76,7 +103,7 @@ export function DetailedAnalysis({
const [error, setError] = useState<string | null>(null);
const waiting = analysis?.status === "pending" || analysis?.status === "running";
const t = TEXTS[target.kind];
const path = target.kind === "natal" ? `/charts/${target.chartId}` : `/synastries/${target.synastryId}`;
const path = targetPath(target);
useEffect(() => {
if (!waiting || !analysis) return;
@@ -175,7 +202,7 @@ export function DetailedAnalysis({
) : (
<div className="form-actions">
<button type="button" className="btn btn-primary" onClick={() => setStep("confirm")}>
Részletes elemzés kérése
{target.kind === "forecast" ? "Részletes előrejelzés kérése" : "Részletes elemzés kérése"}
</button>
<span className="hint">
Még {left} {t.unitName}ed van.
@@ -198,7 +225,7 @@ export function DetailedAnalysis({
) : (
<div className="form-actions">
<button type="button" className="btn btn-primary" onClick={() => setStep("pay")}>
Részletes elemzés kérése
{target.kind === "forecast" ? "Részletes előrejelzés kérése" : "Részletes elemzés kérése"}
</button>
{target.kind === "natal" && (
<Link href="/pelda" className="btn btn-ghost">
@@ -0,0 +1,295 @@
import { ASPECTS, MOON_PHASES, POINTS, dms, orbText, pointName, signName } from "@/lib/astro";
import type { Forecast, ForecastContact, SolarReturn } from "@/lib/types";
/** Sign names with the "into" suffix: Kos → Kosba. */
const SIGN_INTO: Record<string, string> = {
aries: "Kosba",
taurus: "Bikába",
gemini: "Ikrekbe",
cancer: "Rákba",
leo: "Oroszlánba",
virgo: "Szűzbe",
libra: "Mérlegbe",
scorpio: "Skorpióba",
sagittarius: "Nyilasba",
capricorn: "Bakba",
aquarius: "Vízöntőbe",
pisces: "Halakba",
};
const ECLIPSE_TYPES: Record<string, string> = {
total: "Teljes",
annular: "Gyűrűs",
hybrid: "Hibrid",
partial: "Részleges",
penumbral: "Félárnyékos",
};
const utcDate = (iso: string) => {
const [y, m, d] = iso.split("-").map(Number);
return new Date(Date.UTC(y, m - 1, d));
};
/** `2026-08-20` → `aug. 20.` */
export function shortDay(iso: string): string {
return new Intl.DateTimeFormat("hu-HU", { month: "short", day: "numeric", timeZone: "UTC" }).format(utcDate(iso));
}
/** `2026-08-20` → `2026. aug. 20.` */
export function longDay(iso: string): string {
return new Intl.DateTimeFormat("hu-HU", { year: "numeric", month: "short", day: "numeric", timeZone: "UTC" }).format(
utcDate(iso),
);
}
function monthTitle(key: string): string {
return new Intl.DateTimeFormat("hu-HU", { year: "numeric", month: "long", timeZone: "UTC" }).format(
utcDate(`${key}-01`),
);
}
const glyph = (id: string) => POINTS[id]?.glyph ?? "";
type Tone = "tense" | "harmonic" | "neutral";
const toneOf = (c: ForecastContact): Tone =>
c.nature === "challenging" ? "tense" : c.nature === "harmonious" ? "harmonic" : "neutral";
function contactTitle(c: ForecastContact, progressed = false): string {
const planet = progressed ? `Progresszív ${pointName(c.planet)}` : pointName(c.planet);
return `${planet} ${ASPECTS[c.aspect]?.hu ?? c.aspect} – születési ${pointName(c.natal_point)}`;
}
function periodText(c: ForecastContact, date?: string): string | null {
const periods = c.periods ?? [];
const p = (date && periods.find((x) => x.start <= date && date <= x.end)) || periods[0];
if (!p) return null;
return p.start === p.end ? `hatás: ${longDay(p.start)}` : `hatás: ${longDay(p.start)} – ${longDay(p.end)}`;
}
interface Event {
date: string;
tone: Tone;
label: string;
title: string;
detail: string[];
}
/** Everything datable in the year, in time order. */
function events(f: Forecast): Event[] {
const out: Event[] = [];
const inYear = (d: string) => d >= f.start && d <= f.end;
for (const c of f.transits) {
const glyphs = `${glyph(c.planet)} ${ASPECTS[c.aspect]?.glyph ?? ""} ${glyph(c.natal_point)}`;
if (c.exact.length === 0) {
out.push({
date: c.peak,
tone: toneOf(c),
label: glyphs,
title: contactTitle(c),
detail: [`legközelebb ${orbText(c.min_orb)}`, periodText(c, c.peak) ?? ""].filter(Boolean),
});
}
c.exact.forEach((e, i) => {
const pass = c.exact.length > 1 ? `${i + 1}. pontos fényszög` : "pontos";
out.push({
date: e.date,
tone: toneOf(c),
label: glyphs,
title: contactTitle(c),
detail: [
e.retrograde ? `${pass}, retrográd mozgás közben` : pass,
periodText(c, e.date) ?? "",
c.house ? `a ${c.house}. házadban` : "",
].filter(Boolean),
});
});
}
for (const h of f.transit_houses) {
for (const i of h.ingresses) {
out.push({
date: i.date,
tone: "neutral",
label: glyph(h.planet),
title: `${pointName(h.planet)} a ${i.house}. házadba lép`,
detail: i.retrograde ? ["retrográd mozgással"] : [],
});
}
}
const p = f.progressions;
for (const c of p.contacts) {
for (const e of c.exact) {
out.push({
date: e.date,
tone: toneOf(c),
label: `${glyph(c.planet)}ᵖ`,
title: contactTitle(c, true),
detail: ["progresszió, pontos"],
});
}
}
for (const b of p.bodies) {
const name = `A progresszív ${pointName(b.planet)}`;
for (const s of b.sign_changes) {
out.push({ date: s.date, tone: "neutral", label: `${glyph(b.planet)}ᵖ`, title: `${name} ${SIGN_INTO[s.sign] ?? signName(s.sign)} lép`, detail: [] });
}
for (const h of b.house_changes) {
out.push({ date: h.date, tone: "neutral", label: `${glyph(b.planet)}ᵖ`, title: `${name} a ${h.house}. házadba lép`, detail: [] });
}
}
if (p.lunar_phase_change) {
out.push({
date: p.lunar_phase_change.date,
tone: "neutral",
label: "☽ᵖ",
title: `Progresszív holdfázis: ${MOON_PHASES[p.lunar_phase_change.phase] ?? p.lunar_phase_change.phase}`,
detail: [],
});
}
for (const e of f.eclipses) {
const what = `${ECLIPSE_TYPES[e.eclipse_type] ?? e.eclipse_type} ${e.kind === "solar" ? "napfogyatkozás" : "holdfogyatkozás"}`;
out.push({
date: e.date,
tone: e.contacts.length > 0 ? "tense" : "neutral",
label: e.kind === "solar" ? "☉●" : "☽●",
title: `${what}, ${signName(e.sign)} ${dms(e.degree_in_sign_dms).split("′")[0]}′`,
detail: [
e.house ? `a ${e.house}. házadban` : "",
...e.contacts.map(
(c) => `${ASPECTS[c.aspect]?.hu ?? c.aspect} a születési ${pointName(c.point)} pontoddal (${orbText(c.orb)})`,
),
].filter(Boolean),
});
}
return out.filter((e) => inYear(e.date)).sort((a, b) => a.date.localeCompare(b.date));
}
/** The year month by month: exact transits, ingresses, progressions, eclipses. */
export function ForecastTimeline({ forecast }: { forecast: Forecast }) {
const list = events(forecast);
const months = new Map<string, Event[]>();
for (const e of list) {
const key = e.date.slice(0, 7);
months.set(key, [...(months.get(key) ?? []), e]);
}
if (list.length === 0) return <p className="muted">Ebben az évben nincs pontos lassú bolygós fényszög.</p>;
return (
<div className="timeline">
<p className="hint">
A lassú bolygók (Jupiter–Plútó) fényszögei a születési képletedhez 1° hatásfokon belül, a progresszió és a
fogyatkozások. Egy tranzit a teljes hatásidő alatt érződik, a pontos napok körül a legerősebben.
</p>
{[...months.entries()].map(([key, items]) => (
<section key={key} className="timeline-month" aria-label={monthTitle(key)}>
<h3>{monthTitle(key)}</h3>
<ol>
{items.map((e, i) => (
<li key={i} className={`timeline-item tone-${e.tone}`}>
<span className="timeline-date">{shortDay(e.date)}</span>
<span className="timeline-glyph" aria-hidden="true">
{e.label}
</span>
<span className="timeline-text">
<strong>{e.title}</strong>
{e.detail.length > 0 && <span className="hint">{e.detail.join(" · ")}</span>}
</span>
</li>
))}
</ol>
</section>
))}
</div>
);
}
/** The main facts of the year at a glance. */
export function ForecastKeys({ forecast, solarReturn }: { forecast: Forecast; solarReturn: SolarReturn | null }) {
const sun = solarReturn?.points.find((p) => p.id === "sun");
const moon = solarReturn?.points.find((p) => p.id === "moon");
const asc = solarReturn?.angles?.ascendant;
const ascSign = typeof asc === "object" && asc !== null ? asc.sign : null;
const prof = forecast.profection;
const pmoon = forecast.progressions.bodies.find((b) => b.planet === "moon");
const exact = forecast.transits.filter((t) => t.exact.length > 0).length;
return (
<div className="card" style={{ gap: 12 }}>
<span className="eyebrow">Az év kulcsai</span>
<dl className="facts">
{ascSign && (
<>
<dt>Szolár Aszcendens</dt>
<dd>
{signName(ascSign)}
{solarReturn?.natal_house_of_ascendant ? `, a születési ${solarReturn.natal_house_of_ascendant}. házadban` : ""}
</dd>
</>
)}
{sun?.house && (
<>
<dt>Szolár Nap</dt>
<dd>a {sun.house}. házban: ez az év fő terepe</dd>
</>
)}
{moon?.house && (
<>
<dt>Szolár Hold</dt>
<dd>
{signName(moon.sign)}, a {moon.house}. házban
</dd>
</>
)}
{prof && (
<>
<dt>Az év ura</dt>
<dd>
{pointName(prof.lord)} ({prof.house}. ház, {signName(prof.sign)})
</dd>
</>
)}
{pmoon && (
<>
<dt>Progresszív Hold</dt>
<dd>
{signName(pmoon.sign)}
{pmoon.house ? `, ${pmoon.house}. ház` : ""} ·{" "}
{MOON_PHASES[forecast.progressions.lunar_phase] ?? forecast.progressions.lunar_phase}
{pmoon.approximate ? " (bizonytalan)" : ""}
</dd>
</>
)}
<dt>Tranzitok</dt>
<dd>
{exact} pontos lassú bolygós fényszög, {forecast.eclipses.length} fogyatkozás
</dd>
</dl>
</div>
);
}
/** All slow-planet transits of the year as a list. */
export function ForecastTransits({ forecast }: { forecast: Forecast }) {
if (forecast.transits.length === 0) return <p className="muted">Ebben az évben nincs lassú bolygós tranzit.</p>;
return (
<ul className="transit-list">
{forecast.transits.map((c, i) => (
<li key={i} className={`tone-${toneOf(c)}`}>
<span className="sym" aria-hidden="true">
{glyph(c.planet)} {ASPECTS[c.aspect]?.glyph} {glyph(c.natal_point)}
</span>
<span>
<strong>{contactTitle(c)}</strong>
{c.planet === c.natal_point && <span className="pill">életciklus</span>}
<span className="hint">
{c.exact.length > 0
? `pontos: ${c.exact.map((e) => longDay(e.date) + (e.retrograde ? " (R)" : "")).join(", ")}`
: `nem pontos az évben, legközelebb ${orbText(c.min_orb)}`}
{(c.periods ?? []).length > 0 &&
` · hatás: ${(c.periods ?? []).map((p) => `${longDay(p.start)} – ${longDay(p.end)}`).join("; ")}`}
{c.house ? ` · ${c.house}. ház` : ""}
</span>
</span>
</li>
))}
</ul>
);
}
@@ -14,6 +14,7 @@ export function contents(p: Package): string[] {
const lines: string[] = [];
if (p.natal) lines.push(`${p.natal} részletes képletelemzés`);
if (p.synastry) lines.push(`${p.synastry} kapcsolati elemzés`);
if (p.forecast) lines.push(`${p.forecast} éves előrejelzés`);
if (p.persons) lines.push(`${p.persons} személy felvétele`);
return lines;
}