npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

chart2txt

v0.7.1

Published

Convert astrological chart data to human-readable text

Readme

chart2txt

An automated text-based astrological pattern detection utility designed primarily for LLM consumption with secondary human readability. This TypeScript library converts complex astrological chart data into structured, standardized text reports or raw JSON data.

npm version

Purpose & Design Philosophy

chart2txt is designed as an automated pattern detection engine that transforms astrological chart data into consistent, structured formats. A primary goal is to provide a clear separation between the analysis engine (which produces a structured AstrologicalReport object) and the text formatter. This allows developers to either use the raw JSON for their own applications or generate an LLM-readable (and human-readable) text report.

Features

  • Single & Multi-Chart Analysis: Natal, event, synastry, and transit chart processing.
  • Comprehensive Aspect Detection: Including all major and minor aspects.
  • Advanced Aspect Patterns: T-Square, Grand Trine, Yod, Stellium, and more.
  • Configurable Orb System: Use presets or define your own aspect strength thresholds.
  • Sign Distributions: Element, modality, and polarity analysis.
  • Dual Output: Generate either a structured JSON AstrologicalReport or a formatted text string.

Installation

npm install chart2txt

Usage Workflows

There are two primary ways to use chart2txt, depending on your needs.

1. Simple Workflow (All-in-One)

This is the easiest way to get a text report. The chart2txt() function handles everything: analysis, default aspect grouping, and formatting.

import { chart2txt } from 'chart2txt';

const natalChart = {
  name: "John Doe",
  planets: [
    { name: 'Sun', degree: 35.5 },
    { name: 'Moon', degree: 120.25 },
  ],
};

// Get a report with default settings
const reportText = chart2txt(natalChart);
console.log(reportText);

// Override the default aspect grouping
const reportWithCustomGrouping = chart2txt(natalChart, {
  aspectStrengthThresholds: {
    tight: 1.0,
    moderate: 5.0
  }
});
console.log(reportWithCustomGrouping);

2. Advanced Workflow (Analyze -> Group -> Format)

This workflow gives you complete control over the process. It is recommended for applications that need to inspect or modify the analysis data before formatting.

This is the workflow demonstrated in the live example page.

import { analyzeCharts, formatReportToText, AstrologicalReport, AspectData } from 'chart2txt';

const synastryData = [
  { name: "Person A", planets: [{ name: 'Sun', degree: 45 }] },
  { name: "Person B", planets: [{ name: 'Sun', degree: 225 }] }
];

// 1. ANALYZE: Get the raw, ungrouped report object.
const report: AstrologicalReport = analyzeCharts(synastryData, { 
  includeAspectPatterns: true 
});

// 2. CUSTOM GROUPING: Apply your own business logic.
// Here, you can implement any grouping strategy you want. For this example,
// we'll group aspects into "Hard" and "Soft" categories.

const hardAspects: AspectData[] = [];
const softAspects: AspectData[] = [];

report.pairwiseAnalyses[0].synastryAspects.forEach(aspect => {
  if (['square', 'opposition'].includes(aspect.aspectType)) {
    hardAspects.push(aspect);
  } else {
    softAspects.push(aspect);
  }
});

// Create a Map to preserve category order.
const myGroupedAspects = new Map<string, AspectData[]>();
myGroupedAspects.set('[HARD ASPECTS]', hardAspects);
myGroupedAspects.set('[SOFT ASPECTS]', softAspects);

// Inject your custom-grouped map back into the report object.
report.pairwiseAnalyses[0].groupedSynastryAspects = myGroupedAspects;

// 3. FORMAT: Generate the text from your modified report object.
const reportText = formatReportToText(report);
console.log(reportText);

API Reference

Core Functions

  • chart2txt(data, [settings]): The all-in-one function.
  • analyzeCharts(data, [settings]): Performs analysis and returns a raw AstrologicalReport.
  • formatReportToText(report): Formats a (potentially modified) AstrologicalReport into a string.
  • groupAspects(aspects, settings): The default aspect grouping logic used by chart2txt().

Configuration (Settings)

The Settings object is composed of three parts:

  • AnalysisSettings: For analyzeCharts()
    • aspectDefinitions: Aspect orbs. Can be a preset string ('traditional', 'modern', 'tight', 'wide') or a custom array.
    • skipOutOfSignAspects: boolean
    • includeAspectPatterns: boolean
    • includeSignDistributions: boolean
    • includeDispositors: boolean | 'finals' - Controls dispositor tree output. true shows all chains, false disables, 'finals' shows only final dispositors and deduplicated cycles.
    • includeHouseOverlays: boolean - Controls house overlays section in synastry charts.
  • GroupingSettings: For groupAspects() or the simple chart2txt() workflow.
    • aspectStrengthThresholds: An object to define orb limits for default grouping, e.g., { tight: 2.0, moderate: 4.0 }.
  • FormattingSettings: For formatReportToText()
    • dateFormat: string
    • houseSystemName: string

Development

# Install dependencies
npm install

# Run tests
npm test

# Build the library
npm run build

License

MIT