# mjohne/planetoid-db architecture

> Architecture diagram of the GitHub repository mjohne/planetoid-db, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mjohne/planetoid-db
- Repository: https://github.com/mjohne/planetoid-db

## Overview

#### Purpose and Runtime
Planetoid-DB is a desktop viewer and analysis tool for the Minor Planet Center’s large fixed-format `MPCORB.DAT` orbital catalog. It is a C# Windows Forms application, built from `Planetoid-DB.csproj`, launched through `Program.cs`, with application settings in `Properties/Settings.settings`.

#### Application Shell and Navigation
The main workspace is `Forms/PlanetoidDBForm.cs`, split by responsibility across `Forms/PlanetoidDBForm.EventHandlers.cs`, `Forms/PlanetoidDBForm.Decoders.cs`, and `Forms/PlanetoidDBForm.DatabaseUpdates.cs`. It owns user-driven control flow: loading/reloading catalog data, decoding records, selection, and launching specialized analysis or display forms. Startup presentation is separated into `Forms/SplashScreenForm.cs` and `Forms/PreloadForm.cs`.

#### Catalog Ingestion and Record Boundary
The core external-data boundary is the MPCORB ASCII file, downloaded or selected by the user and parsed into an internal record model at `Helpers/PlanetoidRecord.cs`. UI acquisition/update paths are represented by `Forms/DatabaseDownloaderForm.cs`, `Forms/ArchiveMpcorbForm.cs`, and main-form database update logic. Parsing/decoding is centralized at the main form rather than a separate persistence or server layer; the application is a local file reader, not a database-backed service.

#### Search, Filtering, and Tabular Exploration
Loaded records feed interactive filtering, searching, sorting, and table-mode presentation. Key surfaces are `Forms/FilterForm.cs`, `Forms/SearchForm.cs`, and `Forms/TableModeForm.cs`. Records can be inspected through `Forms/RecordsForm.cs` and compared through `Forms/DatabaseDifferencesForm.cs`. This is the principal user flow: catalog file → decoded `PlanetoidRecord` collection → filtered/selected records → detail, export, or analysis action.

#### Orbital Computation Layer
Domain calculations are factored into reusable helper classes, operating on selected records and producing derived values for the UI. `Helpers/DerivedElements.cs` calculates orbital derivatives; `Helpers/MoidCalculator.cs` and `Helpers/MaxoidCalculator.cs` support minimum/maximum orbital-intersection-distance analyses; `Helpers/TisserandParameterCalculator.cs` computes Tisserand parameters. Their results are surfaced through focused forms such as `Forms/DerivedOrbitElementsForm.cs`, `Forms/MoidsOfAllMinorPlanetsForm.cs`, and `Forms/TisserandParameterOfAllMinorPlanetsForm.cs`.

#### Visualization and Analytical Workflows
The application offers dedicated WinForms workflows for plotting and astronomical exploration rather than a generic reporting engine. Orbit rendering is handled by `Forms/Orbit2DTopViewForm.cs`, `Forms/Orbit2DSideViewForm.cs`, and `Forms/Orbit3DForm.cs`; aggregate visualization uses `Forms/HistogramsForm.cs` and `Forms/ScatterplotsForm.cs`. Additional workflows include family/resonance analysis and ephemeris lookup via `Forms/AsteroidFamiliesForm.cs`, `Forms/OrbitalResonancesOfAllMinorPlanetsForm.cs`, and `Forms/EphemerisForm.cs`.

#### Import/Export, Resources, and External Sources
The app can download bulk observation data through `Forms/BulkObservationsDataDownloaderForm.cs` and export selected/tabular data via `Forms/ExportDataSheetForm.cs` plus `Helpers/ListViewExporter.cs`. Embedded resources provide observatory codes and terminology documentation (`Resources/ObservatoryCodes.txt`, `Resources/TerminologyDocs/`). The material external service/data authority is the Minor Planet Center, supplying MPCORB and related astronomical datasets; archived catalog references are published as static documentation under `docs/`.

Main entry points: [`Forms/PlanetoidDBForm.cs`](https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.cs) (Main workspace), [`Helpers/PlanetoidRecord.cs`](https://github.com/mjohne/planetoid-db/blob/main/Helpers/PlanetoidRecord.cs) (Planetoid record), [`Program.cs`](https://github.com/mjohne/planetoid-db/blob/main/Program.cs) (Application entry), [`Forms/FilterForm.cs`](https://github.com/mjohne/planetoid-db/blob/main/Forms/FilterForm.cs) (Search, filter & table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Desktop shell"]
  node_project["WinForms project<br/>C# project"]
  node_program["Application entry<br/>startup<br/>[Program.cs]"]
  node_settings["Application settings<br/>[Settings.settings]"]
  node_startup_forms["Splash &amp; preload<br/>startup UI"]
  node_main_form["Main workspace<br/>WinForms shell<br/>[PlanetoidDBForm.cs]"]
end

subgraph group_catalog["Catalog workflow"]
  node_main_decoders["Record decoders<br/>main-form layer"]
  node_main_updates["Catalog updates<br/>main-form layer"]
  node_acquisition["Catalog acquisition<br/>download/archive UI"]
  node_record_model["Planetoid record<br/>domain model<br/>[PlanetoidRecord.cs]"]
  node_exploration["Search, filter &amp; table<br/>exploration UI<br/>[FilterForm.cs]"]
  node_record_inspection["Record inspection &amp; diff<br/>comparison UI<br/>[RecordsForm.cs]"]
end

subgraph group_analysis["Analysis &amp; visualization"]
  node_orbital_calculators["Orbital calculators<br/>calculation layer<br/>[DerivedElements.cs]"]
  node_calculation_forms["Derived orbital analysis<br/>analysis UI"]
  node_orbit_views["2D &amp; 3D orbit views<br/>visualization UI"]
  node_aggregate_charts["Histograms &amp; scatterplots<br/>visualization UI<br/>[HistogramsForm.cs]"]
  node_astronomy_workflows["Families, resonances &amp; ephemeris<br/>analysis UI"]
end

subgraph group_dataio["Data sources &amp; export"]
  node_mpcorb["MPCORB catalog<br/>external ASCII file"]
  node_observation_download["Observation data download<br/>external-data UI"]
  node_export["Data export<br/>export UI"]
  node_mpc_resources["MPC resources<br/>embedded reference data"]
end

node_project -->|"builds"| node_program
node_program -->|"shows"| node_startup_forms
node_program -->|"launches"| node_main_form
node_settings -.->|"configures"| node_main_form
node_startup_forms -->|"continues to"| node_main_form
node_main_form -->|"uses"| node_main_decoders
node_main_form -->|"uses"| node_main_updates
node_main_updates -->|"opens"| node_acquisition
node_acquisition -->|"downloads or selects"| node_mpcorb
node_mpcorb -->|"fixed-format input"| node_main_decoders
node_main_decoders -->|"parses into"| node_record_model
node_record_model -->|"loaded collection"| node_main_form
node_main_form -->|"opens"| node_exploration
node_exploration -->|"selected records"| node_record_inspection
node_exploration -->|"selected/tabular data"| node_export
node_main_form -->|"selected records"| node_orbital_calculators
node_orbital_calculators -->|"derived results"| node_calculation_forms
node_record_model -->|"orbital elements"| node_orbit_views
node_record_model -->|"catalog data"| node_aggregate_charts
node_record_model -->|"analysis input"| node_astronomy_workflows
node_observation_download -.->|"related MPC datasets"| node_mpcorb
node_mpc_resources -.->|"reference data"| node_main_form

click node_project "https://github.com/mjohne/planetoid-db/blob/main/Planetoid-DB.csproj"
click node_program "https://github.com/mjohne/planetoid-db/blob/main/Program.cs"
click node_settings "https://github.com/mjohne/planetoid-db/blob/main/Properties/Settings.settings"
click node_startup_forms "https://github.com/mjohne/planetoid-db/blob/main/Forms/SplashScreenForm.cs"
click node_main_form "https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.cs"
click node_main_decoders "https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.Decoders.cs"
click node_main_updates "https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.DatabaseUpdates.cs"
click node_acquisition "https://github.com/mjohne/planetoid-db/blob/main/Forms/DatabaseDownloaderForm.cs"
click node_record_model "https://github.com/mjohne/planetoid-db/blob/main/Helpers/PlanetoidRecord.cs"
click node_exploration "https://github.com/mjohne/planetoid-db/blob/main/Forms/FilterForm.cs"
click node_record_inspection "https://github.com/mjohne/planetoid-db/blob/main/Forms/RecordsForm.cs"
click node_orbital_calculators "https://github.com/mjohne/planetoid-db/blob/main/Helpers/DerivedElements.cs"
click node_calculation_forms "https://github.com/mjohne/planetoid-db/blob/main/Forms/DerivedOrbitElementsForm.cs"
click node_orbit_views "https://github.com/mjohne/planetoid-db/blob/main/Forms/Orbit2DTopViewForm.cs"
click node_aggregate_charts "https://github.com/mjohne/planetoid-db/blob/main/Forms/HistogramsForm.cs"
click node_astronomy_workflows "https://github.com/mjohne/planetoid-db/blob/main/Forms/AsteroidFamiliesForm.cs"
click node_observation_download "https://github.com/mjohne/planetoid-db/blob/main/Forms/BulkObservationsDataDownloaderForm.cs"
click node_export "https://github.com/mjohne/planetoid-db/blob/main/Forms/ExportDataSheetForm.cs"
click node_mpc_resources "https://github.com/mjohne/planetoid-db/blob/main/Resources/ObservatoryCodes.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_project,node_program,node_settings,node_startup_forms,node_main_form toneBlue
class node_main_decoders,node_main_updates,node_acquisition,node_record_model,node_exploration,node_record_inspection toneAmber
class node_orbital_calculators,node_calculation_forms,node_orbit_views,node_aggregate_charts,node_astronomy_workflows toneMint
class node_mpcorb,node_observation_download,node_export,node_mpc_resources toneRose
```

## Components

### Desktop shell

- [WinForms project](https://github.com/mjohne/planetoid-db/blob/main/Planetoid-DB.csproj): C# project · `Planetoid-DB.csproj`
- [Application entry](https://github.com/mjohne/planetoid-db/blob/main/Program.cs): startup · `Program.cs`
- [Application settings](https://github.com/mjohne/planetoid-db/blob/main/Properties/Settings.settings): settings · `Properties/Settings.settings`
- [Splash & preload](https://github.com/mjohne/planetoid-db/blob/main/Forms/SplashScreenForm.cs): startup UI · `Forms/SplashScreenForm.cs`
- [Main workspace](https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.cs): WinForms shell · Owns catalog state, selection, and workflow navigation. · `Forms/PlanetoidDBForm.cs`

### Catalog workflow

- [Record decoders](https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.Decoders.cs): main-form layer · `Forms/PlanetoidDBForm.Decoders.cs`
- [Catalog updates](https://github.com/mjohne/planetoid-db/blob/main/Forms/PlanetoidDBForm.DatabaseUpdates.cs): main-form layer · `Forms/PlanetoidDBForm.DatabaseUpdates.cs`
- [Catalog acquisition](https://github.com/mjohne/planetoid-db/blob/main/Forms/DatabaseDownloaderForm.cs): download/archive UI · `Forms/DatabaseDownloaderForm.cs`
- [Planetoid record](https://github.com/mjohne/planetoid-db/blob/main/Helpers/PlanetoidRecord.cs): domain model · `Helpers/PlanetoidRecord.cs`
- [Search, filter & table](https://github.com/mjohne/planetoid-db/blob/main/Forms/FilterForm.cs): exploration UI · `Forms/FilterForm.cs`
- [Record inspection & diff](https://github.com/mjohne/planetoid-db/blob/main/Forms/RecordsForm.cs): comparison UI · `Forms/RecordsForm.cs`

### Analysis & visualization

- [Orbital calculators](https://github.com/mjohne/planetoid-db/blob/main/Helpers/DerivedElements.cs): calculation layer · Derived elements, MOID/MAXOID, and Tisserand calculations. · `Helpers/DerivedElements.cs`
- [Derived orbital analysis](https://github.com/mjohne/planetoid-db/blob/main/Forms/DerivedOrbitElementsForm.cs): analysis UI · `Forms/DerivedOrbitElementsForm.cs`
- [2D & 3D orbit views](https://github.com/mjohne/planetoid-db/blob/main/Forms/Orbit2DTopViewForm.cs): visualization UI · `Forms/Orbit2DTopViewForm.cs`
- [Histograms & scatterplots](https://github.com/mjohne/planetoid-db/blob/main/Forms/HistogramsForm.cs): visualization UI · `Forms/HistogramsForm.cs`
- [Families, resonances & ephemeris](https://github.com/mjohne/planetoid-db/blob/main/Forms/AsteroidFamiliesForm.cs): analysis UI · `Forms/AsteroidFamiliesForm.cs`

### Data sources & export

- **MPCORB catalog**: external ASCII file · Fixed-format orbital catalog from the Minor Planet Center.
- [Observation data download](https://github.com/mjohne/planetoid-db/blob/main/Forms/BulkObservationsDataDownloaderForm.cs): external-data UI · `Forms/BulkObservationsDataDownloaderForm.cs`
- [Data export](https://github.com/mjohne/planetoid-db/blob/main/Forms/ExportDataSheetForm.cs): export UI · `Forms/ExportDataSheetForm.cs`
- [MPC resources](https://github.com/mjohne/planetoid-db/blob/main/Resources/ObservatoryCodes.txt): embedded reference data · Observatory codes and terminology documentation. · `Resources/ObservatoryCodes.txt`

## Connections

- WinForms project → Application entry: builds
- Application entry → Splash & preload: shows
- Application entry → Main workspace: launches
- Application settings → Main workspace: configures
- Splash & preload → Main workspace: continues to
- Main workspace → Record decoders: uses
- Main workspace → Catalog updates: uses
- Catalog updates → Catalog acquisition: opens
- Catalog acquisition → MPCORB catalog: downloads or selects
- MPCORB catalog → Record decoders: fixed-format input
- Record decoders → Planetoid record: parses into
- Planetoid record → Main workspace: loaded collection
- Main workspace → Search, filter & table: opens
- Search, filter & table → Record inspection & diff: selected records
- Search, filter & table → Data export: selected/tabular data
- Main workspace → Orbital calculators: selected records
- Orbital calculators → Derived orbital analysis: derived results
- Planetoid record → 2D & 3D orbit views: orbital elements
- Planetoid record → Histograms & scatterplots: catalog data
- Planetoid record → Families, resonances & ephemeris: analysis input
- Observation data download → MPCORB catalog: related MPC datasets
- MPC resources → Main workspace: reference data
