Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/server/astrology-mathbrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const {
synastryComparison,
calculateSeismograph,
formatTransitTable,
mapT2NAspects,
subjectToAPI,
} = require('../../src/math-brain/orchestrator.js');
const {
compressAspects,
Expand Down Expand Up @@ -3940,3 +3942,12 @@ exports.handler = async function(event) {
};
}
};

// Export functions needed by seismograph-engine (lazy-loaded to avoid circular deps)
exports.enrichDailyAspects = enrichDailyAspects;
exports.selectPoeticAspects = selectPoeticAspects;
exports.weightAspect = weightAspect;
exports.ASPECT_CLASS = ASPECT_CLASS;
exports.BALANCE_CALIBRATION_VERSION = BALANCE_CALIBRATION_VERSION;
exports.SEISMOGRAPH_VERSION = SEISMOGRAPH_VERSION;
exports.WEIGHTS_LEGEND = WEIGHTS_LEGEND;
12 changes: 12 additions & 0 deletions src/math-brain/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const {
getTransitsByDateRange,
getNatalAspectsData,
synastryComparison,
subjectToAPI,
} = require('./api-client');

// ============================================================================
Expand All @@ -45,6 +46,13 @@ const {
formatTransitTable,
} = require('./seismograph-engine');

// ============================================================================
// RAVEN MAPPER MODULE
// ============================================================================
const {
mapT2NAspects,
} = require('../raven-lite-mapper');

// ============================================================================
// ORCHESTRATOR EXPORTS
// ============================================================================
Expand All @@ -62,10 +70,14 @@ module.exports = {
getTransitsByDateRange,
getNatalAspectsData,
synastryComparison,
subjectToAPI,

// Seismograph Engine
calculateSeismograph,
formatTransitTable,

// Raven Mapper
mapT2NAspects,
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/math-brain/seismograph-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const {
classifyMagnitude,
classifyDirectionalBias,
classifyVolatility,
scaleDirectionalBias,
} = require('../../lib/reporting/metric-labels');
const { scaleDirectionalBias } = require('../../lib/reporting/canonical-scaling');

// Lazy-load monolith dependencies to completely break circular reference at static analysis time
let enrichDailyAspectsLazy, selectPoeticAspectsLazy, weightAspectLazy;
Expand Down
57 changes: 51 additions & 6 deletions test/astrology-mathbrain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,66 @@ const path = require('path');
// Mock successful API responses
const MOCK_NATAL_RESPONSE = {
status: "OK",
data: { subject: { name: "Test Person" }, aspects: [{ p1_name: "Sun", p2_name: "Moon", aspect: "trine" }] }
data: {
subject: { name: "Test Person" },
person: {
name: "Test Person",
planets: [
{ name: "Sun", sign: "Taurus", longitude: 45.5, house: 1 },
{ name: "Moon", sign: "Cancer", longitude: 120.3, house: 3 },
{ name: "Mercury", sign: "Taurus", longitude: 50.2, house: 1 },
{ name: "Venus", sign: "Gemini", longitude: 75.1, house: 2 },
{ name: "Mars", sign: "Aries", longitude: 15.4, house: 12 }
]
},
aspects: [{ p1_name: "Sun", p2_name: "Moon", aspect: "trine", orbit: 1.2 }]
},
aspects: [{ p1_name: "Sun", p2_name: "Moon", aspect: "trine", orbit: 1.2 }]
};

const MOCK_SYNASTRY_RESPONSE = {
status: "OK",
data: { first_subject: { name: "Person A" }, second_subject: { name: "Person B" } },
aspects: [{ p1_name: "Sun", p2_name: "Mars", aspect: "conjunction" }]
data: {
first_subject: {
name: "Person A",
person: {
name: "Person A",
planets: [
{ name: "Sun", sign: "Taurus", longitude: 45.5, house: 1 },
{ name: "Moon", sign: "Cancer", longitude: 120.3, house: 3 }
]
}
},
second_subject: {
name: "Person B",
person: {
name: "Person B",
planets: [
{ name: "Sun", sign: "Leo", longitude: 135.2, house: 5 },
{ name: "Mars", sign: "Aries", longitude: 15.4, house: 1 }
]
}
}
},
aspects: [{ p1_name: "Sun", p2_name: "Mars", aspect: "conjunction", orbit: 0.8 }]
};

const MOCK_COMPOSITE_RESPONSE = {
status: "OK",
data: {
composite_subject: { name: "Composite" },
aspects: [{ p1_name: "Sun", p2_name: "Moon", aspect: "square" }]
}
composite_subject: {
name: "Composite",
person: {
name: "Composite",
planets: [
{ name: "Sun", sign: "Gemini", longitude: 90.1, house: 4 },
{ name: "Moon", sign: "Virgo", longitude: 180.5, house: 7 }
]
}
},
aspects: [{ p1_name: "Sun", p2_name: "Moon", aspect: "square", orbit: 0.4 }]
},
aspects: [{ p1_name: "Sun", p2_name: "Moon", aspect: "square", orbit: 0.4 }]
};

const MOCK_TRANSIT_RESPONSE = {
Expand Down