diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0c3eb64e..478d10b7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,8 +26,5 @@ jobs: - name: Install Dependencies run: npm ci - - name: Generate Schema - run: npm run schema - - name: Publish Package to npm run: npm publish diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8c9c9833..491e287b 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -8,7 +8,7 @@ on: jobs: validate: - name: Type Safety & Schema + name: Type Safety runs-on: ubuntu-latest steps: @@ -26,13 +26,3 @@ jobs: - name: Type Check run: npm run lint - - - name: Generate Schema - run: npm run schema - - - name: Upload Schema Artifact - uses: actions/upload-artifact@v7 - with: - name: schema - path: src/schema.json - if-no-files-found: error diff --git a/.gitignore b/.gitignore index a5ab3eea..3465ead0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ node_modules/ -src/ docs/ diff --git a/README.md b/README.md index a675f99f..274c299d 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,8 @@ [![npm version](https://img.shields.io/npm/v/@pseinfo/database-schema?style=flat-square)](https://npmjs.com/@pseinfo/database-schema) [![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](https://github.com/pseinfo/database-schema/blob/master/LICENSE) -[![Schema](https://img.shields.io/badge/Schema-JSON-blue?style=flat-square)](https://unpkg.com/@pseinfo/database-schema/src/schema.json) -Strict TypeScript definitions and JSON Schema for structured representation of chemical elements, minerals, nuclides, mixtures, and compounds used by the [periodic table database](https://github.com/pseinfo/database). +Strict TypeScript definitions for structured representation of chemical elements, minerals, nuclides, mixtures, and compounds used by the [periodic table database](https://github.com/pseinfo/database). Visit [technical documentation](https://pseinfo.github.io/database-schema) for in-depth insights into the schema architecture. @@ -12,11 +11,11 @@ Visit [technical documentation](https://pseinfo.github.io/database-schema) for i The `@pseinfo/database-schema` is designed as a modular, five-tier architecture that ensures both strict type safety and scientific flexibility. -1. **Abstract layer:** Defines the fundamental behavior of scientific data, including measurements, uncertainties, and experimental conditions. -2. **Collection layer:** Aggregates properties into thematic modules such as atomic physics, thermodynamics, and crystallographic analysis. -3. **Data layer:** Provides the "raw" scientific content (e.g., `ElementData`), designed for manual maintenance without system-generated metadata. -4. **Entity layer:** Enriches the data with automated `@metadata` (hashes, timestamps, versions) to create complete database records (e.g., `Element`). -5. **Registry layer:** Composes these entities into global dictionaries (e.g., `ElementEntity`), providing a unified structure consistent across all domains. +1. **Abstract layer:** Defines the fundamental behavior of scientific data, including measurements, uncertainties, and experimental conditions. +2. **Collection layer:** Aggregates properties into thematic modules such as atomic physics, thermodynamics, and crystallographic analysis. +3. **Data layer:** Provides the "raw" scientific content (e.g., `ElementData`), designed for manual maintenance without system-generated metadata. +4. **Entity layer:** Enriches the data with automated `@metadata` (hashes, timestamps, versions) to create complete database records (e.g., `Element`). +5. **Domain layer:** Composes these entities into global dictionaries (e.g., `ElementDomain`), providing a unified structure consistent across all domains. ## Scientific Property Model @@ -24,13 +23,13 @@ A central principle of the schema is the encapsulation of data within a robust * Experimental conditions like temperature and pressure are natively supported as context for every property, while a citation system ensures that every data point can be traced back to its original reference in the scientific literature. -## Blob, Unit & Reference Registries +## Registries -The schema promotes data integrity through centralized registries for physical quantities, media blobs, and academic references. The **unit registry** provides a strictly typed framework for dimensions and prefixes, ensuring that physical properties like molar mass or magnetic susceptibilities are always represented with correct SI-compliant symbols. +The schema promotes data integrity through centralized registries for physical quantities, media blobs, academic references, organizations and people. -**Blobs** handle the storage of large media files (e.g., crystallographic structures, spectral data) in a way that is decoupled from the core database, allowing for efficient management and retrieval without bloating the primary data records. +The **unit registry** provides a strictly typed framework for dimensions and prefixes, ensuring that physical properties always represented with correct SI-compliant symbols. **Blobs** handle the storage of large media files (e.g., structure files, spectral data) in a way that is decoupled from the core database, allowing for efficient management and retrieval without bloating the primary data records. The **reference registry** manages the bibliography of the entire database, allowing for a deduplicated and verifiable chain of custody for all scientific information. -Complementing this, the **reference registry** manages the bibliography of the entire database, allowing for a deduplicated and verifiable chain of custody for all scientific information. +**Person** and **organization registries** maintain the metadata of scientists and institutions involved in discovery, research, and data curation, providing a historical and social context for the scientific data. ## Database Entities @@ -50,9 +49,9 @@ Using these factories, developers benefit from: Example: ```typescript -import type { ElementFactory } from '@pseinfo/database-schema/types/entity/element'; -import { ElementSymbol } from '@pseinfo/database-schema/enum/element'; -import { EntityType } from '@pseinfo/database-schema/enum/util'; +import type { ElementFactory } from '@pseinfo/database-schema/model/domain/element'; +import { ElementSymbol } from '@pseinfo/database-schema/enum/science/element'; +import { DomainType } from '@pseinfo/database-schema/enum/system/domain'; export default ( { type: EntityType.ELEMENT, @@ -72,7 +71,7 @@ export default ( { ## Package -The package provides the complete set of TypeScript definitions and JSON Schema for Draft-07 compliance, allowing for runtime validation in heterogeneous environments. +The package provides the complete set of TypeScript definitions, allowing for validation checks in heterogeneous environments. Developers have access to the full suite of internal enums, utility types, and the high-level structural model, enabling the integration of chemical data into specialized applications with absolute structural certainty. diff --git a/config/units.ts b/config/units.ts new file mode 100644 index 00000000..234a0c02 --- /dev/null +++ b/config/units.ts @@ -0,0 +1,410 @@ +/** + * @file config/units.ts + * @description Central registry for physical quantities, their SI dimensions, and associated units. + * Defines the scientific framework for unit conversion and validation. + */ + +import type { UnitConfig } from '../model/registry/unit'; + +export default ( { + // --- BASE SI QUANTITIES --- + time: { + symbol: 't', + vector: [ 1, 0, 0, 0, 0, 0, 0 ], + units: [ 's', 'min', 'h', 'd', 'a', 't{P}' ], + prefixableUnits: [ 's' ], + baseUnit: 's' + }, + length: { + symbol: 'l', + vector: [ 0, 1, 0, 0, 0, 0, 0 ], + units: [ 'm', 'in', 'ft', 'yd', 'mi', 'Å', 'Ø', 'l{P}' ], + prefixableUnits: [ 'm' ], + baseUnit: 'm' + }, + mass: { + symbol: 'm', + vector: [ 0, 0, 1, 0, 0, 0, 0 ], + units: [ 'g', 't', 'oz', 'lb', 'u', 'Da', 'm{P}' ], + prefixableUnits: [ 'g' ], + baseUnit: 'g' + }, + electricCurrent: { + symbol: 'I', + vector: [ 0, 0, 0, 1, 0, 0, 0 ], + units: [ 'A', 'Bi' ], + prefixableUnits: [ 'A' ], + baseUnit: 'A' + }, + temperature: { + symbol: 'T', + vector: [ 0, 0, 0, 0, 1, 0, 0 ], + units: [ 'K', '°C', '°F', 'T{P}' ], + prefixableUnits: [], + baseUnit: 'K' + }, + amountOfSubstance: { + symbol: 'n', + vector: [ 0, 0, 0, 0, 0, 1, 0 ], + units: [ 'mol' ], + prefixableUnits: [ 'mol' ], + baseUnit: 'mol' + }, + luminousIntensity: { + symbol: 'I{v}', + vector: [ 0, 0, 0, 0, 0, 0, 1 ], + units: [ 'cd' ], + prefixableUnits: [], + baseUnit: 'cd' + }, + + // --- KINEMATICS & MECHANICS --- + area: { + symbol: 'a', + vector: [ 0, 2, 0, 0, 0, 0, 0 ], + units: [ 'm[2]', 'b' ], + prefixableUnits: [ 'm[2]' ], + baseUnit: 'm[2]' + }, + volume: { + symbol: 'V', + vector: [ 0, 3, 0, 0, 0, 0, 0 ], + units: [ 'm[3]', 'L', 'ml', 'cm[3]', 'cc' ], + prefixableUnits: [ 'm[3]', 'L', 'ml', 'cm[3]' ], + baseUnit: 'm[3]' + }, + angle: { + symbol: '', + vector: [ 0, 0, 0, 0, 0, 0, 0 ], + units: [ '°', 'rad', 'ʹ', 'ʺ', 'grad', 'turn' ], + prefixableUnits: [], + baseUnit: '°' + }, + velocity: { + symbol: 'v', + vector: [ -1, 1, 0, 0, 0, 0, 0 ], + units: [ 'm/s', 'km/h', 'mph', 'ft/s', 'knot', 'Mach', 'c' ], + prefixableUnits: [ 'm/s' ], + baseUnit: 'm/s' + }, + density: { + symbol: 'ρ', + vector: [ 0, -3, 1, 0, 0, 0, 0 ], + units: [ 'g/m[3]', 'g/cm[3]', 'g/ml', 'g/l', 'lb/ft[3]' ], + prefixableUnits: [ 'g/m[3]', 'g/cm[3]', 'g/ml', 'g/l' ], + baseUnit: 'g/m[3]' + }, + + // --- THERMODYNAMICS --- + energy: { + symbol: 'E', + vector: [ -2, 2, 1, 0, 0, 0, 0 ], + units: [ 'J', 'eV', 'kcal', 'Wh', 'Btu', 'erg', 'E{P}' ], + prefixableUnits: [ 'J', 'eV', 'Wh' ], + baseUnit: 'J' + }, + molarEnergy: { + symbol: 'J/mol', + vector: [ -2, 2, 1, 0, 0, -1, 0 ], + units: [ 'J/mol', 'kcal/mol' ], + prefixableUnits: [ 'J/mol' ], + baseUnit: 'J/mol' + }, + entropy: { + symbol: 'S', + vector: [ -2, 2, 1, 0, -1, 0, 0 ], + units: [ 'J/K' ], + prefixableUnits: [ 'J/K' ], + baseUnit: 'J/K' + }, + heatCapacity: { + symbol: 'C', + vector: [ -2, 2, 1, 0, -1, 0, 0 ], + units: [ 'J/K', 'kcal/K' ], + prefixableUnits: [ 'J/K' ], + baseUnit: 'J/K' + }, + specificHeatCapacity: { + symbol: 'c', + vector: [ -2, 2, 0, 0, -1, 0, 0 ], + units: [ 'J/(kg·K)', 'J/(g·K)', 'Btu/(lb·°F)', 'cal/(kg·K)' ], + prefixableUnits: [ 'J/(kg·K)' ], + baseUnit: 'J/(kg·K)' + }, + molarHeatCapacity: { + symbol: 'c{m}', + vector: [ -2, 2, 1, 0, -1, -1, 0 ], + units: [ 'J/(K·mol)', 'kcal/(K·mol)' ], + prefixableUnits: [ 'J/(K·mol)' ], + baseUnit: 'J/(K·mol)' + }, + tempCoefficient: { + symbol: 'dT', + vector: [ 0, 0, 0, 0, -1, 0, 0 ], + units: [ 'K[-1]', 'ppm/K' ], + prefixableUnits: [], + baseUnit: 'K[-1]' + }, + thermalConductivity: { + symbol: 'λ', + vector: [ -3, 1, 1, 0, -1, 0, 0 ], + units: [ 'W/(m·K)', 'W/(cm·K)' ], + prefixableUnits: [ 'W/(m·K)', 'W/(cm·K)' ], + baseUnit: 'W/(m·K)' + }, + thermalDiffusivity: { + symbol: 'a', + vector: [ -1, 2, 0, 0, 0, 0, 0 ], + units: [ 'm[2]/s' ], + prefixableUnits: [ 'm[2]/s' ], + baseUnit: 'm[2]/s' + }, + + // --- ELECTROMAGNETISM --- + electricConductivity: { + symbol: 'σ', + vector: [ 3, -3, -1, 2, 0, 0, 0 ], + units: [ 'S/m', 'S/cm', '1/(Ω·m)' ], + prefixableUnits: [ 'S/m', 'S/cm' ], + baseUnit: 'S/m' + }, + electricResistivity: { + symbol: 'ρ', + vector: [ -3, 3, 1, -2, 0, 0, 0 ], + units: [ 'Ω·m', 'Ω·cm' ], + prefixableUnits: [ 'Ω·m' ], + baseUnit: 'Ω·m' + }, + electricPotential: { + symbol: 'φ', + vector: [ -3, 2, 1, -1, 0, 0, 0 ], + units: [ 'V', 'statV', 'abV' ], + prefixableUnits: [ 'V' ], + baseUnit: 'V' + }, + electricPermittivity: { + symbol: 'ε', + vector: [ 4, -3, -1, 2, 0, 0, 0 ], + units: [ 'F/m' ], + prefixableUnits: [ 'F/m' ], + baseUnit: 'F/m' + }, + electricDipoleMoment: { + symbol: 'p', + vector: [ 1, 1, 0, 1, 0, 0, 0 ], + units: [ 'C·m', 'statC·cm', 'abC·cm' ], + prefixableUnits: [ 'C·m' ], + baseUnit: 'C·m' + }, + hallCoefficient: { + symbol: 'A{H}', + vector: [ -1, 3, 0, -1, 0, 0, 0 ], + units: [ 'm[3]/C' ], + prefixableUnits: [ 'm[3]/C' ], + baseUnit: 'm[3]/C' + }, + electronMobility: { + symbol: 'μ', + vector: [ 2, 0, -1, 1, 0, 0, 0 ], + units: [ 'm[2]/(V·s)' ], + prefixableUnits: [ 'm[2]/(V·s)' ], + baseUnit: 'm[2]/(V·s)' + }, + magneticSusceptibility: { + symbol: 'X', + vector: [ 0, 0, 0, 0, 0, 0, 0 ], + units: [ '*' ], + prefixableUnits: [], + baseUnit: '*' + }, + molarMagneticSusceptibility: { + symbol: 'X{mol}', + vector: [ 0, 3, 0, 0, 0, -1, 0 ], + units: [ 'm[3]/mol' ], + prefixableUnits: [ 'm[3]/mol' ], + baseUnit: 'm[3]/mol' + }, + massMagneticSusceptibility: { + symbol: 'X{m}', + vector: [ 0, 3, -1, 0, 0, 0, 0 ], + units: [ 'm[3]/kg', 'm[3]/g' ], + prefixableUnits: [ 'm[3]/kg', 'm[3]/g' ], + baseUnit: 'm[3]/kg' + }, + magneticMoment: { + symbol: 'm', + vector: [ 0, 2, 0, 1, 0, 0, 0 ], + units: [ 'J/T', 'abA·cm[2]', 'statA·cm[2]' ], + prefixableUnits: [ 'J/T' ], + baseUnit: 'J/T' + }, + magneticFieldStrength: { + symbol: 'H', + vector: [ 0, -1, 0, 1, 0, 0, 0 ], + units: [ 'A/m', 'Oe', 'statA/cm' ], + prefixableUnits: [ 'A/m', 'Oe', 'statA/cm' ], + baseUnit: 'A/m' + }, + magneticFluxDensity: { + symbol: 'B', + vector: [ -2, 0, 1, -1, 0, 0, 0 ], + units: [ 'T', '10[5]·γ', 'statT' ], + prefixableUnits: [ 'T' ], + baseUnit: 'T' + }, + magneticPermeability: { + symbol: 'μ', + vector: [ -2, 1, 1, -2, 0, 0, 0 ], + units: [ 'H/m', 's[2]/cm[2]' ], + prefixableUnits: [ 'H/m' ], + baseUnit: 'H/m' + }, + magnetization: { + symbol: 'M', + vector: [ 0, -1, 0, 1, 0, 0, 0 ], + units: [ 'A/m' ], + prefixableUnits: [ 'A/m' ], + baseUnit: 'A/m' + }, + gyromagneticRatio: { + symbol: 'γ', + vector: [ 1, 0, -1, 1, 0, 0, 0 ], + units: [ 'rad/(s·T)' ], + prefixableUnits: [], + baseUnit: 'rad/(s·T)' + }, + + // --- FLUID MECHANICS & ACOUSTICS --- + pressure: { + symbol: 'p', + vector: [ -2, -1, 1, 0, 0, 0, 0 ], + units: [ 'Pa', 'bar', 'atm', 'psi', 'torr', 'mmHg', 'inHg', 'cmH{2}O' ], + prefixableUnits: [ 'Pa', 'bar' ], + baseUnit: 'Pa' + }, + compressibility: { + symbol: 'κ', + vector: [ 2, 1, -1, 0, 0, 0, 0 ], + units: [ 'Pa[-1]', 'bar[-1]' ], + prefixableUnits: [ 'Pa[-1]', 'bar[-1]' ], + baseUnit: 'Pa[-1]' + }, + acousticImpedance: { + symbol: 'Z', + vector: [ -1, -4, 1, 0, 0, 0, 0 ], + units: [ 'Pa·s/m[3]', 'Rayl/m[2]' ], + prefixableUnits: [ 'Pa·s/m[3]' ], + baseUnit: 'Pa·s/m[3]' + }, + dynamicViscosity: { + symbol: 'η', + vector: [ -1, -1, 1, 0, 0, 0, 0 ], + units: [ 'Pa·s', 'P' ], + prefixableUnits: [ 'Pa·s', 'P' ], + baseUnit: 'Pa·s' + }, + kinematicViscosity: { + symbol: 'ν', + vector: [ -1, 2, 0, 0, 0, 0, 0 ], + units: [ 'm[2]/s', 'St' ], + prefixableUnits: [ 'm[2]/s' ], + baseUnit: 'm[2]/s' + }, + surfaceTension: { + symbol: 'σ', + vector: [ -2, 0, 1, 0, 0, 0, 0 ], + units: [ 'N/m' ], + prefixableUnits: [ 'N/m' ], + baseUnit: 'N/m' + }, + + // --- OPTICS & WAVES --- + frequency: { + symbol: 'f', + vector: [ -1, 0, 0, 0, 0, 0, 0 ], + units: [ 'Hz', 'rpm', 'rps' ], + prefixableUnits: [ 'Hz' ], + baseUnit: 'Hz' + }, + attenuationCoefficient: { + symbol: 'α', + vector: [ 0, -1, 0, 0, 0, 0, 0 ], + units: [ 'm[-1]' ], + prefixableUnits: [ 'm[-1]' ], + baseUnit: 'm[-1]' + }, + + // --- CHEMISTRY & AMOUNTS --- + concentration: { + symbol: 'C{i}', + vector: [ 0, -3, 0, 0, 0, 1, 0 ], + units: [ 'mol/L', 'mol/m[3]', 'g/L', 'ppm', 'ppb' ], + prefixableUnits: [ 'mol/L', 'mol/m[3]', 'g/L' ], + baseUnit: 'mol/L' + }, + molarMass: { + symbol: 'M', + vector: [ 0, 0, 1, 0, 0, -1, 0 ], + units: [ 'g/mol' ], + prefixableUnits: [ 'g/mol' ], + baseUnit: 'g/mol' + }, + molarVolume: { + symbol: 'V{m}', + vector: [ 0, 3, 0, 0, 0, -1, 0 ], + units: [ 'm[3]/mol' ], + prefixableUnits: [ 'm[3]/mol' ], + baseUnit: 'm[3]/mol' + }, + massFraction: { + symbol: 'w', + vector: null, + units: [ '%', '‰', '*', 'ppm', 'ppb', 'ppt' ], + prefixableUnits: [], + baseUnit: '%' + }, + moleFraction: { + symbol: 'x', + vector: null, + units: [ '%', '‰', '*', 'mol/mol', 'ppm', 'ppb', 'ppt' ], + prefixableUnits: [ 'mol/mol' ], + baseUnit: '%' + }, + massPerMass: { + symbol: 'w/w', + vector: null, + units: [ 'g/kg', 'g/g', 'g/mg' ], + prefixableUnits: [ 'g/kg', 'g/g', 'g/mg' ], + baseUnit: 'g/kg' + }, + quantity: { + symbol: '', + vector: null, + units: [ '*', '%', '‰' ], + prefixableUnits: [], + baseUnit: '%' + }, + rate: { + symbol: 'R', + vector: [ -1, 0, 0, 0, 0, 0, 0 ], + units: [ 's[-1]' ], + prefixableUnits: [ 's[-1]' ], + baseUnit: 's[-1]' + }, + + // --- MATERIALS & MECHANICS --- + fractureToughness: { + symbol: 'K{Ic}', + vector: [ -2, -1, 1, 0, 0, 0, 0 ], + units: [ 'Pa/m[1/2]' ], + prefixableUnits: [ 'Pa/m[1/2]' ], + baseUnit: 'Pa/m[1/2]' + }, + stressIntensityFactor: { + symbol: 'K', + vector: [ -2, -1, 1, 0, 0, 0, 0 ], + units: [ 'Pa·m[1/2]' ], + prefixableUnits: [ 'Pa·m[1/2]' ], + baseUnit: 'Pa·m[1/2]' + } +} ) as const satisfies UnitConfig; diff --git a/enum/chemistry.ts b/enum/chemistry.ts deleted file mode 100644 index f5bac9dd..00000000 --- a/enum/chemistry.ts +++ /dev/null @@ -1,228 +0,0 @@ -/** - * @file chemistry.ts - * @description Defines enums for chemical behavior, classification, and structural properties. - * This module covers acid-base character, chemical bonding, molecular geometry, - * and solubility qualifiers. - */ - -/** - * Qualitative scale for the pH-dependent reactivity of a substance. - */ -export enum AcidBaseCharacter { - /** Neither acidic nor basic at standard conditions. */ - NEUTRAL = 'neutral', - /** Highly ionized in aqueous solution, exhibiting extreme acidity. */ - STRONG_ACIDIC = 'strongAcidic', - /** General classification for substances with a low pH. */ - ACIDIC = 'acidic', - /** Exhibits significant but non-extreme acidic behavior. */ - MODERATE_ACIDIC = 'moderateAcidic', - /** Partially dissociates in solution, resulting in low concentration of H+ ions. */ - WEAK_ACIDIC = 'weakAcidic', - /** Capable of reacting as both an acid and a base. */ - AMPHOTERIC = 'amphoteric', - /** Partially dissociates in solution, resulting in low concentration of OH- ions. */ - WEAK_BASIC = 'weakBasic', - /** Exhibits significant but non-extreme basic behavior. */ - MODERATE_BASIC = 'moderateBasic', - /** General classification for substances with a high pH. */ - BASIC = 'basic', - /** Highly ionized in aqueous solution, exhibiting extreme alkalinity. */ - STRONG_BASIC = 'strongBasic' -}; - -/** - * Functional role of a substance in an acid-base reaction. - */ -export enum BasicityType { - /** Proton donor or electron pair acceptor. */ - ACID = 'acid', - /** Proton acceptor or electron pair donor. */ - BASE = 'base' -}; - -/** - * Pearson's Hard and Soft Acids and Bases (HSAB) classification for chemical stability. - */ -export enum HSAB { - /** Small, high-charge, non-polarizable species that prefer similar partners. */ - HARD = 'hard', - /** Species with intermediate characteristics between hard and soft. */ - EDGE = 'edge', - /** Large, low-charge, highly polarizable species that prefer similar partners. */ - SOFT = 'soft' -}; - -/** - * Geochemical classification of elements according to their preferred host phase. - */ -export enum Goldschmidt { - /** Elements that occur in the gaseous phase or in planetary atmospheres. */ - ATMOPHILE = 'atmophile', - /** Elements that combine with sulfur to form sulfide minerals. */ - CHALCOPHILE = 'chalcophile', - /** Elements that occur in silicate minerals or the Earth's crust. */ - LITHOPHILE = 'lithophile', - /** Elements that occur as native metals or alloyed with iron in planetary cores. */ - SIDEROPHILE = 'siderophile', - /** Artificially produced elements not naturally occurring in geochemical cycles. */ - SYNTHETIC = 'synthetic' -}; - -/** - * Relative strength of donors/acceptors based on the electronic structure model. - */ -export enum LewisModel { - /** High affinity for sharing or accepting electron pairs. */ - STRONG = 'strong', - /** Moderate affinity for sharing or accepting electron pairs. */ - MODERATE = 'moderate', - /** Low affinity for sharing or accepting electron pairs. */ - WEAK = 'weak', - /** Does not exhibit significant Lewis acidic/basic behavior. */ - NONE = 'none' -}; - -/** - * Chemical character of an oxide based on its reaction with water or acids/bases. - */ -export enum OxideCharacter { - /** Reacts with water to form an acid or with a base to form a salt. */ - ACIDIC = 'acidic', - /** Reacts with both acids and bases. */ - AMPHOTERIC = 'amphoteric', - /** Reacts with water to form a base or with an acid to form a salt. */ - BASIC = 'basic' -}; - -/** - * Degrees of solubility for a solute in a solvent at a specific temperature. - */ -export enum SolubilityQualifier { - /** High capacity to dissolve (usually > 1000 mg/mL). */ - VERY_SOLUBLE = 'verySoluble', - /** Dissolves easily in standard solvent volumes. */ - FREELY_SOLUBLE = 'freelySoluble', - /** Requires reasonable amount of solvent to dissolve. */ - SOLUBLE = 'soluble', - /** Limited dissolution in large volumes (typically 10-30 mg/mL). */ - SPARINGLY_SOLUBLE = 'sparinglySoluble', - /** Very low solubility (typically 1-10 mg/mL). */ - SLIGHTLY_SOLUBLE = 'slightlySoluble', - /** Extremely low dissolution (typically 0.1-1 mg/mL). */ - VERY_SLIGHTLY_SOLUBLE = 'verySlightlySoluble', - /** Effectively does not dissolve (< 0.1 mg/mL). */ - PRACTICALLY_INSOLUBLE = 'practicallyInsoluble' -}; - -/** - * Three-dimensional arrangement of atoms within a molecule as predicted by VSEPR theory. - */ -export enum MolecularShape { - /** Atoms in a straight line at 180° angles. */ - LINEAR = 'linear', - /** Three atoms at the corners of an equilateral triangle around a center. */ - TRIGONAL_PLANAR = 'trigonalPlanar', - /** Non-linear arrangement typical of molecules with lone pairs. */ - BENT = 'bent', - /** Central atom with four substituents at the corners of a tetrahedron. */ - TETRAHEDRAL = 'tetrahedral', - /** Pyramid with a triangular base and a central atom at the apex. */ - TRIGONAL_PYRAMIDAL = 'trigonalPyramidal', - /** Two pyramids joined at their triangular base. */ - TRIGONAL_BIPYRAMIDAL = 'trigonalBipyramidal', - /** Derived from trigonal bipyramidal with one lone pair. */ - SEESAW = 'seesaw', - /** Three substituents forming a 'T' shape around a central atom. */ - T_SHAPED = 'tShaped', - /** Eight-faced structure with six substituents at the vertices. */ - OCTAHEDRAL = 'octahedral', - /** Pyramid with a square base. */ - SQUARE_PYRAMIDAL = 'squarePyramidal', - /** Four substituents at the corners of a square in a single plane. */ - SQUARE_PLANAR = 'squarePlanar', - /** Two pyramids joined at their pentagonal base. */ - PENTAGONAL_BIPYRAMIDAL = 'pentagonalBipyramidal', - /** Pyramid with a pentagonal base. */ - PENTAGONAL_PYRAMIDAL = 'pentagonalPyramidal', - /** Five substituents at the corners of a pentagon in a single plane. */ - PENTAGONAL_PLANAR = 'pentagonalPlanar', - /** Geometry in which eight atoms lie at the vertices of a square antiprism. */ - SQUARE_ANTIPRISMATIC = 'squareAntiprismatic', - /** Nine-coordinate geometry in which nine atoms surround a central atom. */ - TRICAPPED_TRIGONAL_PRISMATIC = 'tricappedTrigonalPrismatic' -}; - -/** - * Primary types of chemical attraction and bonding between atoms or molecules. - */ -export enum BondType { - /** Electrostatic attraction between oppositely charged ions. */ - IONIC = 'ionic', - /** Sharing of electron pairs between atoms. */ - COVALENT = 'covalent', - /** Delocalized sharing of valence electrons across a lattice of metal cations. */ - METALLIC = 'metallic', - /** Weak attractive forces between molecules due to dipole fluctuations. */ - VDW = 'vdw', - /** Specific dipole-dipole attraction between hydrogen and highly electronegative atoms. */ - HYDROGEN = 'hydrogen' -}; - -/** - * Mixing of atomic orbitals to form new hybrid orbitals for chemical bonding. - */ -export enum Hybridization { - /** Transition metal hybridization involving s and two d orbitals. */ - SD2 = 'sd2', - /** Transition metal hybridization involving s and three d orbitals. */ - SD3 = 'sd3', - /** Transition metal hybridization involving s and four d orbitals. */ - SD4 = 'sd4', - /** Transition metal hybridization involving s and five d orbitals. */ - SD5 = 'sd5', - /** Linear combination of s and p orbitals. */ - SP = 'sp', - /** Planar combination of s and two p orbitals. */ - SP2 = 'sp2', - /** Tetrahedral combination of s and three p orbitals. */ - SP3 = 'sp3', - /** Planar combination involving s, two p, and one d orbital. */ - SP2D = 'sp2d', - /** Combination involving s, three p, and one d orbital. */ - SP3D = 'sp3d', - /** Octahedral combination involving s, three p, and two d orbitals. */ - SP3D2 = 'sp3d2', - /** Combination involving s, three p, and three d orbitals. */ - SP3D3 = 'sp3d3', - /** Combination involving s, three p, and four d orbitals. */ - SP3D4 = 'sp3d4', - /** Combination involving s, three p, and five d orbitals. */ - SP3D5 = 'sp3d5' -}; - -/** - * Specific roles of chemical constituents within a substance or mixture. - */ -export enum ComponentRole { - /** Positively charged ion. */ - CATION = 'cation', - /** Negatively charged ion. */ - ANION = 'anion', - /** Uncharged molecular unit. */ - NEUTRAL = 'neutral', - /** Atom or molecule with an unpaired valence electron. */ - RADICAL = 'radical', - /** Coordination entity consisting of a central atom and surrounding ligands. */ - COMPLEX = 'complex', - /** Minor constituent that is not part of the intended substance. */ - IMPURITY = 'impurity', - /** Deliberately added trace element used to modify material properties. */ - DOPANT = 'dopant', - /** Distinct material trapped inside the crystal structure of another mineral. */ - INCLUSION = 'inclusion', - /** The primary medium in which other components are embedded or dissolved. */ - MATRIX = 'matrix', - /** Liquid phase in which a solute is dissolved to form a solution. */ - SOLVENT = 'solvent' -}; diff --git a/enum/compound.ts b/enum/compound.ts deleted file mode 100644 index 02dccb14..00000000 --- a/enum/compound.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @file compound.ts - * @description Defines enums for chemical compounds, their categories, and reactive properties. - * This module covers bonding-based classification and structural qualifiers. - */ - -/** - * High-level grouping of substances based on their predominant bonding and structure. - */ -export enum CompoundCategory { - /** Discrete groups of atoms held together by covalent bonds. */ - MOLECULE = 'molecule', - /** Arranged in a rigid crystal lattice of alternating cations and anions. */ - IONIC = 'ionic', - /** Formed from two or more metallic elements in a fixed ratio. */ - INTERMETALLIC = 'intermetallic', - /** Coordination compounds involving a central metal atom and ligands. */ - COMPLEX = 'complex' -}; - -/** - * Classification based on the number of distinct elements present in the compound. - */ -export enum CompoundUnion { - /** Consisting of exactly two different elements (e.g., NaCl). */ - BINARY = 'binary', - /** Consisting of exactly three different elements (e.g., Na2CO3). */ - TERNARY = 'ternary', - /** Consisting of exactly four different elements. */ - QUATERNARY = 'quaternary' -}; - -/** - * Functional and descriptive traits associated with chemical compounds. - */ -export enum CompoundProperty { - /** Based on carbon-hydrogen frameworks, often containing O, N, S, P. */ - ORGANIC = 'organic', - /** General classification for non-carbon based mineral-like compounds. */ - INORGANIC = 'inorganic', - /** Substances containing at least one bond between carbon and a metal. */ - ORGANOMETALLIC = 'organometallic', - /** Chemically involved in the metabolic processes of living organisms. */ - BIOCHEMICAL = 'biochemical', - /** Large molecule consisting of many repeating structural subunits. */ - POLYMER = 'polymer', - /** Product of a neutralization reaction between an acid and a base. */ - SALT = 'salt', - /** Exhibits low pH behavior or proton donor characteristics. */ - ACIDIC = 'acidic', - /** Exhibits high pH behavior or proton acceptor characteristics. */ - BASIC = 'basic', - /** Combinations of oxygen with one or more other elements. */ - OXIDE = 'oxide', - /** Binary compounds of hydrogen with another element. */ - HYDRIDE = 'hydride', - /** Complexes held together by non-covalent intermolecular forces. */ - SUPRAMOLECULAR = 'supramolecular', - /** Occurring in nature without human intervention. */ - NATURAL = 'natural', - /** Produced through intentional chemical synthesis. */ - SYNTHETIC = 'synthetic', - /** Capable of behaving as both an acid and a base. */ - AMPHOTERIC = 'amphoteric', - /** Cyclic planar molecule with delocalized pi-electrons (e.g., Benzene). */ - AROMATIC = 'aromatic', - /** Highly reactive species with an unpaired valence electron. */ - RADICAL = 'radical', - /** Lacking any observable color in the visible spectrum. */ - COLORLESS = 'colorless', - /** Absorbing specific wavelengths of light to exhibit visual color. */ - COLORED = 'colored', - /** Destructive to living tissue or metals upon contact. */ - CORROSIVE = 'corrosive', - /** Rapidly decomposing with significant release of energy and gas. */ - EXPLOSIVE = 'explosive', - /** Capable of catching fire and burning easily. */ - FLAMMABLE = 'flammable', - /** Potentially fatal in very small doses. */ - HIGHLY_TOXIC = 'highlyToxic', - /** Containing unstable nuclei that emit radiation. */ - RADIOACTIVE = 'radioactive', - /** Harmful if ingested, inhaled, or absorbed by the skin. */ - TOXIC = 'toxic', - /** Easily evaporated at normal temperatures. */ - VOLATILE = 'volatile', - /** Essential for life. */ - VITAL = 'vital' -}; diff --git a/enum/crystallography.ts b/enum/crystallography.ts deleted file mode 100644 index 8ef529e7..00000000 --- a/enum/crystallography.ts +++ /dev/null @@ -1,235 +0,0 @@ -/** - * @file crystallography.ts - * @description Defines enums for crystal systems, symmetries, habits, and twinning mechanisms. - * This module covers the structural and geometric properties of solid-state matter. - */ - -/** - * High-level grouping of crystal systems based on their axial and angular constraints. - */ -export enum CrystalFamily { - /** Three unequal axes with all angles non-perpendicular. */ - TRICLINIC = 'triclinic', - /** Three unequal axes, two of which are perpendicular. */ - MONOCLINIC = 'monoclinic', - /** Three unequal axes that are all mutually perpendicular. */ - ORTHORHOMBIC = 'orthorhombic', - /** Single three-fold rotation axis. */ - TRIGONAL = 'trigonal', - /** Single six-fold rotation axis. */ - HEXAGONAL = 'hexagonal', - /** Single four-fold rotation axis. */ - TETRAGONAL = 'tetragonal', - /** Three equal axes that are all mutually perpendicular. */ - CUBIC = 'cubic' -}; - -/** - * Comprehensive classification of unit cell geometries and specific packing symmetries. - */ -export enum CrystalSystem { - /** Sixfold symmetry with axes at 120° and 90°. */ - HEXAGONAL = 'hexagonal', - /** Most dense packing of equal spheres with ABAB stacking. */ - HEXAGONAL_CLOSE_PACKED = 'hexagonalClosePacked', - /** Atoms at the eight corners and one in the center of a cube. */ - BODY_CENTERED_CUBIC = 'bodyCenteredCubic', - /** Three equal axes at identical non-right angles. */ - RHOMBOHEDRAL = 'rhombohedral', - /** Primitive cubic lattice with atoms only at the corners. */ - SIMPLE_CUBIC = 'simpleCubic', - /** Atoms at the corners and in the center of each face. */ - FACE_CENTERED_CUBIC = 'faceCenteredCubic', - /** Interlocking tetrahedral structure typical of carbon. */ - DIAMOND_CUBIC = 'diamondCubic', - /** Three unequal orthogonal axes. */ - ORTHORHOMBIC = 'orthorhombic', - /** Two equal orthogonal axes and one different axis. */ - TETRAGONAL = 'tetragonal', - /** Hexagonal packing with ABAC stacking sequence. */ - DOUBLE_HEXAGONAL_CLOSE_PACKED = 'doubleHexagonalClosePacked', - /** Single non-orthogonal axis angle. */ - MONOCLINIC = 'monoclinic', - /** No orthogonal axes or equal axis lengths. */ - TRICLINIC = 'triclinic' -}; - -/** - * Qualitative description of the external shape and morphology of a crystal especimen. - */ -export enum CrystalHabit { - /** Needle-like crystals. */ - ACICULAR = 'acicular', - /** Branching, tree-like formation. */ - ARBORESCENT = 'arborescent', - /** Extremely thin, hair-like fibers. */ - CAPILLARY = 'capillary', - /** Smooth, spherical or rounded surfaces. */ - COLLOFORM = 'colloform', - /** Layered growth around a central point. */ - CONCENTRIC = 'concentric', - /** Random, plant-like branching branching (e.g., Manganese oxides). */ - DENDRITIC = 'dendritic', - /** Crust of tiny crystals on a surface. */ - DRUSE = 'druse', - /** Parallel thread-like units. */ - FIBROUS = 'fibrous', - /** Leaves or flakes that can be separated. */ - FOLIATED = 'foliated', - /** Mass of aggregate, non-interlocking grains. */ - GRANULAR = 'granular', - /** Face-centered growth where edges grow faster than faces. */ - HOPPER = 'hopper', - /** Aggregate of small, egg-like concentric spheres. */ - OOLITHIC = 'oolithic', - /** Similar to oolithic but with larger, pea-sized grains. */ - PISOLITIC = 'pisolitic', - /** Thin, plate-like crystals. */ - PLATY = 'platy', - /** Feather-like radiating structures. */ - PLUMOSE = 'plumose', - /** Diverging outward from a single center. */ - RADIAL = 'radial', - /** Interlaced into a net-like structure. */ - RETICULATED = 'reticulated', - /** Clustered like the petals of a flower. */ - ROSETTE = 'rosette', - /** Formed like icicles on a cave roof. */ - STALACTITIC = 'stalactitic', - /** Star-shaped radiating arrangement. */ - STELLATE = 'stellate', - /** Result of fluid filling gas bubbles in volcanic rock. */ - AMYGDALOIDAL = 'amygdaloidal', - /** Development of different faces at opposite ends of the crystal. */ - HEMIMORPHIC = 'hemimorphic', - /** Lacks any recognizable individual crystal faces. */ - MASSIVE = 'massive', - /** A small crystal perched on the tip of a larger, stalk-like crystal. */ - SCEPTERED = 'sceptered', - /** Six equal square faces. */ - CUBIC = 'cubic', - /** Twelve rhombic faces. */ - DODECAHEDRAL = 'dodecahedral', - /** Non-superimposable mirror image forms. */ - ENANTIOMORPHIC = 'enantiomorphic', - /** Six-sided prisms or pyramids. */ - HEXAGONAL = 'hexagonal', - /** Twenty-four faced solid. */ - ICOSITETRAHEDRAL = 'icositetrahedral', - /** Eight equilateral triangular faces. */ - OCTAHEDRAL = 'octahedral', - /** Elongated faces parallel to the c-axis. */ - PRISMATIC = 'prismatic', - /** Six faces that are rhombi. */ - RHOMBOHEDRAL = 'rhombohedral', - /** Twelve faces that are scalene triangles. */ - SCALENOEHEDRAL = 'scalenohedral', - /** Four triangular faces. */ - TETRAHEDRAL = 'tetrahedral', - /** Grape-like clusters of rounded masses. */ - BOTRYOIDAL = 'botryoidal', - /** Spherical rounded masses, smaller than botryoidal. */ - GLOBULAR = 'globular', - /** Large breast-like rounded masses. */ - MAMMILLARY = 'mammillary', - /** Reddish-brown, kidney-shaped clusters. */ - RENIFORM = 'reniform' -}; - -/** - * Orientation of the standard cleavage planes in a crystal structure. - */ -export enum CleavageType { - /** Parallel to the base of the crystal (e.g., Micas). */ - BASAL = 'basal', - /** Parallel to vertical prism faces. */ - PRISMATIC = 'prismatic', - /** Three planes mutually perpendicular (e.g., Halite). */ - CUBIC = 'cubic', - /** Three planes at non-right angles. */ - RHOMBOHEDRAL = 'rhombohedral', - /** Four planes at angles to the axes. */ - OCTAHEDRAL = 'octahedral', - /** Six planes parallel to the faces of a dodecahedron. */ - DODECAHEDRAL = 'dodecahedral' -}; - -/** - * Symmetrical intergrowth of two or more crystals of the same substance. - */ -export enum TwinningType { - /** Two crystals joined along a single plane. */ - CONTACT = 'contact', - /** Two crystals intertwined through each other (e.g., Staurolite). */ - PENETRATION = 'penetration', - /** Repeated contact twins resulting in parallel lamellae. */ - POLYSYNTHETIC = 'polysynthetic', - /** Twins arranged in a ring-like circular pattern. */ - CYCLIC = 'cyclic' -}; - -/** - * Geological or thermal process that induced the twinning. - */ -export enum TwinningMode { - /** Occurs während crystal formation from a melt or solution. */ - GROWTH = 'growth', - /** Occurs when a crystal is cooled and changes symmetry. */ - TRANSFORMATION = 'transformation', - /** Occurs due to mechanical stress or pressure (slip twinning). */ - DEFORMATION = 'deformation' -}; - -/** - * Quality and ease of achieving a smooth cleavage surface. - */ -export enum CleavageQuality { - /** Excellent, flat surfaces with no irregularities. */ - PERFECT = 'perfect', - /** Predictable surfaces with some stepping. */ - GOOD = 'good', - /** Rough surface that still follows a plane. */ - IMPERFECT = 'imperfect', - /** Barely recognizable plane. */ - INDISTINCT = 'indistinct', - /** No predictable cleavage. */ - NONE = 'none' -}; - -/** - * Non-planar breakage pattern of a mineral when stressed. - */ -export enum FractureType { - /** Smooth, shell-like curved surface (e.g., Obsidian). */ - CONCHOIDAL = 'conchoidal', - /** Rough or irregular breakage. */ - UNEVEN = 'uneven', - /** Relatively flat but not a cleavage plane. */ - SMOOTH = 'smooth', - /** Splintery or thread-like breakage. */ - FIBROUS = 'fibrous', - /** Jagged, sharp-edged surface (typical of native metals). */ - HACKLY = 'hackly', - /** Sharp, pointed splinters. */ - SPLINTERY = 'splintery', - /** Crumbles easily like soil or clay. */ - EARTHY = 'earthy' -}; - -/** - * Resistance of a material to breaking, bending, or crushing. - */ -export enum Tenacity { - /** Crumbles or powders under stress. */ - BRITTLE = 'brittle', - /** Can be hammered into thin sheets. */ - MALLEABLE = 'malleable', - /** Can be drawn out into thin wires. */ - DUCTILE = 'ductile', - /** Can be cut smoothly with a knife to form shavings. */ - SECTILE = 'sectile', - /** Bends but returns to its original shape. */ - ELASTIC = 'elastic', - /** Bends and stays in its new shape. */ - PLASTIC = 'plastic' -}; diff --git a/enum/element.ts b/enum/element.ts deleted file mode 100644 index 725765fc..00000000 --- a/enum/element.ts +++ /dev/null @@ -1,344 +0,0 @@ -/** - * @file element.ts - * @description Defines enums related to chemical elements and their periodic classification. - * This module covers elemental symbols, periodic table structure, blocks, chemical sets, - * and specific elemental properties. - */ - -/** - * Unique chemical symbols for all known elements in the periodic table. - * These symbols follow IUPAC nomenclature and represent elements from Hydrogen to Oganesson. - */ -export enum ElementSymbol { - /** Hydrogen */ H = 'h', - /** Helium */ He = 'he', - /** Lithium */ Li = 'li', - /** Beryllium */ Be = 'be', - /** Boron */ B = 'b', - /** Carbon */ C = 'c', - /** Nitrogen */ N = 'n', - /** Oxygen */ O = 'o', - /** Fluorine */ F = 'f', - /** Neon */ Ne = 'ne', - /** Sodium */ Na = 'na', - /** Magnesium */ Mg = 'mg', - /** Aluminium */ Al = 'al', - /** Silicon */ Si = 'si', - /** Phosphorus */ P = 'p', - /** Sulfur */ S = 's', - /** Chlorine */ Cl = 'cl', - /** Argon */ Ar = 'ar', - /** Potassium */ K = 'k', - /** Calcium */ Ca = 'ca', - /** Scandium */ Sc = 'sc', - /** Titanium */ Ti = 'ti', - /** Vanadium */ V = 'v', - /** Chromium */ Cr = 'cr', - /** Manganese */ Mn = 'mn', - /** Iron */ Fe = 'fe', - /** Cobalt */ Co = 'co', - /** Nickel */ Ni = 'ni', - /** Copper */ Cu = 'cu', - /** Zinc */ Zn = 'zn', - /** Gallium */ Ga = 'ga', - /** Germanium */ Ge = 'ge', - /** Arsenic */ As = 'as', - /** Selenium */ Se = 'se', - /** Bromine */ Br = 'br', - /** Krypton */ Kr = 'kr', - /** Rubidium */ Rb = 'rb', - /** Strontium */ Sr = 'sr', - /** Yttrium */ Y = 'y', - /** Zirconium */ Zr = 'zr', - /** Niobium */ Nb = 'nb', - /** Molybdenum */ Mo = 'mo', - /** Technetium */ Tc = 'tc', - /** Ruthenium */ Ru = 'ru', - /** Rhodium */ Rh = 'rh', - /** Palladium */ Pd = 'pd', - /** Silver */ Ag = 'ag', - /** Cadmium */ Cd = 'cd', - /** Indium */ In = 'in', - /** Tin */ Sn = 'sn', - /** Antimony */ Sb = 'sb', - /** Tellurium */ Te = 'te', - /** Iodine */ I = 'i', - /** Xenon */ Xe = 'xe', - /** Caesium */ Cs = 'cs', - /** Barium */ Ba = 'ba', - /** Lanthanum */ La = 'la', - /** Cerium */ Ce = 'ce', - /** Praseodymium */ Pr = 'pr', - /** Neodymium */ Nd = 'nd', - /** Promethium */ Pm = 'pm', - /** Samarium */ Sm = 'sm', - /** Europium */ Eu = 'eu', - /** Gadolinium */ Gd = 'gd', - /** Terbium */ Tb = 'tb', - /** Dysprosium */ Dy = 'dy', - /** Holmium */ Ho = 'ho', - /** Erbium */ Er = 'er', - /** Thulium */ Tm = 'tm', - /** Ytterbium */ Yb = 'yb', - /** Lutetium */ Lu = 'lu', - /** Hafnium */ Hf = 'hf', - /** Tantalum */ Ta = 'ta', - /** Tungsten */ W = 'w', - /** Rhenium */ Re = 're', - /** Osmium */ Os = 'os', - /** Iridium */ Ir = 'ir', - /** Platinum */ Pt = 'pt', - /** Gold */ Au = 'au', - /** Mercury */ Hg = 'hg', - /** Thallium */ Tl = 'tl', - /** Lead */ Pb = 'pb', - /** Bismuth */ Bi = 'bi', - /** Polonium */ Po = 'po', - /** Astatine */ At = 'at', - /** Radon */ Rn = 'rn', - /** Francium */ Fr = 'fr', - /** Radium */ Ra = 'ra', - /** Actinium */ Ac = 'ac', - /** Thorium */ Th = 'th', - /** Uranium */ U = 'u', - /** Neptunium */ Np = 'np', - /** Plutonium */ Pu = 'pu', - /** Americium */ Am = 'am', - /** Curium */ Cm = 'cm', - /** Berkelium */ Bk = 'bk', - /** Californium */ Cf = 'cf', - /** Einsteinium */ Es = 'es', - /** Fermium */ Fm = 'fm', - /** Mendelevium */ Md = 'md', - /** Nobelium */ No = 'no', - /** Lawrencium */ Lr = 'lr', - /** Rutherfordium */ Rf = 'rf', - /** Dubnium */ Db = 'db', - /** Seaborgium */ Sg = 'sg', - /** Bohrium */ Bh = 'bh', - /** Hassium */ Hs = 'hs', - /** Meitnerium */ Mt = 'mt', - /** Darmstadtium */ Ds = 'ds', - /** Roentgenium */ Rg = 'rg', - /** Copernicium */ Cn = 'cn', - /** Nihonium */ Nh = 'nh', - /** Flerovium */ Fl = 'fl', - /** Moscovium */ Mc = 'mc', - /** Livermorium */ Lv = 'lv', - /** Tennessine */ Ts = 'ts', - /** Oganesson */ Og = 'og' -}; - -/** - * Periodic table blocks based on the orbital subshell being filled by the valence electrons. - */ -export enum ElementBlock { - /** Sharp orbital block containing groups 1 and 2, plus helium. */ S = 's', - /** Principal orbital block containing groups 13 to 18 (excluding helium). */ P = 'p', - /** Diffuse orbital block containing the transition metals (groups 3 to 12). */ D = 'd', - /** Fundamental orbital block containing lanthanoids and actinoids. */ F = 'f' -}; - -/** - * Classifies elements into groups with similar physical and chemical characteristics. - */ -export enum ElementSet { - /** Elements lacking metallic properties, typically highly electronegative. */ - NON_METAL = 'nonMetal', - /** Chemically inert, monoatomic gases at standard conditions with full valence shells. */ - NOBLE_GAS = 'nobleGas', - /** Highly reactive metals in group 1 that readily lose one electron to form cations. */ - ALKALI_METAL = 'alkaliMetal', - /** Shiny, silvery-white, somewhat reactive metals in group 2. */ - ALKALINE_EARTH_METAL = 'alkalineEarthMetal', - /** Elements with properties intermediate between those of metals and solid nonmetals. */ - METALLOID = 'metalloid', - /** Group 17 elements that form strongly acidic compounds with hydrogen and salts with metals. */ - HALOGEN = 'halogen', - /** General classification for elements that are good conductors of heat and electricity. */ - METAL = 'metal', - /** Elements whose atoms have a partially filled d sub-shell, characterized by multiple oxidation states. */ - TRANSITION_METAL = 'transitionMetal', - /** Fifteen metallic elements with atomic numbers 57 through 71, characterized by filling the 4f subshell. */ - LANTHANOIDE = 'lanthanoid', - /** Fifteen metallic elements with atomic numbers 89 through 103, all being radioactive. */ - ACTINOIDE = 'actinoide' -}; - -/** - * Standard group names for the vertical columns in the periodic table. - */ -export enum ElementGroup { - /** Elements in the first vertical column, excluding hydrogen. */ - ALKALI_METAL = 'alkaliMetal', - /** Elements in the second vertical column. */ - ALKALINE_EARTH_METAL = 'alkalineEarthMetal', - /** Elements in the third vertical column. */ - SCANDIUM_GROUP = 'scandiumGroup', - /** Elements in the fourth vertical column. */ - TITANIUM_GROUP = 'titaniumGroup', - /** Elements in the fifth vertical column. */ - VANADIUM_GROUP = 'vanadiumGroup', - /** Elements in the sixth vertical column. */ - CHROMIUM_GROUP = 'chromiumGroup', - /** Elements in the seventh vertical column. */ - MANGANESE_GROUP = 'manganeseGroup', - /** Elements in the eighth vertical column. */ - IRON_GROUP = 'ironGroup', - /** Elements in the ninth vertical column. */ - COBALT_GROUP = 'cobaltGroup', - /** Elements in the tenth vertical column. */ - NICKEL_GROUP = 'nickelGroup', - /** Elements in the eleventh vertical column. */ - COPPER_GROUP = 'copperGroup', - /** Elements in the twelfth vertical column. */ - ZINC_GROUP = 'zincGroup', - /** Elements in column 13, also known as the icosagens. */ - BORON_GROUP = 'boronGroup', - /** Elements in column 14, also known as the crystallogens. */ - CARBON_GROUP = 'carbonGroup', - /** Elements in column 15, known for forming stable nitrides and phosphides. */ - PNICTOGEN = 'pnictogen', - /** Elements in column 16, known as the ore-forming elements. */ - CHALCOGEN = 'chalcogen', - /** Elements in column 17, highly reactive nonmetals. */ - HALOGEN = 'halogen', - /** Elements in column 18, characterized by minimal chemical reactivity. */ - NOBLE_GAS = 'nobleGas', - /** The series of elements from lanthanum to lutetium. */ - LANTHANOID_SERIES = 'lanthanoidSeries', - /** The series of elements from actinium to lawrencium. */ - ACTINOID_SERIES = 'actinoidSeries' -}; - -/** - * Qualitative properties and descriptors associated with chemical elements. - */ -export enum ElementProperty { - /** Elements known to and used by ancient civilizations (e.g., Gold, Copper). */ - ANTIQUITY = 'antiquity', - /** Produced primarily through human activity or nuclear synthesis. */ - ARTIFICIAL = 'artificial', - /** Metals with high density, atomic weight, or atomic number, often toxic. */ - HEAVY_METAL = 'heavyMetal', - /** Metals with relatively low density (typically less than 5 g/cm³). */ - LIGHT_METAL = 'lightMetal', - /** Elements occurring in nature as a single stable isotope. */ - MONONUCLEIDE = 'mononuclide', - /** Found in nature in its metallic form, either pure or as an alloy. */ - NATIVE = 'native', - /** Formed through natural processes without human intervention. */ - NATURAL = 'natural', - /** Elements that are resistant to corrosion and oxidation in moist air. */ - NOBLE = 'noble', - /** Six transition metal elements (Ru, Rh, Pd, Os, Ir, Pt) clustered together in the d-block. */ - PLATINUM_METAL = 'platinumMetal', - /** Emitting radiation as a result of nuclear decay. */ - RADIOACTIVE = 'radioactive', - /** Set of seventeen elements including the lanthanoids plus scandium and yttrium. */ - RARE_EARTHS = 'rareEarths', - /** Metals that are extraordinarily resistant to heat and wear. */ - REFRACTOR_METAL = 'refractorMetal', - /** Material with electrical conductivity between that of a conductor and an insulator. */ - SEMICONDUCTOR = 'semiconductor', - /** Having at least one isotope that does not undergo radioactive decay. */ - STABLE = 'stable', - /** Specifically created in laboratory or nuclear reactors, not found naturally on Earth. */ - SYNTHETIC = 'synthetic', - /** Essential or strictly associated with biological life processes. */ - VITAL = 'vital' -}; - -/** - * The 18 vertical columns of the periodic table representing groups of elements. - */ -export enum PTColumn { - /** Group 1: Alkali metals and Hydrogen. */ - COLUMN_1 = 1, - /** Group 2: Alkaline earth metals. */ - COLUMN_2 = 2, - /** Group 3: Scandium group. */ - COLUMN_3 = 3, - /** Group 4: Titanium group. */ - COLUMN_4 = 4, - /** Group 5: Vanadium group. */ - COLUMN_5 = 5, - /** Group 6: Chromium group. */ - COLUMN_6 = 6, - /** Group 7: Manganese group. */ - COLUMN_7 = 7, - /** Group 8: Iron group. */ - COLUMN_8 = 8, - /** Group 9: Cobalt group. */ - COLUMN_9 = 9, - /** Group 10: Nickel group. */ - COLUMN_10 = 10, - /** Group 11: Copper group. */ - COLUMN_11 = 11, - /** Group 12: Zinc group. */ - COLUMN_12 = 12, - /** Group 13: Boron group. */ - COLUMN_13 = 13, - /** Group 14: Carbon group. */ - COLUMN_14 = 14, - /** Group 15: Pnictogens. */ - COLUMN_15 = 15, - /** Group 16: Chalcogens. */ - COLUMN_16 = 16, - /** Group 17: Halogens. */ - COLUMN_17 = 17, - /** Group 18: Noble gases. */ - COLUMN_18 = 18 -}; - -/** - * The 7 horizontal rows of the periodic table representing electron shells. - */ -export enum PTPeriod { - /** First period: contains Hydrogen and Helium. */ - PERIOD_1 = 1, - /** Second period: Li through Ne. */ - PERIOD_2 = 2, - /** Third period: Na through Ar. */ - PERIOD_3 = 3, - /** Fourth period: K through Kr. */ - PERIOD_4 = 4, - /** Fifth period: Rb through Xe. */ - PERIOD_5 = 5, - /** Sixth period: Cs through Rn (including Lanthanoides). */ - PERIOD_6 = 6, - /** Seventh period: Fr through Og (including Actinoides). */ - PERIOD_7 = 7 -}; - -/** - * Letter designations for the principal electron shells of an atom. - */ -export enum ShellModel { - /** The innermost electron shell (n=1). */ - K = 'k', - /** The second electron shell (n=2). */ - L = 'l', - /** The third electron shell (n=3). */ - M = 'm', - /** The fourth electron shell (n=4). */ - N = 'n', - /** The fifth electron shell (n=5). */ - O = 'o', - /** The sixth electron shell (n=6). */ - P = 'p', - /** The seventh electron shell (n=7). */ - Q = 'q' -}; - -/** - * Classification of elements based on their origin and existence on Earth. - */ -export enum NaturalOccurrence { - /** Existed in its current form since the formation of the Earth. */ - PRIMORDIAL = 'primordial', - /** Produced through the radioactive decay of a heavier parent isotope. */ - DECAY_PRODUCT = 'decayProduct', - /** Created artificially through nuclear transmutation, not naturally occuring. */ - SYNTHETIC = 'synthetic' -}; diff --git a/enum/mineral.ts b/enum/mineral.ts deleted file mode 100644 index 8662c869..00000000 --- a/enum/mineral.ts +++ /dev/null @@ -1,123 +0,0 @@ -/** - * @file mineral.ts - * @description Defines enums for mineral classification and physical diagnostic properties. - * This module covers IMA mineral categories, chemical classes, and physical identifiers. - */ - -/** - * High-level chemical classification of minerals based on their dominant redundant anions. - */ -export enum MineralCategory { - /** Pure elements occurring in nature (e.g., Diamond, Gold). */ - ELEMENTS = 'elements', - /** Compounds of sulfur with a metal or semi-metal (e.g., Pyrite). */ - SULFIDES = 'sulfides', - /** Salts containing a halogen as the dominant anion (e.g., Halite). */ - HALIDES = 'halides', - /** Oxygen-bearing compounds, typically with a metal (e.g., Hematite). */ - OXIDES = 'oxides', - /** Minerals containing the carbonate ion (CO3)2- (e.g., Calcite). */ - CARBONATES = 'carbonates', - /** Boron-oxygen bearing minerals (e.g., Borax). */ - BORATES = 'borates', - /** Minerals containing the sulfate ion (SO4)2- (e.g., Gypsum). */ - SULFATES = 'sulfates', - /** Minerals containing the phosphate ion (PO4)3- (e.g., Apatite). */ - PHOSPHATES = 'phosphates', - /** The largest group, containing silicon and oxygen (e.g., Quartz, Feldspar). */ - SILICATES = 'silicates', - /** Naturally occurring organic chemical compounds (e.g., Whewellite). */ - ORGANIC = 'organic', - /** Mineral species whose chemical classification is currently unconfirmed. */ - UNKNOWN = 'unknown' -}; - -/** - * Detailed Strunz or Dana mineralogical classes based on chemical composition. - */ -export enum MineralClass { - /** Native elements and alloys. */ - ELEMENTS = 'elements', - /** Sulfides and sulfosalts. */ - SULFIDES = 'sulfides', - /** Complex sulfur-arsenic/antimony compounds. */ - SULFOSALTS = 'sulfosalts', - /** Natural halogen salts. */ - HALIDES = 'halides', - /** Metal oxides and hydroxides. */ - OXIDES = 'oxides', - /** Hydroxyl-bearing metal oxides. */ - HYDROXIDES = 'hydroxides', - /** Minerals containing trivalent arsenic (AsO3)3-. */ - ARSENITES = 'arsenites', - /** Carbonate minerals. */ - CARBONATES = 'carbonates', - /** Minerals containing the nitrate ion (NO3)-. */ - NITRATES = 'nitrates', - /** Borate minerals. */ - BORATES = 'borates', - /** Sulfate minerals. */ - SULFATES = 'sulfates', - /** Chromium-oxygen bearing minerals. */ - CHROMATES = 'chromates', - /** Molybdenum-oxygen bearing minerals. */ - MOLYBDATES = 'molybdates', - /** Phosphate minerals. */ - PHOSPHATES = 'phosphates', - /** Arsenic-oxygen bearing minerals in the +5 oxidation state. */ - ARSENATES = 'arsenates', - /** Organic mineral species. */ - ORGANIC = 'organic', - /** Silicate framework and sheet minerals. */ - SILICATES = 'silicates', - /** Unspecified class. */ - UNKNOWN = 'unknown' -}; - -/** - * Physical diagnostic traits used for the identification of mineral specimens. - */ -export enum MineralProperty { - /** Exhibit a distinct hue (idiochromatic or allochromatic). */ - COLORED = 'colored', - /** Lacking any intrinsic or external coloration. */ - COLORLESS = 'colorless', - /** Light passes through but objects cannot be clearly seen. */ - TRANSLUCENT = 'translucent', - /** Completely blocks light transmission. */ - OPAQUE = 'opaque', - /** Completely clear, allowing light and images to pass through. */ - TRANSPARENT = 'transparent', - /** Responsive to external magnetic fields or exhibiting permanent magnetism. */ - MAGNETIC = 'magnetic', - /** Emits light after excitation by an energy source. */ - LUMINESCENT = 'luminescent', - /** Emits light immediately after UV or X-ray excitation. */ - FLUORESCENT = 'fluorescent', - /** Continues to emit light after the excitation source is removed. */ - PHOSPHORESCENT = 'phosphorescent', - /** Emits ionizing radiation due to unstable isotopes. */ - RADIOACTIVE = 'radioactive', - /** Susceptible to nuclear fission. */ - FISSIONABLE = 'fissionable', - /** Fractures or powders easily under pressure without deformation. */ - BRITTLE = 'brittle', - /** Reflective or lustrous surface. */ - SHINY = 'shiny', - /** Lacks reflective lustre; earthy or matte appearance. */ - DULL = 'dull', - /** Surface sheen typical of metals or sulfides. */ - METALLIC = 'metallic', - /** Generates an electric charge in response to mechanical stress. */ - PIEZOELECTRIC = 'piezoelectric', - /** Generates an electric charge in response to temperature changes. */ - PYROELECTRIC = 'pyroelectric', - /** Allows the flow of electric current. */ - CONDUCTIVE = 'conductive', - /** Exhibits electrical conductivity between a conductor and an insulator. */ - SEMICONDUCTIVE = 'semiconductive', - /** Highly resistant to the flow of electric current. */ - INSULATIVE = 'insulative', - /** Specimen created in a laboratory rather than by geologic processes. */ - SYNTHETIC = 'synthetic' -}; diff --git a/enum/mixture.ts b/enum/mixture.ts deleted file mode 100644 index 5ba29850..00000000 --- a/enum/mixture.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file mixture.ts - * @description Defines enums for chemical mixtures, their homogeneity, and physical states. - * This module covers the classification of solutions, colloids, and heterogeneous mixtures. - */ - -/** - * Classification of mixtures based on the physical state of their components. - */ -export enum MixtureType { - /** Homogeneous liquid phase with uniform distribution. */ - SOLUTION = 'solution', - /** Dispersed particles in a medium that do not settle. */ - COLLOID = 'colloid', - /** Large particles that eventually settle under gravity. */ - SUSPENSION = 'suspension' -}; - -/** - * Degree of uniformity in the distribution of components within a mixture. - */ -export enum MixtureHomogeneity { - /** Components are uniformly distributed at the molecular or atomic level. */ - HOMOGENEOUS = 'homogeneous', - /** Components are not uniformly distributed and can often be visually distinguished. */ - HETEROGENEOUS = 'heterogeneous' -}; - -/** - * Detailed categories of mixtures based on the dispersed and continuous phases. - */ -export enum MixtureCategory { - /** Uniform mixture of gases. */ - GAS_MIXTURE = 'gasMixture', - /** Liquid droplets dispersed in a gas. */ - LIQUID_AEROSOL = 'liquidAerosol', - /** Solid particles dispersed in a gas. */ - SOLID_AEROSOL = 'solidAerosol', - /** Gas bubbles dispersed in a liquid. */ - LIQUID_FOAM = 'liquidFoam', - /** Gas bubbles dispersed in a solid. */ - SOLID_FOAM = 'solidFoam', - /** Liquid droplets dispersed in another liquid. */ - EMULSION = 'emulsion', - /** Solid particles dispersed in a liquid (e.g., Ink). */ - SOL = 'sol', - /** Solid particles dispersed in a solid. */ - SOLID_SOL = 'solidSol', - /** Semi-solid or jelly-like colloidal system. */ - GEL = 'gel', - /** Homogeneous solid solution of two or more metals. */ - ALLOY = 'alloy', - /** Specifically a mercury-based metal alloy. */ - AMALGAM = 'amalgam', - /** Mixture of liquids with a constant boiling point. */ - AZEOTROPE = 'azeotrope', - /** Large solid particles dispersed in a fluid. */ - SUSPENSION = 'suspension', - /** Macroscopic mixture of distinct substances. */ - COARSE_MIXTURE = 'coarseMixture', - /** Unspecified category. */ - UNKNOWN = 'unknown' -}; - -/** - * Qualitative attributes describing the behavior and separation properties of a mixture. - */ -export enum MixtureProperty { - /** Boiling at a constant temperature without change in composition. */ - AZEOTROPIC = 'azeotropic', - /** Boiling over a range of temperatures with changing composition. */ - ZEOTROPIC = 'zeotropic', - /** Having the lowest possible melting point for a mixture of specific components. */ - EUTECTIC = 'eutectic', - /** Solid lacking long-range atomic order. */ - AMORPHOUS = 'amorphous', - /** Structured into a network or grid-like pattern. */ - RETICULATED = 'reticulated', - /** Containing discrete pores that do not communicate. */ - CLOSED_CELL = 'closedCell', - /** Two phases intertwined in a three-dimensional network. */ - BICONTINUOUS = 'bicontinuous', - /** Components are unable to mix to form a homogeneous phase. */ - IMMISCIBLE = 'immiscible', - /** Ratio of components varies across samples. */ - VARIABLE_COMPOSITION = 'variableComposition', - /** Every part of the sample contains the same ratio of components. */ - UNIFORM_COMPOSITION = 'uniformComposition', - /** Parts of the sample differ significantly in composition. */ - NON_UNIFORM_COMPOSITION = 'nonUniformComposition', - /** Connected network allowing movement through the sample. */ - PERCOLATING = 'percolating', - /** Containing extraneous substances not part of the base mixture. */ - IMPURE = 'impure', - /** Components can be separated by filtration or sorting. */ - MECHANICALLY_SEPARABLE = 'mechanicallySeparable', - /** Components can be separated by distillation or sublimation. */ - THERMALLY_SEPARABLE = 'thermallySeparable', - /** Emitting radiation from radioactive isotopes. */ - RADIOACTIVE = 'radioactive', - /** Produced in a laboratory or factory. */ - SYNTHETIC = 'synthetic', - /** Found in nature. */ - NATURAL = 'natural' -}; diff --git a/enum/nuclear.ts b/enum/nuclear.ts deleted file mode 100644 index 5733ba9e..00000000 --- a/enum/nuclear.ts +++ /dev/null @@ -1,170 +0,0 @@ -/** - * @file nuclear.ts - * @description Defines enums for nuclear properties, decay modes, and stability. - * This module covers atomic nuclide states, radiation types, and radioactive decay paths. - */ - -/** - * Energy state of an atomic nucleus relative to its lowest potential. - */ -export enum NuclideState { - /** Lowest energy state of the nucleus. */ - GROUND = 'ground', - /** Long-lived excited state with a measurable half-life. */ - METASTABLE = 'metastable', - /** Discrete energetic nuclear state above the ground state (level 1). */ - M1 = 'm1', - /** Discrete energetic nuclear state above the ground state (level 2). */ - M2 = 'm2', - /** Discrete energetic nuclear state above the ground state (level 3). */ - M3 = 'm3', - /** Discrete energetic nuclear state above the ground state (level 4). */ - M4 = 'm4' -}; - -/** - * Classification of nuclear stability and environmental persistence. - */ -export enum NuclideStability { - /** Does not undergo radioactive decay within the age of the universe. */ - STABLE = 'stable', - /** Susceptible to spontaneous radioactive decay. */ - UNSTABLE = 'unstable', - /** Radioactive isotope that existed since the formation of the Earth. */ - PRIMORDIAL = 'primordial', - /** Produced in reactors or particle accelerators, not found naturally. */ - SYNTHETIC = 'synthetic', - /** Specifically created through human nuclear processes or synthesis. */ - ARTIFICIAL = 'artificial' -}; - -/** - * Intrinsic angular momentum (spin) and spatial symmetry (parity) of a nucleus. - */ -export enum SpinParity { - /** Even symmetry under spatial inversion. */ - POSITIVE = 'positive', - /** Odd symmetry under spatial inversion. */ - NEGATIVE = 'negative', - /** Nuclear symmetry properties are currently undetermined. */ - UNKNOWN = 'unknown' -}; - -/** - * Spontaneous transformation of an unstable atomic nucleus into a different entity. - * Notation follows common nuclear physics shorthand for emission processes. - */ -export enum DecayMode { - /** Simultaneous conversion of two protons to neutrons with positron emission. */ - DOUBLE_BETA_PLUS = '2B+', - /** Simultaneous conversion of two neutrons to protons with electron emission. */ - DOUBLE_BETA_MINUS = '2B-', - /** Capture of two inner-shell electrons by the nucleus. */ - DOUBLE_ELECTRON_CAPTURE = '2EC', - /** Spontaneous emission of two neutrons from an unstable nucleus. */ - DOUBLE_NEUTRON_EMISSION = '2N', - /** Spontaneous emission of two protons from an unstable nucleus. */ - DOUBLE_PROTON_EMISSION = '2P', - /** Helium-4 nucleus emission, reducing atomic number by 2 and mass by 4. */ - ALPHA = 'A', - /** Positron emission through the conversion of a proton to a neutron. */ - BETA_PLUS = 'B+', - /** Positron emission followed by the emission of two protons. */ - BETA_PLUS_TWO_PROTON = 'B+2P', - /** Beta-plus decay resulting in an excited state that emits an alpha particle. */ - BETA_PLUS_ALPHA = 'B+A', - /** Beta-plus decay followed by the emission of one proton. */ - BETA_PLUS_PROTON = 'B+P', - /** Electron emission through the conversion of a neutron to a proton. */ - BETA_MINUS = 'B-', - /** Beta-minus decay followed by the emission of two neutrons. */ - BETA_MINUS_TWO_NEUTRON = 'B-2N', - /** Beta-minus decay followed by the emission of three neutrons. */ - BETA_MINUS_THREE_NEUTRON = 'B-3N', - /** Beta-minus decay followed by the emission of four neutrons. */ - BETA_MINUS_FOUR_NEUTRON = 'B-4N', - /** Beta-minus decay followed by the emission of five neutrons. */ - BETA_MINUS_FIVE_NEUTRON = 'B-5N', - /** Beta-minus decay followed by the emission of six neutrons. */ - BETA_MINUS_SIX_NEUTRON = 'B-6N', - /** Beta-minus decay followed by the emission of seven neutrons. */ - BETA_MINUS_SEVEN_NEUTRON = 'B-7N', - /** Beta-minus decay resulting in an excited state that emits an alpha particle. */ - BETA_MINUS_ALPHA = 'B-A', - /** Beta-minus decay followed by the emission of one neutron. */ - BETA_MINUS_NEUTRON = 'B-N', - /** Beta-minus decay followed by the emission of one proton. */ - BETA_MINUS_PROTON = 'B-P', - /** Beta-minus decay followed by spontaneous fission of the daughter nucleus. */ - BETA_MINUS_SPONTANEOUS_FISSION = 'B-SF', - /** Capture of an orbital electron by a proton in the nucleus. */ - ELECTRON_CAPTURE = 'EC', - /** Competition between electron capture and positron emission. */ - ELECTRON_CAPTURE_BETA_PLUS = 'EC+B+', - /** Electron capture followed by the emission of two protons. */ - ELECTRON_CAPTURE_TWO_PROTON = 'EC2P', - /** Electron capture results in an excited state that emits an alpha particle. */ - ELECTRON_CAPTURE_ALPHA = 'ECA', - /** Electron capture followed by the emission of one proton. */ - ELECTRON_CAPTURE_PROTON = 'ECP', - /** Electron capture followed by spontaneous fission. */ - ELECTRON_CAPTURE_SPONTANEOUS_FISSION = 'ECSF', - /** Transition from an excited nuclear isomorphism to the ground state. */ - ISOMERIC_TRANSITION = 'IT', - /** Release of a single neutron to achieve greater stability. */ - NEUTRON_EMISSION = 'N', - /** Release of a single proton to achieve greater stability. */ - PROTON_EMISSION = 'P', - /** Splitting of a heavy nucleus into two smaller nuclei without external interaction. */ - SPONTANEOUS_FISSION = 'SF', - /** Spontaneous fission accompanied by positron emission or electron capture. */ - SPONTANEOUS_FISSION_EC_BPLUS = 'SF+EC+B+' -}; - -/** - * Types of ionizing and non-ionizing particles or waves emitted by radionuclides. - */ -export enum RadiationType { - /** Flux of helium nuclei. */ - ALPHA = 'alpha', - /** Flux of high-speed electrons or positrons. */ - BETA = 'beta', - /** High-energy electromagnetic waves emitted from the nucleus. */ - GAMMA = 'gamma', - /** High-energy electromagnetic waves originating from electron transitions. */ - XRAY = 'xray', - /** Interaction of nucleus with an orbital electron, causing its emission. */ - CONVERSION_ELECTRON = 'conversionElectron', - /** Antimatter particle with the same mass as an electron but positive charge. */ - POSITRON = 'positron', - /** Uncharged subatomic particles with high penetrating power. */ - NEUTRON = 'neutron', - /** Positively charged subatomic particles consisting of one hydrogen nucleus. */ - PROTON = 'proton', - /** Rare emission of particles larger than alpha particles (e.g., carbon-14). */ - CLUSTER = 'cluster' -}; - -/** - * Qualitative attributes describing the nuclear or environmental behavior of a nuclide. - */ -export enum NuclideProperty { - /** Non-decaying nuclear configuration. */ - STABLE = 'stable', - /** Subject to nuclear transmutation over time. */ - UNSTABLE = 'unstable', - /** Originating from before the formation of the Earth. */ - PRIMORDIAL = 'primordial', - /** Result of human nuclear synthesis in reactors. */ - SYNTHETIC = 'synthetic', - /** Produced through artificial bombardment or fission. */ - ARTIFICIAL = 'artificial', - /** Occurring as a single stable isotope for a given element. */ - MONONUCLEIDE = 'mononuclide', - /** Spontaneously emitting radiation. */ - RADIOACTIVE = 'radioactive', - /** Occurring naturally on Earth though natural cycles. */ - NATUREAL = 'natural', - /** Existing in a long-lived nuclear excited state. */ - METASTABLE = 'metastable' -}; diff --git a/enum/physics.ts b/enum/physics.ts deleted file mode 100644 index bc143dcd..00000000 --- a/enum/physics.ts +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @file physics.ts - * @description Defines enums for physical states, properties, and phenomena. - * This module covers phases of matter, magnetic ordering, and optical properties - * like lustre and diaphaneity. - */ - -/** - * Fundamental states of matter based on particle arrangement and energy. - */ -export enum Phase { - /** Rigid state where molecules/atoms are closely packed in a fixed lattice. */ - SOLID = 'solid', - /** Fluid state with fixed volume but variable shape, allowing molecular flow. */ - LIQUID = 'liquid', - /** Compressible fluid phase with neither definite shape nor volume. */ - GASEOUS = 'gaseous', - /** Ionized state of matter where atoms are stripped of their electrons. */ - PLASMA = 'plasma', - /** Current state is undetermined or scientifically undefined. */ - UNKNOWN = 'unknown' -}; - -/** - * States of electrical conductivity where resistance vanishes at low temperatures. - */ -export enum Superconductivity { - /** Conducts electricity without loss below a critical temperature. */ - NORMAL = 'normal', - /** Exhibits unusual Cooper pair coupling or non-standard critical mechanics. */ - SPECIAL = 'special', - /** Material does not exhibit superconducting properties under any known condition. */ - NONE = 'none' -}; - -/** - * Classification of materials based on their response to an external magnetic field. - */ -export enum MagneticOrdering { - /** Repelled by a magnetic field; atoms have no permanent net magnetic moment. */ - DIAMAGNETIC = 'diamagnetic', - /** Weakly attracted by a magnetic field; magnetic moments align only while field is present. */ - PARAMAGNETIC = 'paramagnetic', - /** Strong attraction with spontaneous magnetization below a Curie temperature. */ - FERROMAGNETIC = 'ferromagnetic', - /** Adjacent magnetic moments point in opposite directions, resulting in no net magnetization. */ - ANTIFERROMAGNETIC = 'antiferromagnetic', - /** Opposing magnetic moments are unequal, leading to a net spontaneous magnetization. */ - FERRIMAGNETIC = 'ferrimagnetic', - /** Occurs in small ferromagnetic or ferrimagnetic nanoparticles with single-domain behavior. */ - SUPERPARAMAGNETIC = 'superparamagnetic' -}; - -/** - * Qualitative description of the surface reflective properties of a substance. - */ -export enum Gloss { - /** High reflectivity and opacity typical of polished metals. */ - METALLIC = 'metallic', - /** Brilliant, high-index reflectivity similar to a cut diamond. */ - DIAMOND = 'diamond', - /** Surface appears to be coated with a thin layer of oil or fat. */ - GREASY = 'greasy', - /** Smooth, vitreous reflection typical of glass. */ - GLASSY = 'glassy', - /** Iridescent, multi-layered reflection like the interior of a mollusk shell. */ - PEARLY = 'pearly', - /** Parallel, fibrous arrangement reflecting light in thread-like patterns. */ - SILKY = 'silky', - /** Dull, plastic-like reflection typical of amber or resin. */ - RESINOUS = 'resinous', - /** Soft, matte reflection typical of candle wax or paraffin. */ - WAXY = 'waxy', - /** Non-reflective surface indicating high light absorption or scattering. */ - DULL = 'dull' -}; - -/** - * Detailed mineralogical classification of how light interacts with a surface. - */ -export enum Lustre { - /** Hardest, most brilliant lustre seen in minerals with high refractive indices. */ - ADAMANTINE = 'adamantine', - /** Lacks any noticeable reflection, appearing earthy or granular. */ - DULL = 'dull', - /** Feels and looks oily, often seen in minerals with surface weathering. */ - GREASY = 'greasy', - /** Opaque, shiny surface characteristic of metals and some sulfides. */ - METALLIC = 'metallic', - /** Sheen caused by light interference in thin surface layers (e.g., muscovite). */ - PEARLY = 'pearly', - /** Characteristic of resins like amber, often with medium refractive indices. */ - RESINOUS = 'resinous', - /** Radiating, fibrous lustre seen in minerals like gypsum or tiger's eye. */ - SILKY = 'silky', - /** Intermediate between metallic and vitreous, often seen in oxides with high density. */ - SUBMETALLIC = 'submetallic', - /** Standard glass-like lustre, typical of 70% of all minerals. */ - VITREOUS = 'vitreous', - /** Soft, translucent sheen reminiscent of beeswax. */ - WAXY = 'waxy' -}; - -/** - * Degrees of light transmission through a material. - */ -export enum Diaphaneity { - /** Blocks all visible light transmission, even in thin sections. */ - OPAQUE = 'opaque', - /** Allows light to pass through but scatters it, preventing clear vision. */ - TRANSLUCENT = 'translucent', - /** Light passes through with minimal scattering, allowing clear images. */ - TRANSPARENT = 'transparent' -}; diff --git a/enum/safety.ts b/enum/safety.ts deleted file mode 100644 index 8fc1ee8d..00000000 --- a/enum/safety.ts +++ /dev/null @@ -1,277 +0,0 @@ -/** - * @file safety.ts - * @description Defines enums for chemical safety, hazard classification, and toxicity. - * This module includes NFPA, GHS, WHMIS, ADR, and DOT international safety standards. - */ - -/** - * Standard signal words used on hazard labels to indicate relative severity. - */ -export enum SignalWord { - /** Serious health or environmental risk. */ - DANGER = 'danger', - /** Moderate health or environmental risk. */ - WARNING = 'warning', - /** Lower level of potential injury or hazard. */ - CAUTION = 'caution' -}; - -/** - * National Fire Protection Association (NFPA) 704 numerical ratings for hazard severity. - */ -export enum NFPACode { - /** No significant hazard. */ - NONE = 0, - /** Slight hazard; caution required. */ - SLIGHT = 1, - /** Moderate hazard; potential for injury. */ - MODERATE = 2, - /** Serious hazard; specialized equipment needed. */ - SERIOUS = 3, - /** Severe hazard; life-threatening. */ - SEVERE = 4 -}; - -/** - * Special notices for specific chemical hazards defined by NFPA 704. - */ -export enum NFPANotice { - /** Substance with oxidizing properties. */ - OXIDIZER = 'OX', - /** Reacts violently or explosively with water; do not extinguish with water. */ - WATER_REACTIVE = 'W', - /** Gases that displace air and can cause suffocation. */ - SIMPLE_ASPHYXIANT = 'SA', - /** Causes destruction of human tissue or corrosion of metals. */ - CORROSIVE = 'COR', - /** Specifically acidic material. */ - ACID = 'ACID', - /** Specifically alkaline (basic) material. */ - ALKALINE = 'ALK', - /** Contains pathogenic biological agents. */ - BIOHAZARDOUS = 'BIO', - /** Highly toxic or lethal substance. */ - POISONOUS = 'POI', - /** Emits ionizing radiation. */ - RADIOACTIVE = 'RAD', - /** Specifically cold-stored liquids or materials. */ - CRYOGENIC = 'CRY', - /** Oxidizing gas specifically at standard conditions. */ - OXYGEN_GAS = 'G OX' -}; - -/** - * Globally Harmonized System (GHS) visual symbols for hazard communication. - */ -export enum GHSPictogram { - /** Unstable explosives or items with mass explosion hazard. */ - EXPLOSIVE = 'explosive', - /** Flammable gases, aerosols, liquids, or solids. */ - FLAMMABLE = 'flammable', - /** Oxidizing gases, liquids, or solids. */ - OXIDIZING = 'oxidizing', - /** Gases under pressure in a cylinder. */ - COMPRESSED_GAS = 'compressedGas', - /** Skin corrosion, serious eye damage, or metal corrosion. */ - CORROSIVE = 'corrosive', - /** Acute toxicity (fatal or toxic if ingested or inhaled). */ - TOXIC = 'toxic', - /** Skin and eye irritation, sensitization, or narcotic effects. */ - HARMFUL = 'harmful', - /** Respiratory sensitizer, mutagen, or carcinogen. */ - HEALTH_HAZARD = 'healthHazard', - /** Acute or chronic aquatic toxicity. */ - ENVIRONMENTAL_HAZARD = 'environmentalHazard' -}; - -/** - * GHS hazard categories based on the nature of the chemical risk. - */ -export enum GHSClass { - /** Explosives */ - CLASS_01 = '01', - /** Flammable gases and aerosols */ - CLASS_02 = '02', - /** Oxidizing gases */ - CLASS_03 = '03', - /** Gases under pressure */ - CLASS_04 = '04', - /** Flammable liquids */ - CLASS_05 = '05', - /** Flammable solids */ - CLASS_06 = '06', - /** Self-reactive substances */ - CLASS_07 = '07', - /** Pyrophoric liquids and solids */ - CLASS_08 = '08', - /** Self-heating substances */ - CLASS_09 = '09' -}; - -/** - * Workplace Hazardous Materials Information System (WHMIS) classification codes. - */ -export enum WHMISClass { - /** Class A: Compressed gas */ - COMPRESSED_GAS = 'A', - /** Class B: Flammable and combustible material */ - FLAMMABLE = 'B', - /** Class C: Oxidizing material */ - OXIDIZING = 'C', - /** Class D-1: Poisonous and infectious material (immediate) */ - TOXIC_ACUTE = 'D-1', - /** Class D-2: Poisonous and infectious material (other) */ - TOXIC_OTHER = 'D-2', - /** Class D-3: Biohazardous infectious material */ - BIOHAZARDOUS = 'D-3', - /** Class E: Corrosive material */ - CORROSIVE = 'E', - /** Class F: Dangerously reactive material */ - DANGEROUSLY_REACTIVE = 'F' -}; - -/** - * Agreement concerning the International Carriage of Dangerous Goods by Road (ADR). - */ -export enum ADRClass { - /** Explosive substances and articles */ - CLASS_1 = '1', - /** Substances with high explosion hazard */ - DIV_1_1 = '1.1', - /** Projectile hazard but no mass explosion */ - DIV_1_2 = '1.2', - /** Fire hazard with minor blast or projection hazard */ - DIV_1_3 = '1.3', - /** Minor explosion hazard confined to packaging */ - DIV_1_4 = '1.4', - /** Very insensitive substances with mass explosion hazard */ - DIV_1_5 = '1.5', - /** Extremely insensitive articles with no mass explosion */ - DIV_1_6 = '1.6', - /** Flammable gases */ - DIV_2_1 = '2.1', - /** Non-flammable, non-toxic gases */ - DIV_2_2 = '2.2', - /** Toxic gases */ - DIV_2_3 = '2.3', - /** Flammable liquids */ - CLASS_3 = '3', - /** Flammable solids */ - DIV_4_1 = '4.1', - /** Substances liable to spontaneous combustion */ - DIV_4_2 = '4.2', - /** Substances emitting flammable gases in contact with water */ - DIV_4_3 = '4.3', - /** Oxidizing substances */ - DIV_5_1 = '5.1', - /** Organic peroxides */ - DIV_5_2 = '5.2', - /** Toxic substances */ - DIV_6_1 = '6.1', - /** Infectious substances */ - DIV_6_2 = '6.2', - /** Radioactive material (White label I) */ - CAT_7A = '7A', - /** Radioactive material (Yellow label II) */ - CAT_7B = '7B', - /** Radioactive material (Yellow label III) */ - CAT_7C = '7C', - /** Fissile material (specifically containing U-235) */ - CAT_7E = '7E', - /** Corrosive substances */ - CLASS_8 = '8', - /** Miscellaneous dangerous substances and articles */ - CLASS_9 = '9', - /** Specifically lithium batteries or related electronics */ - CLASS_9A = '9A', - /** Substance transported at elevated temperatures */ - HOT = 'HOT', - /** Marine pollutants */ - POL = 'POL' -}; - -/** - * U.S. Department of Transportation (DOT) hazardous material classification. - */ -export enum DOTClass { - /** Mass explosion hazard */ - DIV_1_1 = '1.1', - /** Projection hazard */ - DIV_1_2 = '1.2', - /** Predominantly fire hazard */ - DIV_1_3 = '1.3', - /** No significant blast hazard */ - DIV_1_4 = '1.4', - /** Very insensitive mass explosion hazard */ - DIV_1_5 = '1.5', - /** Extremely insensitive articles */ - DIV_1_6 = '1.6', - /** Flammable gases */ - DIV_2_1 = '2.1', - /** Non-flammable, non-toxic gases */ - DIV_2_2 = '2.2', - /** Toxic gases */ - DIV_2_3 = '2.3', - /** Flammable liquids */ - CLASS_3 = '3', - /** Flammable solids */ - DIV_4_1 = '4.1', - /** Substances liable to spontaneous combustion */ - DIV_4_2 = '4.2', - /** Dangerous when wet */ - DIV_4_3 = '4.3', - /** Oxidizers */ - DIV_5_1 = '5.1', - /** Organic peroxides */ - DIV_5_2 = '5.2', - /** Toxic substances */ - DIV_6_1 = '6.1', - /** Infectious substances */ - DIV_6_2 = '6.2', - /** Radioactive material */ - CLASS_7 = '7', - /** Corrosive material */ - CLASS_8 = '8', - /** Miscellaneous hazard */ - CLASS_9 = '9' -}; - -/** - * Standard metrics for determining the toxicity of a chemical substance. - */ -export enum ToxicityType { - /** Half maximal effective concentration causing a response in 50% of people. */ - EC50 = 'EC50', - /** Lethal concentration resulting in death for 50% of the population. */ - LC50 = 'LC50', - /** Lethal dose resulting in death for 50% of the population. */ - LD50 = 'LD50', - /** Toxic dose causing adverse effects in 50% of the population. */ - TD50 = 'TD50', - /** Lowest Observed Adverse Effect Level. */ - LOAEL = 'LOAEL', - /** Lowest Observed Effect Level. */ - LOEL = 'LOEL', - /** No Observed Adverse Effect Level. */ - NOAEL = 'NOAEL', - /** No Observed Effect Level. */ - NOEL = 'NOEL' -}; - -/** - * Route of exposure used during toxicological testing. - */ -export enum ToxicityApplication { - /** Through direct contact with the skin. */ - DERMAL = 'dermal', - /** Through breathing of gas, vapor, or particulates. */ - INHALATION = 'inhalation', - /** Injection into the body cavity. */ - INTRAPERITONEAL = 'intraperitoneal', - /** Direct injection into a vein. */ - INTRAVENOUS = 'intravenous', - /** Ingestion through the mouth. */ - ORAL = 'oral', - /** Injection under the skin. */ - SUBCUTANEOUS = 'subcutaneous' -}; diff --git a/enum/science/abundance.ts b/enum/science/abundance.ts new file mode 100644 index 00000000..4e4327f8 --- /dev/null +++ b/enum/science/abundance.ts @@ -0,0 +1,50 @@ +/** + * @file enum/science/abundance.ts + * @description Defines enums for natural occurrence and abundance of elements and substances + * in various cosmic and terrestrial reservoirs. + */ + +/** + * Classification of elements based on their origin and persistence in the Earth's crust. + */ +export enum NaturalOccurrence { + /** Elements present since the formation of the Earth, with half-lives exceeding 10^8 years. */ + PRIMORDIAL = 'primordial', + /** Elements constantly replenished by the radioactive decay of heavier parent nuclei. */ + DECAY_PRODUCT = 'decayProduct', + /** Elements not occurring naturally in significant quantities, primarily produced via nuclear synthesis. */ + SYNTHETIC = 'synthetic' +}; + +/** + * Scientific reservoirs and contexts for measuring the distribution and + * concentration of chemical species. + */ +export enum AbundanceType { + /** The average elemental distribution across the observable cosmos, dominated by H and He. */ + UNIVERSE = 'universe', + /** The composition of the Sun and its orbiting bodies, reflecting the solar nebula's chemistry. */ + SOLAR_SYSTEM = 'solarSystem', + /** The chemical makeup of chondritic and non-chondritic meteorites, proxies for early solar system solids. */ + METEORITES = 'meteorites', + /** The outermost solid shell of Earth, enriched in lithophile elements like Si, Al, and O. */ + EARTH_CRUST = 'earthCrust', + /** The silicate layer between the crust and core, constituting the bulk of Earth's volume. */ + EARTH_MANTLE = 'earthMantle', + /** The combined mass of Earth's liquid water, including oceans and ice caps. */ + OCEAN = 'ocean', + /** The saline water body covering most of Earth, major reservoir for Na, Cl, and Mg. */ + SEAWATER = 'seawater', + /** Freshwater systems including rivers and lakes, reflecting local continental weathering. */ + STREAMS = 'streams', + /** The gaseous envelope surrounding Earth, primarily N2, O2, and trace noble gases. */ + ATMOSPHERE = 'atmosphere', + /** Naturally occurring inorganic solids with defined chemical compositions and crystal structures. */ + MINERALS = 'minerals', + /** Mineral aggregates from which valuable elements can be economically extracted. */ + ORES = 'ores', + /** The average elemental composition of a human organism, dominated by O, C, H, and N. */ + HUMAN_BODY = 'humanBody', + /** The distribution of elements across diverse biological systems and metabolic pathways. */ + BIOLOGY = 'biology' +}; diff --git a/enum/science/chemistry.ts b/enum/science/chemistry.ts new file mode 100644 index 00000000..a845f2d5 --- /dev/null +++ b/enum/science/chemistry.ts @@ -0,0 +1,445 @@ +/** + * @file enum/science/chemistry.ts + * @description Defines enums for chemical properties, structural arrangements, and mineralogical characteristics. + * Covers acidity, bonding, crystallography, and mechanical properties of substances. + */ + +/** + * Classification of substances based on their pH behavior and proton donor/acceptor strength. + */ +export enum AcidBaseCharacter { + /** Neither acidic nor basic; pH around 7.0 in aqueous solution. */ + NEUTRAL = 'neutral', + /** Completely dissociates in water to release H+ ions (e.g., HCl). */ + STRONG_ACIDIC = 'strongAcidic', + /** General term for substances with pH < 7. */ + ACIDIC = 'acidic', + /** Significant acidity but not fully dissociated. */ + MODERATE_ACIDIC = 'moderateAcidic', + /** Partially dissociates in water, maintaining an equilibrium (e.g., CH3COOH). */ + WEAK_ACIDIC = 'weakAcidic', + /** Can react as both an acid and a base depending on conditions (e.g., H2O, Al2O3). */ + AMPHOTERIC = 'amphoteric', + /** Partially reacts with water to release OH- ions or accept protons. */ + WEAK_BASIC = 'weakBasic', + /** Significant basicity without full dissociation. */ + MODERATE_BASIC = 'moderateBasic', + /** General term for substances with pH > 7. */ + BASIC = 'basic', + /** Completely dissociates in water to release OH- ions (e.g., NaOH). */ + STRONG_BASIC = 'strongBasic' +}; + +/** + * Fundamental roles in Brønsted-Lowry or Lewis acid-base theory. + */ +export enum BasicityType { + /** Proton donor or electron pair acceptor. */ + ACID = 'acid', + /** Proton acceptor or electron pair donor. */ + BASE = 'base' +}; + +/** + * Pearson's Hard and Soft Acids and Bases (HSAB) theory for predicting reaction stability. + */ +export enum HSAB { + /** Small, high-oxidation state, and weakly polarizable species. */ + HARD = 'hard', + /** Species with intermediate size and polarizability. */ + EDGE = 'edge', + /** Large, low-oxidation state, and highly polarizable species. */ + SOFT = 'soft' +}; + +/** + * Goldschmidt classification of elements based on their preferred terrestrial host phases. + */ +export enum Goldschmidt { + /** "Vapor-loving": elements that remain in the atmosphere or hydrosphere (e.g., H, N, Noble Gases). */ + ATMOPHILE = 'atmophile', + /** "Sulfur-loving": elements that concentrate in sulfide minerals (e.g., Cu, Zn, Ag). */ + CHALCOPHILE = 'chalcophile', + /** "Rock-loving": elements that concentrate in silicate minerals (e.g., Al, Mg, K). */ + LITHOPHILE = 'lithophile', + /** "Iron-loving": elements that concentrate in metallic iron (e.g., Ni, Co, Au). */ + SIDEROPHILE = 'siderophile', + /** Elements not found naturally in the Earth's crust, produced via nuclear synthesis. */ + SYNTHETIC = 'synthetic' +}; + +/** + * Strength of Lewis acids/bases based on electron pair interaction. + */ +export enum LewisModel { + /** High affinity for electron pair exchange. */ + STRONG = 'strong', + /** Intermediate affinity for electron pair exchange. */ + MODERATE = 'moderate', + /** Low affinity for electron pair exchange. */ + WEAK = 'weak', + /** No significant Lewis acid/base interaction. */ + NONE = 'none' +}; + +/** + * Acid-base behavior specifically defined by the Brønsted-Lowry proton transfer model. + */ +export enum BronstedCharacter { + /** A species that can donate a hydrogen ion (proton). */ + ACID = 'acid', + /** A species that can accept a hydrogen ion (proton). */ + BASE = 'base', + /** A species that can either donate or accept a proton. */ + AMPHOTERIC = 'amphoteric', + /** A species that neither donates nor accepts protons in the given context. */ + NEUTRAL = 'neutral' +}; + +/** + * Chemical character of binary oxygen compounds. + */ +export enum OxideCharacter { + /** Reacts with water to form acids or with bases to form salts. */ + ACIDIC = 'acidic', + /** Can react with both acids and bases. */ + AMPHOTERIC = 'amphoteric', + /** Reacts with water to form bases or with acids to form salts. */ + BASIC = 'basic' +}; + +/** + * Descriptive terms for the degree to which a substance dissolves in a solvent. + */ +export enum SolubilityQualifier { + /** Less than 1 part solvent needed per 1 part solute. */ + VERY_SOLUBLE = 'verySoluble', + /** 1 to 10 parts solvent needed per 1 part solute. */ + FREELY_SOLUBLE = 'freelySoluble', + /** 10 to 30 parts solvent needed per 1 part solute. */ + SOLUBLE = 'soluble', + /** 30 to 100 parts solvent needed per 1 part solute. */ + SPARINGLY_SOLUBLE = 'sparinglySoluble', + /** 100 to 1,000 parts solvent needed per 1 part solute. */ + SLIGHTLY_SOLUBLE = 'slightlySoluble', + /** 1,000 to 10,000 parts solvent needed per 1 part solute. */ + VERY_SLIGHTLY_SOLUBLE = 'verySlightlySoluble', + /** More than 10,000 parts solvent needed per 1 part solute. */ + PRACTICALLY_INSOLUBLE = 'practicallyInsoluble' +}; + +/** + * Geometric arrangement of atoms in a molecule as predicted by VSEPR theory. + */ +export enum MolecularShape { + /** Atoms arranged in a straight line (180° bond angle). */ + LINEAR = 'linear', + /** Three atoms at the corners of an equilateral triangle around a central atom (120°). */ + TRIGONAL_PLANAR = 'trigonalPlanar', + /** Non-linear arrangement caused by lone pairs (e.g., H2O). */ + BENT = 'bent', + /** Central atom with four substituents at the corners of a tetrahedron (109.5°). */ + TETRAHEDRAL = 'tetrahedral', + /** Central atom with three substituents and one lone pair forming a pyramid. */ + TRIGONAL_PYRAMIDAL = 'trigonalPyramidal', + /** Central atom with five substituents; three in a plane and two at the poles. */ + TRIGONAL_BIPYRAMIDAL = 'trigonalBipyramidal', + /** Derived from trigonal bipyramidal with one lone pair in the equatorial position. */ + SEESAW = 'seesaw', + /** Central atom with three substituents and two lone pairs. */ + T_SHAPED = 'tShaped', + /** Central atom with six substituents at the corners of an octahedron (90°). */ + OCTAHEDRAL = 'octahedral', + /** Central atom with five substituents and one lone pair. */ + SQUARE_PYRAMIDAL = 'squarePyramidal', + /** Central atom with four substituents and two lone pairs in a plane (90°). */ + SQUARE_PLANAR = 'squarePlanar', + /** Central atom with seven substituents. */ + PENTAGONAL_BIPYRAMIDAL = 'pentagonalBipyramidal', + /** Central atom with six substituents and one lone pair in a pentagonal arrangement. */ + PENTAGONAL_PYRAMIDAL = 'pentagonalPyramidal', + /** Central atom with five substituents and two lone pairs in a plane. */ + PENTAGONAL_PLANAR = 'pentagonalPlanar', + /** Eight substituents arranged around a central atom in a square antiprism. */ + SQUARE_ANTIPRISMATIC = 'squareAntiprismatic', + /** Central atom with nine substituents. */ + TRICAPPED_TRIGONAL_PRISMATIC = 'tricappedTrigonalPrismatic' +}; + +/** + * Primary types of chemical attraction holding atoms or molecules together. + */ +export enum BondType { + /** Electrostatic attraction between oppositely charged ions. */ + IONIC = 'ionic', + /** Sharing of electron pairs between atoms. */ + COVALENT = 'covalent', + /** Sharing of delocalized electrons among a lattice of metal cations. */ + METALLIC = 'metallic', + /** Weak intermolecular forces including London dispersion and dipole-dipole. */ + VDW = 'vdw', + /** Strong dipole-dipole attraction between H and N, O, or F. */ + HYDROGEN = 'hydrogen' +}; + +/** + * Mixing of atomic orbitals to form new hybrid orbitals suitable for bonding. + */ +export enum Hybridization { + /** sd2 hybridization involving one s and two d orbitals. */ + SD2 = 'sd2', + /** sd3 hybridization involving one s and three d orbitals. */ + SD3 = 'sd3', + /** sd4 hybridization involving one s and four d orbitals. */ + SD4 = 'sd4', + /** sd5 hybridization involving one s and five d orbitals. */ + SD5 = 'sd5', + /** Mixing of one s and one p orbital (linear geometry). */ + SP = 'sp', + /** Mixing of one s and two p orbitals (trigonal planar). */ + SP2 = 'sp2', + /** Mixing of one s and three p orbitals (tetrahedral). */ + SP3 = 'sp3', + /** Mixing of one s, two p, and one d orbital. */ + SP2D = 'sp2d', + /** Mixing of one s, three p, and one d orbital. */ + SP3D = 'sp3d', + /** Mixing of one s, three p, and two d orbitals. */ + SP3D2 = 'sp3d2', + /** Mixing of one s, three p, and three d orbitals. */ + SP3D3 = 'sp3d3', + /** Mixing of one s, three p, and four d orbitals. */ + SP3D4 = 'sp3d4', + /** Mixing of one s, three p, and five d orbitals. */ + SP3D5 = 'sp3d5' +}; + +/** + * Broadest classification of crystals based on the symmetry of their unit cells. + */ +export enum CrystalFamily { + /** Three unequal axes, none at right angles. */ + TRICLINIC = 'triclinic', + /** Three unequal axes, one at a right angle. */ + MONOCLINIC = 'monoclinic', + /** Three unequal axes at right angles. */ + ORTHORHOMBIC = 'orthorhombic', + /** Subtype of hexagonal with a three-fold axis of rotation. */ + TRIGONAL = 'trigonal', + /** Two equal axes at 120°, third at a right angle. */ + HEXAGONAL = 'hexagonal', + /** Two equal axes, all at right angles. */ + TETRAGONAL = 'tetragonal', + /** Three equal axes at right angles. */ + CUBIC = 'cubic' +}; + +/** + * Standard categories of crystal lattices and their packing arrangements. + */ +export enum CrystalSystem { + /** Standard hexagonal lattice. */ + HEXAGONAL = 'hexagonal', + /** Efficient packing of spheres in a hexagonal arrangement. */ + HEXAGONAL_CLOSE_PACKED = 'hexagonalClosePacked', + /** Cubic lattice with an extra atom at the center. */ + BODY_CENTERED_CUBIC = 'bodyCenteredCubic', + /** Primitive cell with three equal axes and three equal non-90° angles. */ + RHOMBOHEDRAL = 'rhombohedral', + /** Simple cubic lattice with atoms only at the corners. */ + SIMPLE_CUBIC = 'simpleCubic', + /** Cubic lattice with extra atoms at the centers of all faces. */ + FACE_CENTERED_CUBIC = 'faceCenteredCubic', + /** Face-centered cubic with half of tetrahedral voids occupied (e.g., Diamond, Si). */ + DIAMOND_CUBIC = 'diamondCubic', + /** Three unequal axes at 90°. */ + ORTHORHOMBIC = 'orthorhombic', + /** Two equal axes at 90°. */ + TETRAGONAL = 'tetragonal', + /** Complex hexagonal packing sequence (ABAC). */ + DOUBLE_HEXAGONAL_CLOSE_PACKED = 'doubleHexagonalClosePacked', + /** One axis not at 90°. */ + MONOCLINIC = 'monoclinic', + /** No axes at 90°, all axes unequal. */ + TRICLINIC = 'triclinic' +}; + +/** + * The characteristic external shape of an individual crystal or aggregate of crystals. + */ +export enum CrystalHabit { + /** Needle-like, long and slender. */ + ACICULAR = 'acicular', + /** Tree-like, branching in three dimensions. */ + ARBORESCENT = 'arborescent', + /** Hair-like or thread-like. */ + CAPILLARY = 'capillary', + /** Rounded, spherical forms. */ + COLLOFORM = 'colloform', + /** Layers arranged around a central point. */ + CONCENTRIC = 'concentric', + /** Tree-like, branching in two dimensions. */ + DENDRITIC = 'dendritic', + /** A surface covered in tiny, sparkling crystals. */ + DRUSE = 'druse', + /** Composed of parallel or radiating fibers. */ + FIBROUS = 'fibrous', + /** Composed of thin, separable sheets or lamellae. */ + FOLIATED = 'foliated', + /** Composed of many small, equidimensional grains. */ + GRANULAR = 'granular', + /** Crystal faces grow faster at edges than centers, creating hollows. */ + HOPPER = 'hopper', + /** Small, rounded grains resembling fish roe (< 2mm). */ + OOLITHIC = 'oolithic', + /** Pea-sized rounded grains (> 2mm). */ + PISOLITIC = 'pisolitic', + /** Flat, tablet-like or plate-like. */ + PLATY = 'platy', + /** Feathery or plume-like. */ + PLUMOSE = 'plumose', + /** Radiating from a central point. */ + RADIAL = 'radial', + /** Interwoven, net-like aggregate. */ + RETICULATED = 'reticulated', + /** Petal-like arrangement resembling a rose. */ + ROSETTE = 'rosette', + /** Cone-shaped or icicle-like (e.g., Stalactites). */ + STALACTITIC = 'stalactitic', + /** Star-shaped radiating crystals. */ + STELLATE = 'stellate', + /** Almond-shaped, often as gas bubble fillings in volcanic rocks. */ + AMYGDALOIDAL = 'amygdaloidal', + /** Crystals with different forms at each end. */ + HEMIMORPHIC = 'hemimorphic', + /** Large, shapeless aggregate. */ + MASSIVE = 'massive', + /** Crystal growing on top of another like a scepter. */ + SCEPTERED = 'sceptered', + /** Cube-shaped. */ + CUBIC = 'cubic', + /** 12-sided form where each face is a rhombus. */ + DODECAHEDRAL = 'dodecahedral', + /** Pair of crystals that are mirror images of each other. */ + ENANTIOMORPHIC = 'enantiomorphic', + /** Six-sided prism or pyramid. */ + HEXAGONAL = 'hexagonal', + /** 24-sided form. */ + ICOSITETRAHEDRAL = 'icositetrahedral', + /** Eight-sided form. */ + OCTAHEDRAL = 'octahedral', + /** Column-like with parallel faces. */ + PRISMATIC = 'prismatic', + /** Six-sided form with leaning faces. */ + RHOMBOHEDRAL = 'rhombohedral', + /** Form with scalene triangle faces. */ + SCALENOEHEDRAL = 'scalenohedral', + /** Four-sided pyramid. */ + TETRAHEDRAL = 'tetrahedral', + /** Resembling a bunch of grapes. */ + BOTRYOIDAL = 'botryoidal', + /** Sphere-like. */ + GLOBULAR = 'globular', + /** Large, breast-like rounded forms. */ + MAMMILLARY = 'mammillary', + /** Kidney-shaped. */ + RENIFORM = 'reniform' +}; + +/** + * The geometric orientation of planes along which a crystal tends to break. + */ +export enum CleavageType { + /** Parallel to the base of the crystal (001). */ + BASAL = 'basal', + /** Parallel to the faces of a prism. */ + PRISMATIC = 'prismatic', + /** Parallel to the faces of a cube (e.g., Halite). */ + CUBIC = 'cubic', + /** Parallel to the faces of a rhombohedron. */ + RHOMBOHEDRAL = 'rhombohedral', + /** Parallel to the faces of an octahedron (e.g., Fluorite). */ + OCTAHEDRAL = 'octahedral', + /** Parallel to the faces of a dodecahedron. */ + DODECAHEDRAL = 'dodecahedral' +}; + +/** + * Geometric relationship between intergrown crystals of the same species. + */ +export enum TwinningType { + /** Intergrown along a common plane. */ + CONTACT = 'contact', + /** Intergrown such that they seem to pass through each other. */ + PENETRATION = 'penetration', + /** Multiple parallel contact twins (e.g., Plagioclase). */ + POLYSYNTHETIC = 'polysynthetic', + /** Radial arrangement of multiple twins. */ + CYCLIC = 'cyclic' +}; + +/** + * The physical mechanism causing crystal twinning. + */ +export enum TwinningMode { + /** Occurs during the initial crystallization from a melt or solution. */ + GROWTH = 'growth', + /** Occurs when a high-temperature structure cools and rearranges. */ + TRANSFORMATION = 'transformation', + /** Occurs due to mechanical stress applied to the crystal (e.g., Calcite). */ + DEFORMATION = 'deformation' +}; + +/** + * Qualitative measure of how easily and cleanly a crystal breaks along its cleavage planes. + */ +export enum CleavageQuality { + /** Breaks into smooth, mirror-like surfaces. */ + PERFECT = 'perfect', + /** Breaks reliably but with slight irregularities. */ + GOOD = 'good', + /** Breaks poorly with rough surfaces. */ + IMPERFECT = 'imperfect', + /** Difficult to see or irregular. */ + INDISTINCT = 'indistinct', + /** No tendency to break along planes; breaks by fracture only. */ + NONE = 'none' +}; + +/** + * The appearance of a broken surface not along a cleavage plane. + */ +export enum FractureType { + /** Shell-like, curved break (e.g., Quartz, Obsidian). */ + CONCHOIDAL = 'conchoidal', + /** Irregular and rough. */ + UNEVEN = 'uneven', + /** Relatively flat but not a cleavage plane. */ + SMOOTH = 'smooth', + /** Breaks into fibers or strands. */ + FIBROUS = 'fibrous', + /** Jagged with sharp edges (common in metals). */ + HACKLY = 'hackly', + /** Breaks into sharp, elongated fragments. */ + SPLINTERY = 'splintery', + /** Breaks like clods of earth or clay. */ + EARTHY = 'earthy' +}; + +/** + * The resistance of a material to being broken, crushed, or bent. + */ +export enum Tenacity { + /** Breaks or powders easily when hit. */ + BRITTLE = 'brittle', + /** Can be hammered or rolled into thin sheets. */ + MALLEABLE = 'malleable', + /** Can be drawn into thin wires. */ + DUCTILE = 'ductile', + /** Can be cut into thin shavings with a knife. */ + SECTILE = 'sectile', + /** Bends but returns to its original shape. */ + ELASTIC = 'elastic', + /** Bends and stays in the new shape. */ + PLASTIC = 'plastic' +}; diff --git a/enum/science/composition.ts b/enum/science/composition.ts new file mode 100644 index 00000000..7c73e2fc --- /dev/null +++ b/enum/science/composition.ts @@ -0,0 +1,16 @@ +/** + * @file enum/science/composition.ts + * @description Defines enums for chemical composition representation types. + */ + +/** + * Methods for specifying the quantitative relationship between components in a substance. + */ +export enum CompositionType { + /** Precise integer ratios of atoms in a chemical formula based on Dalton's laws. */ + STOICHIOMETRY = 'stoichiometry', + /** Non-stoichiometric compositions where component ratios vary within defined limits. */ + RANGE = 'range', + /** Proportional distribution expressed as mass, molar, or volume fractions. */ + FRACTION = 'fraction' +}; diff --git a/enum/science/compound.ts b/enum/science/compound.ts new file mode 100644 index 00000000..88729758 --- /dev/null +++ b/enum/science/compound.ts @@ -0,0 +1,80 @@ +/** + * @file enum/science/compound.ts + * @description Defines enums for classifying and describing chemical compounds based on structure and bonding. + */ + +/** + * Classification based on the nature of chemical bonding and structural arrangement. + */ +export enum CompoundCategory { + /** Discrete units held together by covalent bonds, typically with low melting points. */ + MOLECULAR = 'molecular', + /** Three-dimensional lattices held by electrostatic forces between cations and anions. */ + IONIC = 'ionic', + /** Solid phases containing two or more metallic elements with metallic bonding. */ + INTERMETALLIC = 'intermetallic', + /** Coordination compounds consisting of a central metal atom bonded to surrounding ligands. */ + COMPLEX = 'complex', + /** Extended structures held by continuous covalent bonds, such as diamond or quartz. */ + NETWORK = 'network' +}; + +/** + * Classification based on the number of distinct elements present in the compound. + */ +export enum CompoundComposition { + /** Compounds consisting of exactly two different elements. */ + BINARY = 'binary', + /** Compounds consisting of exactly three different elements. */ + TERNARY = 'ternary', + /** Compounds consisting of exactly four different elements. */ + QUATERNARY = 'quaternary', + /** Complex compounds consisting of many different elemental components. */ + POLYCOMPONENT = 'polycomponent' +}; + +/** + * Functional and structural groupings of chemical compounds. + */ +export enum CompoundClass { + /** Neutral ionic compounds formed by the neutralization reaction of an acid and a base. */ + SALT = 'salt', + /** Binary compounds of oxygen with another element. */ + OXIDE = 'oxide', + /** Compounds of hydrogen with another element, ranging from ionic to covalent. */ + HYDRIDE = 'hydride', + /** Binary compounds containing a halogen atom in the -1 oxidation state. */ + HALIDE = 'halide', + /** Substances that can donate a proton (Brønsted-Lowry) or accept an electron pair (Lewis). */ + ACID = 'acid', + /** Substances that can accept a proton or donate an electron pair. */ + BASE = 'base', + /** Metallic substances composed of two or more elements in solid solution. */ + ALLOY = 'alloy' +}; + +/** + * Specific chemical or structural characteristics of compounds. + */ +export enum CompoundProperty { + /** Compounds primarily composed of carbon-hydrogen bonds, often including O, N, S. */ + ORGANIC = 'organic', + /** Compounds that are not organic, typically including minerals and metals. */ + INORGANIC = 'inorganic', + /** Compounds containing at least one chemical bond between a carbon atom and a metal. */ + ORGANOMETALLIC = 'organometallic', + /** Chemical substances specifically relevant to biological processes and organisms. */ + BIOCHEMICAL = 'biochemical', + /** Large molecules composed of many repeated subunits (monomers). */ + POLYMER = 'polymer', + /** Molecular assemblies held together by non-covalent interactions like hydrogen bonding. */ + SUPRAMOLECULAR = 'supramolecular', + /** Molecules with the same molecular formula but different structural arrangements. */ + ISOMERIC = 'isomeric', + /** Molecules that lack an internal plane of symmetry and have non-superimposable mirror images. */ + CHIRAL = 'chiral', + /** Cyclic, planar molecules with a ring of resonance bonds that exhibit enhanced stability. */ + AROMATIC = 'aromatic', + /** Highly reactive species with one or more unpaired electrons. */ + RADICAL = 'radical' +}; diff --git a/enum/science/descriptive.ts b/enum/science/descriptive.ts new file mode 100644 index 00000000..4c15b497 --- /dev/null +++ b/enum/science/descriptive.ts @@ -0,0 +1,21 @@ +/** + * @file enum/science/descriptive.ts + * @description Defines enums for sensory and qualitative properties of substances. + */ + +/** + * Properties that can be perceived by human senses, used in descriptive collection + * for textual description of substances. + */ +export enum SensoryProperty { + /** The visible form and macroscopic structure of a substance. */ + APPEARANCE = 'appearance', + /** The flavor profile as perceived by gustatory receptors. */ + TASTE = 'taste', + /** The scent produced by volatile molecules interacting with olfactory receptors. */ + ODOR = 'odor', + /** The physical feel or surface consistency of a material. */ + TEXTURE = 'texture', + /** The color of the substance as perceived by human eyes. */ + COLOR = 'color' +}; diff --git a/enum/science/element.ts b/enum/science/element.ts new file mode 100644 index 00000000..6a68d77b --- /dev/null +++ b/enum/science/element.ts @@ -0,0 +1,463 @@ +/** + * @file enum/science/element.ts + * @description Defines enums related to chemical elements and their periodic classification. + * This module covers elemental symbols, periodic table structure, blocks, chemical sets, + * and specific elemental properties. + */ + +/** + * Unique chemical symbols for all known elements in the periodic table. + * These symbols follow IUPAC nomenclature and represent elements from Hydrogen to Oganesson. + */ +export enum ElementSymbol { + /** Hydrogen */ + H = 'h', + /** Helium */ + He = 'he', + /** Lithium */ + Li = 'li', + /** Beryllium */ + Be = 'be', + /** Boron */ + B = 'b', + /** Carbon */ + C = 'c', + /** Nitrogen */ + N = 'n', + /** Oxygen */ + O = 'o', + /** Fluorine */ + F = 'f', + /** Neon */ + Ne = 'ne', + /** Sodium */ + Na = 'na', + /** Magnesium */ + Mg = 'mg', + /** Aluminium */ + Al = 'al', + /** Silicon */ + Si = 'si', + /** Phosphorus */ + P = 'p', + /** Sulfur */ + S = 's', + /** Chlorine */ + Cl = 'cl', + /** Argon */ + Ar = 'ar', + /** Potassium */ + K = 'k', + /** Calcium */ + Ca = 'ca', + /** Scandium */ + Sc = 'sc', + /** Titanium */ + Ti = 'ti', + /** Vanadium */ + V = 'v', + /** Chromium */ + Cr = 'cr', + /** Manganese */ + Mn = 'mn', + /** Iron */ + Fe = 'fe', + /** Cobalt */ + Co = 'co', + /** Nickel */ + Ni = 'ni', + /** Copper */ + Cu = 'cu', + /** Zinc */ + Zn = 'zn', + /** Gallium */ + Ga = 'ga', + /** Germanium */ + Ge = 'ge', + /** Arsenic */ + As = 'as', + /** Selenium */ + Se = 'se', + /** Bromine */ + Br = 'br', + /** Krypton */ + Kr = 'kr', + /** Rubidium */ + Rb = 'rb', + /** Strontium */ + Sr = 'sr', + /** Yttrium */ + Y = 'y', + /** Zirconium */ + Zr = 'zr', + /** Niobium */ + Nb = 'nb', + /** Molybdenum */ + Mo = 'mo', + /** Technetium */ + Tc = 'tc', + /** Ruthenium */ + Ru = 'ru', + /** Rhodium */ + Rh = 'rh', + /** Palladium */ + Pd = 'pd', + /** Silver */ + Ag = 'ag', + /** Cadmium */ + Cd = 'cd', + /** Indium */ + In = 'in', + /** Tin */ + Sn = 'sn', + /** Antimony */ + Sb = 'sb', + /** Tellurium */ + Te = 'te', + /** Iodine */ + I = 'i', + /** Xenon */ + Xe = 'xe', + /** Caesium */ + Cs = 'cs', + /** Barium */ + Ba = 'ba', + /** Lanthanum */ + La = 'la', + /** Cerium */ + Ce = 'ce', + /** Praseodymium */ + Pr = 'pr', + /** Neodymium */ + Nd = 'nd', + /** Promethium */ + Pm = 'pm', + /** Samarium */ + Sm = 'sm', + /** Europium */ + Eu = 'eu', + /** Gadolinium */ + Gd = 'gd', + /** Terbium */ + Tb = 'tb', + /** Dysprosium */ + Dy = 'dy', + /** Holmium */ + Ho = 'ho', + /** Erbium */ + Er = 'er', + /** Thulium */ + Tm = 'tm', + /** Ytterbium */ + Yb = 'yb', + /** Lutetium */ + Lu = 'lu', + /** Hafnium */ + Hf = 'hf', + /** Tantalum */ + Ta = 'ta', + /** Tungsten */ + W = 'w', + /** Rhenium */ + Re = 're', + /** Osmium */ + Os = 'os', + /** Iridium */ + Ir = 'ir', + /** Platinum */ + Pt = 'pt', + /** Gold */ + Au = 'au', + /** Mercury */ + Hg = 'hg', + /** Thallium */ + Tl = 'tl', + /** Lead */ + Pb = 'pb', + /** Bismuth */ + Bi = 'bi', + /** Polonium */ + Po = 'po', + /** Astatine */ + At = 'at', + /** Radon */ + Rn = 'rn', + /** Francium */ + Fr = 'fr', + /** Radium */ + Ra = 'ra', + /** Actinium */ + Ac = 'ac', + /** Thorium */ + Th = 'th', + /** Protactinium */ + Pa = 'pa', + /** Uranium */ + U = 'u', + /** Neptunium */ + Np = 'np', + /** Plutonium */ + Pu = 'pu', + /** Americium */ + Am = 'am', + /** Curium */ + Cm = 'cm', + /** Berkelium */ + Bk = 'bk', + /** Californium */ + Cf = 'cf', + /** Einsteinium */ + Es = 'es', + /** Fermium */ + Fm = 'fm', + /** Mendelevium */ + Md = 'md', + /** Nobelium */ + No = 'no', + /** Lawrencium */ + Lr = 'lr', + /** Rutherfordium */ + Rf = 'rf', + /** Dubnium */ + Db = 'db', + /** Seaborgium */ + Sg = 'sg', + /** Bohrium */ + Bh = 'bh', + /** Hassium */ + Hs = 'hs', + /** Meitnerium */ + Mt = 'mt', + /** Darmstadtium */ + Ds = 'ds', + /** Roentgenium */ + Rg = 'rg', + /** Copernicium */ + Cn = 'cn', + /** Nihonium */ + Nh = 'nh', + /** Flerovium */ + Fl = 'fl', + /** Moscovium */ + Mc = 'mc', + /** Livermorium */ + Lv = 'lv', + /** Tennessine */ + Ts = 'ts', + /** Oganesson */ + Og = 'og' +}; + +/** + * Classifies elements into groups with similar physical and chemical characteristics. + */ +export enum ElementSet { + /** Elements lacking metallic properties, typically highly electronegative. */ + NON_METAL = 'nonMetal', + /** Chemically inert, monoatomic gases at standard conditions with full valence shells. */ + NOBLE_GAS = 'nobleGas', + /** Highly reactive metals in group 1 that readily lose one electron to form cations. */ + ALKALI_METAL = 'alkaliMetal', + /** Shiny, silvery-white, somewhat reactive metals in group 2. */ + ALKALINE_EARTH_METAL = 'alkalineEarthMetal', + /** Elements with properties intermediate between those of metals and solid nonmetals. */ + METALLOID = 'metalloid', + /** Group 17 elements that form strongly acidic compounds with hydrogen and salts with metals. */ + HALOGEN = 'halogen', + /** General classification for elements that are good conductors of heat and electricity. */ + METAL = 'metal', + /** Elements whose atoms have a partially filled d sub-shell, characterized by multiple oxidation states. */ + TRANSITION_METAL = 'transitionMetal', + /** Fifteen metallic elements with atomic numbers 57 through 71, characterized by filling the 4f subshell. */ + LANTHANOIDE = 'lanthanoid', + /** Fifteen metallic elements with atomic numbers 89 through 103, all being radioactive. */ + ACTINOIDE = 'actinoide' +}; + +/** + * Standard group names for the vertical columns in the periodic table. + */ +export enum ElementGroup { + /** Elements in the first vertical column, excluding hydrogen. */ + ALKALI_METAL = 'alkaliMetal', + /** Elements in the second vertical column. */ + ALKALINE_EARTH_METAL = 'alkalineEarthMetal', + /** Elements in the third vertical column. */ + SCANDIUM_GROUP = 'scandiumGroup', + /** Elements in the fourth vertical column. */ + TITANIUM_GROUP = 'titaniumGroup', + /** Elements in the fifth vertical column. */ + VANADIUM_GROUP = 'vanadiumGroup', + /** Elements in the sixth vertical column. */ + CHROMIUM_GROUP = 'chromiumGroup', + /** Elements in the seventh vertical column. */ + MANGANESE_GROUP = 'manganeseGroup', + /** Elements in the eighth vertical column. */ + IRON_GROUP = 'ironGroup', + /** Elements in the ninth vertical column. */ + COBALT_GROUP = 'cobaltGroup', + /** Elements in the tenth vertical column. */ + NICKEL_GROUP = 'nickelGroup', + /** Elements in the eleventh vertical column. */ + COPPER_GROUP = 'copperGroup', + /** Elements in the twelfth vertical column. */ + ZINC_GROUP = 'zincGroup', + /** Elements in column 13, also known as the icosagens. */ + BORON_GROUP = 'boronGroup', + /** Elements in column 14, also known as the crystallogens. */ + CARBON_GROUP = 'carbonGroup', + /** Elements in column 15, known for forming stable nitrides and phosphides. */ + PNICTOGEN = 'pnictogen', + /** Elements in column 16, known as the ore-forming elements. */ + CHALCOGEN = 'chalcogen', + /** Elements in column 17, highly reactive nonmetals. */ + HALOGEN = 'halogen', + /** Elements in column 18, characterized by minimal chemical reactivity. */ + NOBLE_GAS = 'nobleGas', + /** The series of elements from lanthanum to lutetium. */ + LANTHANOID_SERIES = 'lanthanoidSeries', + /** The series of elements from actinium to lawrencium. */ + ACTINOID_SERIES = 'actinoidSeries' +}; + +/** + * Qualitative properties and descriptors associated with chemical elements. + */ +export enum ElementProperty { + /** Known and used by ancient civilizations before the modern era. */ + ANTIQUITY = 'antiquity', + /** Elements occurring in nature as a single stable isotope. */ + MONONUCLEIDE = 'mononuclide', + /** Elements that are resistant to corrosion and oxidation in moist air. */ + NOBLE = 'noble', + /** Metals that occur in their native elemental form in nature. */ + NATIVE_METAL = 'nativeMetal', + /** The lanthanide elements plus scandium and yttrium, known for their magnetic and optical properties. */ + RARE_EARTH = 'rareEarth', + /** Six transition metal elements (Ru, Rh, Pd, Os, Ir, Pt) known for their catalytic activity and corrosion resistance. */ + PLATINUM_METAL = 'platinumMetal', + /** Metals with extremely high melting points and resistance to thermal deformation. */ + REFRACTORY_METAL = 'refractoryMetal', + /** Precious metals are rare, naturally occurring metallic chemical elements that have high economic value. */ + PRECIOUS_METAL = 'preciousMetal', + /** Metals that are used to make coins. */ + COINAGE_METALS = 'coinageMetals', + /** Metals with low density and atomic weight. */ + LIGHT_METAL = 'lightMetal', + /** Metals with high density, atomic weight, or atomic number, often toxic to life forms. */ + HEAVY_METAL = 'heavyMetal', + /** Metals with high atomic number and mass, often radioactive. */ + SUPERHEAVY_METAL = 'superheavyMetal', + /** Elements that exist as diatomic molecules. */ + DIATOMIC = 'diatomic', + /** Elements that can exist in multiple crystalline forms. */ + ALLOTROPIC = 'allotropic' +}; + +/** + * Electron shell models used to describe electron configurations. + */ +export enum ShellModel { + /** First electron shell (n=1). */ + K = 'k', + /** Second electron shell (n=2). */ + L = 'l', + /** Third electron shell (n=3). */ + M = 'm', + /** Fourth electron shell (n=4). */ + N = 'n', + /** Fifth electron shell (n=5). */ + O = 'o', + /** Sixth electron shell (n=6). */ + P = 'p', + /** Seventh electron shell (n=7). */ + Q = 'q' +}; + +/** + * Electron subshells used to describe electron configurations. + */ +export enum Subshell { + /** s orbital, which can hold up to 2 electrons. */ + S = 's', + /** p orbital, which can hold up to 6 electrons. */ + P = 'p', + /** d orbital, which can hold up to 10 electrons. */ + D = 'd', + /** f orbital, which can hold up to 14 electrons. */ + F = 'f' +}; + +/** + * Pauling spin states used in electron configurations. + */ +export enum PaulingSpin { + /** Electron spin pointing up. */ + UP = 'up', + /** Electron spin pointing down. */ + DOWN = 'down', + /** Electron spin pointing in both directions. */ + BOTH = 'both' +}; + +/** + * The 18 vertical columns of the periodic table representing groups of elements. + */ +export enum PeriodicTableColumn { + /** Group 1: Alkali metals and Hydrogen. */ + COLUMN_1 = 1, + /** Group 2: Alkaline earth metals. */ + COLUMN_2 = 2, + /** Group 3: Scandium group. */ + COLUMN_3 = 3, + /** Group 4: Titanium group. */ + COLUMN_4 = 4, + /** Group 5: Vanadium group. */ + COLUMN_5 = 5, + /** Group 6: Chromium group. */ + COLUMN_6 = 6, + /** Group 7: Manganese group. */ + COLUMN_7 = 7, + /** Group 8: Iron group. */ + COLUMN_8 = 8, + /** Group 9: Cobalt group. */ + COLUMN_9 = 9, + /** Group 10: Nickel group. */ + COLUMN_10 = 10, + /** Group 11: Copper group. */ + COLUMN_11 = 11, + /** Group 12: Zinc group. */ + COLUMN_12 = 12, + /** Group 13: Boron group. */ + COLUMN_13 = 13, + /** Group 14: Carbon group. */ + COLUMN_14 = 14, + /** Group 15: Pnictogens. */ + COLUMN_15 = 15, + /** Group 16: Chalcogens. */ + COLUMN_16 = 16, + /** Group 17: Halogens. */ + COLUMN_17 = 17, + /** Group 18: Noble gases. */ + COLUMN_18 = 18 +}; + +/** + * The 7 horizontal rows of the periodic table representing electron shells. + */ +export enum PeriodicTablePeriod { + /** First period: contains Hydrogen and Helium. */ + PERIOD_1 = 1, + /** Second period: Li through Ne. */ + PERIOD_2 = 2, + /** Third period: Na through Ar. */ + PERIOD_3 = 3, + /** Fourth period: K through Kr. */ + PERIOD_4 = 4, + /** Fifth period: Rb through Xe. */ + PERIOD_5 = 5, + /** Sixth period: Cs through Rn (including Lanthanoides). */ + PERIOD_6 = 6, + /** Seventh period: Fr through Og (including Actinoides). */ + PERIOD_7 = 7 +}; diff --git a/enum/science/formula.ts b/enum/science/formula.ts new file mode 100644 index 00000000..ddca76a0 --- /dev/null +++ b/enum/science/formula.ts @@ -0,0 +1,24 @@ +/** + * @file enum/science/formula.ts + * @description Defines enums for different types of chemical formula representations. + */ + +/** + * Standard formats for representing the elemental composition and structure of molecules. + */ +export enum FormulaType { + /** The simplest whole-number ratio of atoms of each element present in a compound. */ + EMPIRICAL = 'empirical', + /** The actual number of atoms of each element in a single molecule of a substance. */ + MOLECULAR = 'molecular', + /** A graphic representation showing the spatial arrangement of atoms and chemical bonds. */ + STRUCTURAL = 'structural', + /** A simplified structural formula where carbon atoms and C-H bonds are represented by vertices. */ + SKELETAL = 'skeletal', + /** A textual representation of the molecular structure showing atom groups in sequence. */ + CONDENSED = 'condensed', + /** A standard system for ordering elements (C first, then H, then alphabetical). */ + HILL = 'hill', + /** A generalized formula using variables (e.g., R-groups) to represent a class of compounds. */ + GENERIC = 'generic' +}; diff --git a/enum/science/generic.ts b/enum/science/generic.ts new file mode 100644 index 00000000..c81dbb6b --- /dev/null +++ b/enum/science/generic.ts @@ -0,0 +1,42 @@ +/** + * @file enum/science/generic.ts + * @description Defines generic enums for non-scientific contexts. + */ + +/** + * Precision level of economic values associated with chemical substances. + */ +export enum PriceValue { + /** A confirmed, single-point market value at a specific time. */ + EXACT = 'exact', + /** Minimum and maximum observed values reflecting market volatility. */ + RANGE = 'range', + /** A starting price indicator for bulk or industrial quantities. */ + FROM = 'from' +}; + +/** + * The commercial or analytical context in which a price or value is defined. + */ +export enum PriceContext { + /** Consumer-level pricing for small, purified quantities or laboratory reagents. */ + RETAIL = 'retail', + /** Industrial-scale pricing for large volumes or raw materials. */ + WHOLESALE = 'wholesale', + /** A calculated or approximated value based on production costs or rarity. */ + ESTIMATE = 'estimate', + /** Recorded past prices used for longitudinal economic analysis. */ + HISTORICAL = 'historical' +}; + +/** + * Tax status of economic values, relevant for global trade and procurement. + */ +export enum PriceTax { + /** Total cost including all applicable value-added or sales taxes. */ + GROSS = 'gross', + /** Base cost before taxes, typically used in B2B and scientific procurement. */ + NET = 'net', + /** Undefined tax status in the provided data source. */ + UNKNOWN = 'unknown' +}; diff --git a/enum/science/history.ts b/enum/science/history.ts new file mode 100644 index 00000000..72c69d14 --- /dev/null +++ b/enum/science/history.ts @@ -0,0 +1,40 @@ +/** + * @file enum/science/history.ts + * @description Defines enums for tracking the historical development and discovery of elements and substances. + */ + +/** + * Milestones in the scientific history of a chemical species or phenomenon. + */ +export enum EventType { + /** The first recognition of a new substance, even if its nature is not fully understood. */ + DISCOVERY = 'discovery', + /** The first recorded sighting or experimental detection of a species. */ + FIRST_OBSERVATION = 'firstObservation', + /** The successful separation of a substance in its pure form from a mixture or ore. */ + ISOLATION = 'isolation', + /** The artificial production of a substance via chemical or nuclear reactions. */ + SYNTHESIS = 'synthesis', + /** The official designation of a formal name, often following IUPAC conventions. */ + NAMING = 'naming', + /** The independent verification of a discovery by other scientific groups. */ + CONFIRMATION = 'confirmation', + /** The first comprehensive measurement of physical and chemical properties. */ + CHARACTERIZATION = 'characterization', + /** Miscellaneous historical milestones not covered by other categories. */ + MISC = 'misc' +}; + +/** + * Temporal precision formats for historical events. + */ +export enum EventTimeType { + /** A specific calendar day (ISO 8601). */ + DATE = 'date', + /** A specific calendar year. */ + YEAR = 'year', + /** An uncertain or extended interval between two points in time. */ + RANGE = 'range', + /** A descriptive temporal reference (e.g., "Antiquity", "Middle Ages"). */ + TEXT = 'text' +}; diff --git a/enum/science/mineral.ts b/enum/science/mineral.ts new file mode 100644 index 00000000..6b92eed7 --- /dev/null +++ b/enum/science/mineral.ts @@ -0,0 +1,106 @@ +/** + * @file enum/science/mineral.ts + * @description Defines enums for the classification and properties of naturally occurring minerals. + */ + +/** + * High-level classification of minerals based on their chemical composition and Dana/Strunz systems. + */ +export enum MineralClass { + /** Minerals composed of a single element in its native state (e.g., Diamond, Gold). */ + NATIVE_ELEMENTS = 'nativeElements', + /** Compounds of sulfur with metals or semi-metals (e.g., Pyrite, Galena). */ + SULFIDES = 'sulfides', + /** Compounds containing a halogen element as the main anion (e.g., Halite, Fluorite). */ + HALIDES = 'halides', + /** Compounds of oxygen with one or more metals (e.g., Hematite, Corundum). */ + OXIDES = 'oxides', + /** Minerals containing the carbonate ion (CO3)2- (e.g., Calcite, Malachite). */ + CARBONATES = 'carbonates', + /** Minerals containing borate anion groups (e.g., Borax). */ + BORATES = 'borates', + /** Minerals containing the sulfate ion (SO4)2- (e.g., Gypsum, Baryte). */ + SULFATES = 'sulfates', + /** Minerals containing the phosphate ion (PO4)3- (e.g., Apatite, Turquoise). */ + PHOSPHATES = 'phosphates', + /** The largest class, containing silicate tetrahedra (SiO4)4- (e.g., Quartz, Feldspar). */ + SILICATES = 'silicates', + /** Rare minerals formed through biological or organic processes (e.g., Whewellite). */ + ORGANIC = 'organic' +}; + +/** + * Detailed sub-classification of mineral groups based on structural and chemical nuances. + */ +export enum MineralSubClass { + /** Simple binary sulfides without additional complex anions. */ + SIMPLE_SULFIDE = 'simpleSulfide', + /** Sulfides where a semi-metal replaces some sulfur (e.g., Tetrahedrite). */ + SULFOSALT = 'sulfosalt', + /** Simple salts of hydrohalic acids. */ + SIMPLE_HALIDE = 'simpleHalide', + /** Simple metal-oxygen compounds. */ + SIMPLE_OXIDE = 'simpleOxide', + /** Compounds containing the hydroxyl (OH-) group. */ + HYDROXIDE = 'hydroxide', + /** Standard metal carbonates. */ + SIMPLE_CARBONATE = 'simpleCarbonate', + /** Minerals containing the nitrate (NO3)- group. */ + NITRATE = 'nitrate', + /** Standard metal sulfates. */ + SIMPLE_SULFATE = 'sulfate', + /** Minerals containing the chromate (CrO4)2- group. */ + CHROMATE = 'chromate', + /** Minerals containing the molybdate (MoO4)2- group. */ + MOLYBDATE = 'molybdate', + /** Minerals containing the tungstate (WO4)2- group. */ + TUNGSTATE = 'tungstate', + /** Minerals containing the arsenate (AsO4)3- group. */ + ARSENATE = 'arsenate', + /** Minerals containing the vanadate (VO4)3- group. */ + VANADATE = 'vanadate', + /** Isolated silicate tetrahedra linked by cations. */ + NESOSILICATE = 'nesosilicate', + /** Single or double chains of silicate tetrahedra. */ + INOSILICATE = 'inosilicate', + /** Two-dimensional sheets of silicate tetrahedra. */ + PHYLLOSILICATE = 'phyllosilicate', + /** Three-dimensional framework of silicate tetrahedra. */ + TECTOSILICATE = 'tectosilicate', + /** Rings of silicate tetrahedra. */ + CYCLOSILICATE = 'cyclosilicate', + /** Double tetrahedra (groups of two). */ + SOROSILICATE = 'sorosilicate' +}; + +/** + * Classification of the internal ordering and atomic arrangement of minerals. + */ +export enum MineralStructure { + /** Minerals with a highly ordered, repeating 3D lattice structure. */ + CRYSTALLINE = 'crystalline', + /** Solids lacking a long-range periodic atomic arrangement (e.g., Opal). */ + AMORPHOUS = 'amorphous', + /** Formerly crystalline minerals whose structure was destroyed by internal radiation (e.g., Zircon). */ + METAMICT = 'metamict' +}; + +/** + * Physical and chemical properties specific to mineral species. + */ +export enum MineralProperty { + /** Interaction with magnetic fields, common in iron-bearing minerals. */ + MAGNETIC = 'magnetic', + /** Emission of light not caused by heat (general term). */ + LUMINESCENT = 'luminescent', + /** Instantaneous emission of light upon excitation by UV radiation. */ + FLUORESCENT = 'fluorescent', + /** Delayed emission of light after the excitation source is removed. */ + PHOSPHORESCENT = 'phosphorescent', + /** Generation of electric charge in response to applied mechanical stress. */ + PIEZOELECTRIC = 'piezoelectric', + /** Generation of electric charge in response to temperature changes. */ + PYROELECTRIC = 'pyroelectric', + /** Capability of undergoing nuclear fission (e.g., Uraninite). */ + FISSIONABLE = 'fissionable' +}; diff --git a/enum/science/mixture.ts b/enum/science/mixture.ts new file mode 100644 index 00000000..06419e40 --- /dev/null +++ b/enum/science/mixture.ts @@ -0,0 +1,82 @@ +/** + * @file enum/science/mixture.ts + * @description Defines enums for classifying physical mixtures and their thermodynamic properties. + */ + +/** + * Fundamental categories of physical mixtures based on particle size and distribution. + */ +export enum MixtureType { + /** Homogeneous mixture where the solute is dispersed at the molecular or ionic level. */ + SOLUTION = 'solution', + /** Mixture with particle sizes between solutions and suspensions, exhibiting the Tyndall effect. */ + COLLOID = 'colloid', + /** Heterogeneous mixture containing large solid particles that will eventually settle. */ + SUSPENSION = 'suspension', + /** A colloid of two or more immiscible liquids where one is dispersed in the other. */ + EMULSION = 'emulsion' +}; + +/** + * Degree of uniformity in the distribution of components within a mixture. + */ +export enum MixtureHomogeneity { + /** Mixture with a uniform composition and properties throughout its entire volume. */ + HOMOGENEOUS = 'homogeneous', + /** Mixture consisting of physically distinct phases with non-uniform properties. */ + HETEROGENEOUS = 'heterogeneous' +}; + +/** + * Specific physical systems and states of matter combinations in mixtures. + */ +export enum MixtureSystem { + /** A blend of two or more gases, always forming a homogeneous phase. */ + GAS_MIXTURE = 'gasMixture', + /** A blend of two or more liquids, which may be miscible or immiscible. */ + LIQUID_MIXTURE = 'liquidMixture', + /** A blend of two or more solids, often requiring thermal processing to mix. */ + SOLID_MIXTURE = 'solidMixture', + /** A suspension of fine solid particles or liquid droplets in a gas. */ + AEROSOL = 'aerosol', + /** A system formed by trapping pockets of gas in a liquid or solid. */ + FOAM = 'foam', + /** A stable dispersion of one liquid in another immiscible liquid. */ + EMULSION = 'emulsion', + /** A colloidal suspension of very small solid particles in a continuous liquid medium. */ + SOL = 'sol', + /** A semi-solid colloidal system consisting of a liquid phase trapped in a solid matrix. */ + GEL = 'gel', + /** A solid solution of two or more metals or a metal and another element. */ + ALLOY = 'alloy', + /** A specific alloy of mercury with another metal. */ + AMALGAM = 'amalgam', + /** A mixture of liquids that maintains its composition and boiling point during distillation. */ + AZEOTROPE = 'azeotrope', + /** Mixture system not defined or characterized. */ + UNKNOWN = 'unknown' +}; + +/** + * Thermodynamic and structural characteristics of complex mixtures. + */ +export enum MixtureProperty { + /** Formation of a constant-boiling mixture that cannot be separated by simple distillation. */ + AZEOTROPIC = 'azeotropic', + /** A liquid mixture that can be separated by distillation because its vapor has a different composition. */ + ZEOTROPIC = 'zeotropic', + /** A mixture of substances that solidifies at a single temperature lower than that of any component. */ + EUTECTIC = 'eutectic', + /** The inability of two liquids to mix to form a homogeneous solution (e.g., oil and water). */ + IMMISCIBLE = 'immiscible', + /** Lack of a defined crystalline structure or long-range order in a solid mixture. */ + AMORPHOUS = 'amorphous', + /** Capable of being separated by physical means such as filtration or centrifugation. */ + SEPARABLE_MECHANICALLY = 'separableMechanically', + /** Capable of being separated by processes involving heat, such as distillation or evaporation. */ + SEPARABLE_THERMALLY = 'separableThermally', + /** Formed into a network structure, often seen in polymers or gels. */ + RETICULATED = 'reticulated', + /** Structure consisting of discrete, non-interconnecting gas pockets (e.g., closed-cell foam). */ + CLOSED_CELL = 'closedCell' +}; diff --git a/enum/science/nuclear.ts b/enum/science/nuclear.ts new file mode 100644 index 00000000..9e6585f5 --- /dev/null +++ b/enum/science/nuclear.ts @@ -0,0 +1,190 @@ +/** + * @file enum/science/nuclear.ts + * @description Defines enums for nuclear physics, including decay modes, radiation types, and quantum states. + */ + +/** + * Quantum property describing the symmetry of a wave function under spatial inversion. + */ +export enum SpinParity { + /** Wave function remains unchanged under spatial inversion (π = +1). */ + POSITIVE = 'positive', + /** Wave function changes sign under spatial inversion (π = -1). */ + NEGATIVE = 'negative', + /** Spin-parity state not yet experimentally determined. */ + UNKNOWN = 'unknown' +}; + +/** + * Mechanisms by which an unstable atomic nucleus loses energy by emitting radiation. + */ +export enum DecayMode { + /** Simultaneous conversion of two protons into two neutrons with emission of two positrons. */ + DOUBLE_BETA_PLUS = '2B+', + /** Simultaneous conversion of two neutrons into two protons with emission of two electrons. */ + DOUBLE_BETA_MINUS = '2B-', + /** Capture of two orbital electrons by the nucleus, typically resulting in two-neutrino emission. */ + DOUBLE_ELECTRON_CAPTURE = '2EC', + /** Simultaneous emission of two neutrons from a highly neutron-rich nucleus. */ + DOUBLE_NEUTRON_EMISSION = '2N', + /** Simultaneous emission of two protons from a highly proton-rich nucleus. */ + DOUBLE_PROTON_EMISSION = '2P', + /** Emission of a helium-4 nucleus (alpha particle), reducing atomic mass by 4. */ + ALPHA = 'A', + /** Emission of a positron (anti-electron) as a proton converts into a neutron. */ + BETA_PLUS = 'B+', + /** Positron emission followed by the immediate release of two protons. */ + BETA_PLUS_TWO_PROTON = 'B+2P', + /** Positron emission followed by the immediate release of an alpha particle. */ + BETA_PLUS_ALPHA = 'B+A', + /** Positron emission followed by the immediate release of a proton. */ + BETA_PLUS_PROTON = 'B+P', + /** Emission of an electron as a neutron converts into a proton. */ + BETA_MINUS = 'B-', + /** Electron emission followed by the immediate release of two neutrons. */ + BETA_MINUS_TWO_NEUTRON = 'B-2N', + /** Electron emission followed by the immediate release of three neutrons. */ + BETA_MINUS_THREE_NEUTRON = 'B-3N', + /** Electron emission followed by the immediate release of four neutrons. */ + BETA_MINUS_FOUR_NEUTRON = 'B-4N', + /** Electron emission followed by the immediate release of five neutrons. */ + BETA_MINUS_FIVE_NEUTRON = 'B-5N', + /** Electron emission followed by the immediate release of six neutrons. */ + BETA_MINUS_SIX_NEUTRON = 'B-6N', + /** Electron emission followed by the immediate release of seven neutrons. */ + BETA_MINUS_SEVEN_NEUTRON = 'B-7N', + /** Electron emission followed by the immediate release of an alpha particle. */ + BETA_MINUS_ALPHA = 'B-A', + /** Electron emission followed by the immediate release of a neutron. */ + BETA_MINUS_NEUTRON = 'B-N', + /** Electron emission followed by the immediate release of a proton. */ + BETA_MINUS_PROTON = 'B-P', + /** Beta decay followed by the spontaneous fission of the daughter nucleus. */ + BETA_MINUS_SPONTANEOUS_FISSION = 'B-SF', + /** Capture of an inner-shell orbital electron by the nucleus. */ + ELECTRON_CAPTURE = 'EC', + /** Competition between electron capture and positron emission. */ + ELECTRON_CAPTURE_BETA_PLUS = 'EC+B+', + /** Electron capture followed by the emission of two protons. */ + ELECTRON_CAPTURE_TWO_PROTON = 'EC2P', + /** Electron capture followed by the emission of an alpha particle. */ + ELECTRON_CAPTURE_ALPHA = 'ECA', + /** Electron capture followed by the emission of a proton. */ + ELECTRON_CAPTURE_PROTON = 'ECP', + /** Electron capture followed by the spontaneous fission of the daughter nucleus. */ + ELECTRON_CAPTURE_SPONTANEOUS_FISSION = 'ECSF', + /** De-excitation of a metastable nuclear state via gamma emission or internal conversion. */ + ISOMERIC_TRANSITION = 'IT', + /** Direct emission of a neutron from a nucleus, typically in neutron-rich isotopes. */ + NEUTRON_EMISSION = 'N', + /** Direct emission of a proton from a nucleus, typically in proton-rich isotopes. */ + PROTON_EMISSION = 'P', + /** Splitting of a heavy nucleus into two or more lighter nuclei without external provocation. */ + SPONTANEOUS_FISSION = 'SF', + /** Complex decay chain involving fission combined with beta/capture processes. */ + SPONTANEOUS_FISSION_EC_BPLUS = 'SF+EC+B+' +}; + +/** + * Types of ionizing or non-ionizing particles and waves emitted during nuclear processes. + */ +export enum RadiationType { + /** Helium-4 nuclei consisting of two protons and two neutrons. */ + ALPHA = 'alpha', + /** High-speed electrons or positrons emitted by certain types of radioactive nuclei. */ + BETA = 'beta', + /** High-energy electromagnetic radiation (photons) originating from the nucleus. */ + GAMMA = 'gamma', + /** Electromagnetic radiation typically originating from electron transitions in the shell. */ + XRAY = 'xray', + /** Electrons ejected from the atom as a result of energy transfer from the nucleus. */ + CONVERSION_ELECTRON = 'conversionElectron', + /** The antiparticle of the electron, having a positive charge. */ + POSITRON = 'positron', + /** Subatomic particles with no net electric charge, vital for fission chain reactions. */ + NEUTRON = 'neutron', + /** Positively charged subatomic particles found in the nucleus. */ + PROTON = 'proton', + /** Emission of nuclear fragments larger than an alpha particle (e.g., C-14, O-20). */ + CLUSTER = 'cluster' +}; + +/** + * Sub-classification of beta radiation based on the charge of the emitted lepton. + */ +export enum BetaRadiationType { + /** Emission of an electron (e-) and an antineutrino. */ + BETA_MINUS = 'betaMinus', + /** Emission of a positron (e+) and a neutrino. */ + BETA_PLUS = 'betaPlus' +}; + +/** + * Classification of beta decay transitions based on selection rules (spin and parity changes). + */ +export enum BetaTransitionType { + /** Transitions where spin change is 0 or 1 and parity is conserved. */ + ALLOWED = 'allowed', + /** Transitions with a spin change of 2 and a parity change. */ + FIRST_FORBIDDEN_UNIQUE = '1U', + /** Transitions with a spin change of 3 and no parity change. */ + SECOND_FORBIDDEN_UNIQUE = '2U', + /** Transitions with a spin change of 4 and a parity change. */ + THIRD_FORBIDDEN_UNIQUE = '3U', + /** Transitions with a spin change of 0 or 1 and a parity change. */ + FIRST_FORBIDDEN_NON_UNIQUE = '1NU', + /** Transitions with a spin change of 2 and no parity change. */ + SECOND_FORBIDDEN_NON_UNIQUE = '2NU', + /** Transitions with a spin change of 3 and a parity change. */ + THIRD_FORBIDDEN_NON_UNIQUE = '3NU' +}; + +/** + * Particles emitted from a daughter nucleus following a preceding beta decay. + */ +export enum DelayedParticle { + /** Neutrons emitted by fission products, crucial for nuclear reactor control. */ + NEUTRON = 'neutron', + /** Protons emitted from highly excited states following beta decay. */ + PROTON = 'proton', + /** Alpha particles emitted following a preceding beta transition. */ + ALPHA = 'alpha' +}; + +/** + * Reference frames for measuring nuclear electromagnetic moments. + */ +export enum MomentMeasurementRef { + /** Measurement relative to a specific nuclear energy level. */ + LEVEL = 'level', + /** Measurement within a specific experimental or environmental context. */ + CONTEXT = 'context' +}; + +/** + * Experimental techniques for determining nuclear magnetic and quadrupole moments. + */ +export enum MomentMeasurementMethod { + /** Transient Field method for measuring moments of short-lived states. */ + TF = 'TF', + /** Beta-detected Nuclear Magnetic Resonance. */ + b_NMR = 'b-NMR', + /** Beta-detected Nuclear Quadrupole Resonance. */ + b_NQR = 'b-NQR', + /** Collinear Laser Spectroscopy for ground and isomeric states. */ + CLS = 'CLS', + /** Recoil into Vacuum/Distance method. */ + RIV_D = 'RIV/D' +}; + +/** + * Kinetic energy categories for neutrons initiating nuclear reactions. + */ +export enum IncidentNeutronEnergy { + /** Neutrons in thermal equilibrium with their surroundings (approx. 0.025 eV). */ + THERMAL = 'thermal', + /** Neutrons with kinetic energies above 1 MeV, produced directly by fission. */ + FAST = 'fast', + /** Neutrons with a specific energy of 14 MeV, characteristic of D-T fusion. */ + MEV_14 = '14MeV' +}; diff --git a/enum/science/nuclide.ts b/enum/science/nuclide.ts new file mode 100644 index 00000000..1e18b361 --- /dev/null +++ b/enum/science/nuclide.ts @@ -0,0 +1,50 @@ +/** + * @file enum/science/nuclide.ts + * @description Defines enums for characterizing atomic nuclei (nuclides) and their stability. + */ + +/** + * Energy levels of a nuclide, distinguishing between the lowest energy state and excited isomers. + */ +export enum NuclideState { + /** The lowest energy state of an atomic nucleus. */ + GROUND = 'ground', + /** First long-lived excited state (nuclear isomer). */ + M1 = 'm1', + /** Second long-lived excited state. */ + M2 = 'm2', + /** Third long-lived excited state. */ + M3 = 'm3', + /** Fourth long-lived excited state. */ + M4 = 'm4' +}; + +/** + * Classification of nuclides based on their propensity for radioactive decay. + */ +export enum NuclideStability { + /** Nuclides that have not been observed to decay over the age of the universe. */ + STABLE = 'stable', + /** Radioactive nuclides that undergo spontaneous transformation into other species. */ + UNSTABLE = 'unstable' +}; + +/** + * The source or evolutionary history of a nuclide's presence in the universe. + */ +export enum NuclideOrigin { + /** Present since the formation of the Earth or earlier stellar nucleosynthesis. */ + PRIMORDIAL = 'primordial', + /** Formed through natural processes such as cosmic ray spallation or decay chains. */ + NATURAL = 'natural', + /** Created exclusively through anthropogenic nuclear reactions. */ + SYNTHETIC = 'synthetic' +}; + +/** + * Unique characteristics or classifications of specific nuclides. + */ +export enum NuclideProperty { + /** Elements consisting of only one stable nuclide occurring in nature. */ + MONONUCLIDE = 'mononuclide' +}; diff --git a/enum/science/physics.ts b/enum/science/physics.ts new file mode 100644 index 00000000..976dcb71 --- /dev/null +++ b/enum/science/physics.ts @@ -0,0 +1,112 @@ +/** + * @file enum/science/physics.ts + * @description Defines enums for physical states, magnetic properties, and optical characteristics of materials. + */ + +/** + * The primary states of matter as defined by thermodynamic conditions of temperature and pressure. + */ +export enum Phase { + /** Rigid state where atoms are closely packed in a fixed structure. */ + SOLID = 'solid', + /** Fluid state with definite volume but no fixed shape, allowing flow. */ + LIQUID = 'liquid', + /** Compressible fluid state that expands to fill the shape and volume of its container. */ + GASEOUS = 'gaseous', + /** Ionized gas consisting of free electrons and positive ions, highly conductive. */ + PLASMA = 'plasma', + /** Phase state not yet determined or characterized. */ + UNKNOWN = 'unknown' +}; + +/** + * Material behavior regarding zero electrical resistance at low temperatures. + */ +export enum Superconductivity { + /** Exhibits standard BCS-theory or high-Tc superconductivity under specific conditions. */ + NORMAL = 'normal', + /** Exhibits exotic or unconventional superconducting mechanisms. */ + SPECIAL = 'special', + /** Does not exhibit superconductivity under any known conditions. */ + NONE = 'none' +}; + +/** + * Alignment of atomic magnetic moments within a crystal lattice. + */ +export enum MagneticOrdering { + /** Adjacent magnetic moments point in opposite directions, resulting in zero net magnetization. */ + ANTIFERROMAGNETIC = 'antiferromagnetic', + /** Intrinsic property of materials to create an opposing magnetic field, causing repulsion. */ + DIAMAGNETIC = 'diamagnetic', + /** Opposing moments of unequal magnitude, resulting in a net spontaneous magnetization. */ + FERRIMAGNETIC = 'ferrimagnetic', + /** Parallel alignment of moments, resulting in strong spontaneous magnetization (e.g., Iron). */ + FERROMAGNETIC = 'ferromagnetic', + /** Moments align only in the presence of an external magnetic field, showing weak attraction. */ + PARAMAGNETIC = 'paramagnetic', + /** Small ferromagnetic particles showing paramagnetic-like behavior due to thermal fluctuations. */ + SUPERPARAMAGNETIC = 'superparamagnetic' +}; + +/** + * The quality and intensity of light reflected from the surface of a material. + */ +export enum Gloss { + /** High reflectivity characteristic of polished metal surfaces. */ + METALLIC = 'metallic', + /** Exceptional brilliance and fire, typical of high-refractive-index crystals. */ + DIAMOND = 'diamond', + /** Surface appearing oily or greasy to the touch or eye. */ + GREASY = 'greasy', + /** Smooth, highly reflective surface resembling glass. */ + GLASSY = 'glassy', + /** Iridescent, multi-layered reflection resembling mother-of-pearl. */ + PEARLY = 'pearly', + /** Parallel fibrous structure reflecting light like silk. */ + SILKY = 'silky', + /** Appearance similar to resin or amber. */ + RESINOUS = 'resinous', + /** Dull, matte surface resembling wax. */ + WAXY = 'waxy', + /** Lacking any significant gloss or reflectivity. */ + DULL = 'dull' +}; + +/** + * The interaction of light with the surface of a mineral, describing its appearance. + */ +export enum Lustre { + /** The highest level of lustre, seen in minerals with high refractive index (e.g., Diamond). */ + ADAMANTINE = 'adamantine', + /** Non-reflective, matte appearance. */ + DULL = 'dull', + /** Appearance of being covered in a thin film of oil. */ + GREASY = 'greasy', + /** Opaque and highly reflective appearance of metals. */ + METALLIC = 'metallic', + /** Soft, iridescent sheen seen in minerals with perfect cleavage. */ + PEARLY = 'pearly', + /** Medium-refractive-index lustre resembling resin. */ + RESINOUS = 'resinous', + /** Fine, parallel fibrous reflection. */ + SILKY = 'silky', + /** Intermediate between metallic and non-metallic (e.g., Hematite). */ + SUBMETALLIC = 'submetallic', + /** The most common lustre, resembling broken glass (e.g., Quartz). */ + VITREOUS = 'vitreous', + /** Soft, low-reflectivity appearance of wax or candles. */ + WAXY = 'waxy' +}; + +/** + * The ability of a material to transmit light. + */ +export enum Diaphaneity { + /** Light cannot pass through the material even in thin sections. */ + OPAQUE = 'opaque', + /** Light passes through but objects cannot be clearly seen (diffuse transmission). */ + TRANSLUCENT = 'translucent', + /** Light passes through and objects can be seen clearly (undistorted transmission). */ + TRANSPARENT = 'transparent' +}; diff --git a/enum/science/reaction.ts b/enum/science/reaction.ts new file mode 100644 index 00000000..1668f28e --- /dev/null +++ b/enum/science/reaction.ts @@ -0,0 +1,90 @@ +/** + * @file enum/science/reaction.ts + * @description Defines enums for describing chemical reactions, their states, and dynamics. + */ + +/** + * The direction and nature of a chemical transformation. + */ +export enum ReactionTransition { + /** Direct conversion of reactants to products (left to right). */ + FORWARD = 'forward', + /** Conversion of products back to original reactants (right to left). */ + REVERSE = 'reverse', + /** Dynamic state where forward and reverse reaction rates are equal. */ + EQUILIBRIUM = 'equilibrium', + /** Idealized reaction following exact molar ratios without side reactions. */ + STOICHIOMETRIC = 'stoichiometric', + /** Delocalization of electrons within a molecule, represented by multiple structures. */ + RESONANCE = 'resonance', + /** The final step in a chain reaction where reactive intermediates are consumed. */ + TERMINATE = 'terminate' +}; + +/** + * Nature of the chemical entities participating in a reaction. + */ +export enum ReactionSpecies { + /** Pure elemental substance (e.g., O2, Fe). */ + ELEMENT = 'element', + /** Defined chemical compound with fixed stoichiometry (e.g., H2O, NaCl). */ + COMPOUND = 'compound', + /** Naturally occurring inorganic solid. */ + MINERAL = 'mineral', + /** Physical blend of multiple species. */ + MIXTURE = 'mixture', + /** Indicates a self-reaction or internal rearrangement (e.g., tautomerization). */ + SELF = 'self', + /** Species defined by a generic or specific chemical formula. */ + FORMULA = 'formula' +}; + +/** + * The physical state of a reactant or product under reaction conditions. + */ +export enum ReactionState { + /** Dissolved in water as the solvent. */ + AQUEOUS = 'aq', + /** Present in a solid phase, often as a precipitate. */ + SOLID = 's', + /** Present in a pure liquid phase. */ + LIQUID = 'l', + /** Present in a gaseous phase, often as an evolved gas. */ + GASEOUS = 'g' +}; + +/** + * Observable physical phenomena occurring during a chemical reaction. + */ +export enum ReactionEffect { + /** Evolution of a gaseous product from a liquid or solid mixture. */ + GAS_FORMATION = 'gasFormation', + /** Formation of an insoluble solid phase from a solution. */ + PRECIPITATE = 'precipitate' +}; + +/** + * External factors or substances that influence reaction rate and pathway. + */ +export enum ReactionModifier { + /** Substance that increases reaction rate without being consumed. */ + CATALYST = 'catalyst', + /** Thermal energy required to initiate or sustain the reaction. */ + ENERGY_HEAT = 'heat', + /** Electromagnetic radiation (photons) used to drive photochemical reactions. */ + ENERGY_LIGHT = 'light', + /** Acidic environment acting as a promoter or reactant. */ + ACID = 'acid', + /** Basic environment acting as a promoter or reactant. */ + BASE = 'base' +}; + +/** + * Positional metadata for chemical equation documentation. + */ +export enum ReactionAnnotation { + /** Information placed above the reaction arrow (e.g., temperature). */ + ABOVE_ARROW = 'above', + /** Information placed below the reaction arrow (e.g., solvent). */ + BELOW_ARROW = 'below' +}; diff --git a/enum/science/safety.ts b/enum/science/safety.ts new file mode 100644 index 00000000..206c3a7f --- /dev/null +++ b/enum/science/safety.ts @@ -0,0 +1,303 @@ +/** + * @file enum/science/safety.ts + * @description Defines enums for chemical safety, hazard classification, and toxicity monitoring. + * Covers international standards like GHS, NFPA, ADR, and DOT. + */ + +/** + * Standard words used on safety labels to indicate the relative severity of a hazard. + */ +export enum SignalWord { + /** Indicates a high level of risk which, if not avoided, will result in death or serious injury. */ + DANGER = 'danger', + /** Indicates a medium level of risk which, if not avoided, could result in death or serious injury. */ + WARNING = 'warning' +}; + +/** + * Graphical symbols used to communicate specific information about the hazards of a chemical. + */ +export enum GHSPictogram { + /** Substances capable of rapidly releasing energy through detonation or deflagration. */ + EXPLOSIVE = 'explosive', + /** Substances that catch fire easily in contact with air or water. */ + FLAMMABLE = 'flammable', + /** Substances that can cause or contribute to the combustion of other material. */ + OXIDIZING = 'oxidizing', + /** Gases stored under pressure which may explode if heated. */ + COMPRESSED_GAS = 'compressedGas', + /** Chemicals that destroy living tissue or metal on contact. */ + CORROSIVE = 'corrosive', + /** Substances that can cause death or acute toxicity even in small quantities. */ + TOXIC = 'toxic', + /** Substances causing less severe health effects like skin irritation or respiratory sensitization. */ + HARMFUL = 'harmful', + /** Substances with long-term health effects such as carcinogenicity or mutagenicity. */ + HEALTH_HAZARD = 'healthHazard', + /** Chemicals toxic to aquatic life or with long-lasting environmental effects. */ + ENVIRONMENTAL_HAZARD = 'environmentalHazard' +}; + +/** + * Numerical ratings (0-4) used in the NFPA 704 "fire diamond" for health, flammability, and instability. + */ +export enum NFPACode { + /** Minimal hazard: poses no health, fire, or reactivity risk. */ + NONE = 0, + /** Slight hazard: may cause irritation or require only minor safety precautions. */ + SLIGHT = 1, + /** Moderate hazard: requires significant precautions or limited exposure. */ + MODERATE = 2, + /** Serious hazard: high risk requiring specialized protective equipment. */ + SERIOUS = 3, + /** Severe hazard: extreme risk of death or permanent injury. */ + SEVERE = 4 +}; + +/** + * Specific hazard notices and symbols used in the white section of the NFPA 704 diamond. + */ +export enum NFPANotice { + /** Strong oxidizer: enhances the combustion of other materials. */ + OXIDIZER = 'OX', + /** Reacts unusually or dangerously with water (e.g., Alkali metals). */ + WATER_REACTIVE = 'W', + /** Simple asphyxiant gas: displaces oxygen in the air. */ + SIMPLE_ASPHYXIANT = 'SA', + /** Corrosive substance: destroys living tissue or metals. */ + CORROSIVE = 'COR', + /** Strong acidic properties. */ + ACID = 'ACID', + /** Strong alkaline/basic properties. */ + ALKALINE = 'ALK', + /** Biological hazard: poses a threat to human health or the environment. */ + BIOHAZARDOUS = 'BIO', + /** Highly poisonous or toxic substance. */ + POISONOUS = 'POI', + /** Emits ionizing radiation. */ + RADIOACTIVE = 'RAD', + /** Extremely low-temperature materials (e.g., Liquid Nitrogen). */ + CRYOGENIC = 'CRY', + /** Pure oxygen or oxygen-enriched environment. */ + OXYGEN_GAS = 'G OX' +}; + +/** + * Globally Harmonized System (GHS) hazard classes for physical and health risks. + */ +export enum GHSClass { + /** Class 01: Explosives and unstable explosives. */ + CLASS_01 = '01', + /** Class 02: Flammable gases and aerosols. */ + CLASS_02 = '02', + /** Class 03: Oxidizing gases, liquids, and solids. */ + CLASS_03 = '03', + /** Class 04: Gases under pressure. */ + CLASS_04 = '04', + /** Class 05: Flammable liquids. */ + CLASS_05 = '05', + /** Class 06: Flammable solids and self-reactive substances. */ + CLASS_06 = '06', + /** Class 07: Pyrophoric liquids and solids. */ + CLASS_07 = '07', + /** Class 08: Self-heating substances and mixtures. */ + CLASS_08 = '08', + /** Class 09: Substances that emit flammable gases in contact with water. */ + CLASS_09 = '09' +}; + +/** + * Workplace Hazardous Materials Information System (Canada) classifications. + */ +export enum WHMISClass { + /** Compressed Gas: contents under pressure. */ + COMPRESSED_GAS = 'A', + /** Flammable and Combustible Material. */ + FLAMMABLE = 'B', + /** Oxidizing Material: increases fire risk. */ + OXIDIZING = 'C', + /** Poisonous and Infectious Material: Immediate and serious toxic effects. */ + TOXIC_ACUTE = 'D-1', + /** Poisonous and Infectious Material: Other toxic effects (long-term). */ + TOXIC_OTHER = 'D-2', + /** Biohazardous Infectious Material. */ + BIOHAZARDOUS = 'D-3', + /** Corrosive Material. */ + CORROSIVE = 'E', + /** Dangerously Reactive Material. */ + DANGEROUSLY_REACTIVE = 'F' +}; + +/** + * European Agreement concerning the International Carriage of Dangerous Goods by Road. + */ +export enum ADRClass { + /** Class 1: Explosive substances and articles. */ + CLASS_1 = '1', + /** Division 1.1: Mass explosion hazard. */ + DIV_1_1 = '1.1', + /** Division 1.2: Projection hazard but no mass explosion. */ + DIV_1_2 = '1.2', + /** Division 1.3: Fire hazard and minor blast/projection hazard. */ + DIV_1_3 = '1.3', + /** Division 1.4: No significant hazard beyond the package. */ + DIV_1_4 = '1.4', + /** Division 1.5: Very insensitive substances with mass explosion hazard. */ + DIV_1_5 = '1.5', + /** Division 1.6: Extremely insensitive articles with no mass explosion. */ + DIV_1_6 = '1.6', + /** Division 2.1: Flammable gases. */ + DIV_2_1 = '2.1', + /** Division 2.2: Non-flammable, non-toxic gases. */ + DIV_2_2 = '2.2', + /** Division 2.3: Toxic gases. */ + DIV_2_3 = '2.3', + /** Class 3: Flammable liquids. */ + CLASS_3 = '3', + /** Division 4.1: Flammable solids and self-reactive substances. */ + DIV_4_1 = '4.1', + /** Division 4.2: Substances liable to spontaneous combustion. */ + DIV_4_2 = '4.2', + /** Division 4.3: Substances emitting flammable gases in contact with water. */ + DIV_4_3 = '4.3', + /** Division 5.1: Oxidizing substances. */ + DIV_5_1 = '5.1', + /** Division 5.2: Organic peroxides. */ + DIV_5_2 = '5.2', + /** Division 6.1: Toxic substances. */ + DIV_6_1 = '6.1', + /** Division 6.2: Infectious substances. */ + DIV_6_2 = '6.2', + /** Category 7A: Radioactive materials (White I). */ + CAT_7A = '7A', + /** Category 7B: Radioactive materials (Yellow II). */ + CAT_7B = '7B', + /** Category 7C: Radioactive materials (Yellow III). */ + CAT_7C = '7C', + /** Category 7E: Fissile materials. */ + CAT_7E = '7E', + /** Class 8: Corrosive substances. */ + CLASS_8 = '8', + /** Class 9: Miscellaneous dangerous substances and articles. */ + CLASS_9 = '9', + /** Class 9A: Lithium batteries (specific classification). */ + CLASS_9A = '9A', + /** Elevated temperature substances. */ + HOT = 'HOT', + /** Environmentally hazardous substances. */ + POL = 'POL' +}; + +/** + * U.S. Department of Transportation (DOT) classifications for hazardous materials transport. + */ +export enum DOTClass { + /** Mass explosion hazard. */ + DIV_1_1 = '1.1', + /** Projection hazard. */ + DIV_1_2 = '1.2', + /** Fire hazard and minor blast/projection hazard. */ + DIV_1_3 = '1.3', + /** Minor explosion hazard. */ + DIV_1_4 = '1.4', + /** Very insensitive mass explosion hazard. */ + DIV_1_5 = '1.5', + /** Extremely insensitive articles. */ + DIV_1_6 = '1.6', + /** Flammable gas. */ + DIV_2_1 = '2.1', + /** Non-flammable gas. */ + DIV_2_2 = '2.2', + /** Poisonous gas. */ + DIV_2_3 = '2.3', + /** Flammable liquid. */ + CLASS_3 = '3', + /** Flammable solid. */ + DIV_4_1 = '4.1', + /** Spontaneously combustible material. */ + DIV_4_2 = '4.2', + /** Dangerous when wet material. */ + DIV_4_3 = '4.3', + /** Oxidizer. */ + DIV_5_1 = '5.1', + /** Organic peroxide. */ + DIV_5_2 = '5.2', + /** Poisonous (toxic) material. */ + DIV_6_1 = '6.1', + /** Infectious substance. */ + DIV_6_2 = '6.2', + /** Radioactive material. */ + CLASS_7 = '7', + /** Corrosive material. */ + CLASS_8 = '8', + /** Miscellaneous hazardous material. */ + CLASS_9 = '9' +}; + +/** + * Standard toxicity metrics used to quantify the lethal or effective dose of a chemical. + */ +export enum ToxicityType { + /** Half maximal effective concentration: dose required for 50% effect. */ + EC50 = 'EC50', + /** Median lethal concentration: concentration in air or water required to kill 50% of subjects. */ + LC50 = 'LC50', + /** Median lethal dose: amount of substance required to kill 50% of test subjects. */ + LD50 = 'LD50', + /** Median toxic dose: dose at which toxicity occurs in 50% of cases. */ + TD50 = 'TD50', + /** Lowest Observed Adverse Effect Level. */ + LOAEL = 'LOAEL', + /** Lowest Observed Effect Level. */ + LOEL = 'LOEL', + /** No Observed Adverse Effect Level. */ + NOAEL = 'NOAEL', + /** No Observed Effect Level. */ + NOEL = 'NOEL' +}; + +/** + * Routes of administration for toxicological studies. + */ +export enum ToxicityApplication { + /** Application to the skin. */ + DERMAL = 'dermal', + /** Intake through breathing. */ + INHALATION = 'inhalation', + /** Injection into the abdominal cavity. */ + INTRAPERITONEAL = 'intraperitoneal', + /** Injection directly into the bloodstream. */ + INTRAVENOUS = 'intravenous', + /** Intake through the mouth. */ + ORAL = 'oral', + /** Injection under the skin. */ + SUBCUTANEOUS = 'subcutaneous' +}; + +/** + * Metadata categories for toxicological test subjects. + */ +export enum ToxicityOrganism { + /** Standard biological species used in testing. */ + ORGANISM = 'organism', + /** Specialized or non-standard test subjects. */ + OTHER = 'other' +}; + +/** + * Standard model organisms and target species for toxicological and biological studies. + */ +export enum Organism { + /** Rattus norvegicus: standard rodent model for human metabolism. */ + RAT = 'rat', + /** Mus musculus: widely used genetic and physiological model. */ + MOUSE = 'mouse', + /** Oryctolagus cuniculus: used for skin and eye irritation tests. */ + RABBIT = 'rabbit', + /** Various aquatic species used for environmental toxicity assessment. */ + FISH = 'fish', + /** Photosynthetic organisms used for ecological impact studies. */ + ALGAE = 'algae', + /** Homo sapiens: clinical and epidemiological data. */ + HUMAN = 'human' +}; diff --git a/enum/science/substance.ts b/enum/science/substance.ts new file mode 100644 index 00000000..f69427df --- /dev/null +++ b/enum/science/substance.ts @@ -0,0 +1,38 @@ +/** + * @file enum/science/substance.ts + * @description Defines enums for general chemical substances and their cross-disciplinary properties. + */ + +/** + * Properties describing the origin, behavior, and physiological impact of chemical substances. + */ +export enum SubstanceProperty { + /** Occurring in the natural world without human intervention. */ + NATURAL = 'natural', + /** Man-made or produced via industrial chemical synthesis. */ + SYNTHETIC = 'synthetic', + /** Material with electrical conductivity between that of a conductor and an insulator. */ + SEMICONDUCTOR = 'semiconductor', + /** Spontaneously emitting ionizing radiation due to nuclear instability. */ + RADIOACTIVE = 'radioactive', + /** Poses a physical or health risk to humans or the environment. */ + HAZARDOUS = 'hazardous', + /** Capable of causing injury or death through chemical action. */ + TOXIC = 'toxic', + /** Lethal even in extremely small quantities. */ + HIGHLY_TOXIC = 'highlyToxic', + /** Easily ignited and capable of burning rapidly. */ + FLAMMABLE = 'flammable', + /** Causes visible destruction or irreversible damage to living tissue or metals. */ + CORROSIVE = 'corrosive', + /** Capable of sudden, violent energy release through chemical reaction. */ + EXPLOSIVE = 'explosive', + /** Biological agent that poses a threat to the health of living organisms. */ + BIOHAZARD = 'biohazard', + /** Substance directly involved in causing cancer. */ + CARCINOGENIC = 'carcinogenic', + /** Of or relating to biology or living organisms. */ + BIOLOGICAL = 'biological', + /** Required by organisms for normal physiological function. */ + ESSENTIAL = 'essential' +}; diff --git a/enum/system/blob.ts b/enum/system/blob.ts new file mode 100644 index 00000000..bcc4ef34 --- /dev/null +++ b/enum/system/blob.ts @@ -0,0 +1,134 @@ +/** + * @file enum/system/blob.ts + * @description Defines enums for Binary Large Objects (BLOBs) used for scientific data storage and representation. + */ + +/** + * Classification of binary data based on its scientific or structural content. + */ +export enum BlobType { + /** Visual representation of a chemical or physical entity. */ + IMAGE = 'image', + /** Three-dimensional geometric representation of a molecular or crystal structure (e.g., PDB, MOL). */ + MODEL_3D = 'model_3d', + /** Visualization of complex, structural formulas of molecules and crystals. */ + FORMULA = 'formula', + /** Analytical data representing measured electromagnetic or mass distribution. */ + SPECTRUM = 'spectrum', + /** Textual or graphical documentation such as scientific papers or safety data sheets. */ + DOCUMENT = 'document', + /** Raw numerical or structured data not covered by other categories. */ + DATA = 'data', + /** Miscellaneous binary content. */ + OTHER = 'other' +}; + +/** + * Data transformation methods used for storing or transmitting binary content as text. + */ +export enum BlobEncoding { + /** Binary-to-text encoding using a 64-character set. */ + BASE_64 = 'base64', + /** Standard variable-width character encoding for Unicode. */ + UTF_8 = 'utf8', + /** Raw, unencoded binary data. */ + BINARY = 'binary' +}; + +/** + * Technical methods for referencing or accessing stored binary content. + */ +export enum StorageType { + /** Content stored directly within the data structure. */ + RAW = 'raw', + /** Relative or absolute file system path to the content. */ + PATH = 'path', + /** Universal Resource Locator for network-accessible content. */ + URL = 'url' +}; + +/** + * Standardized media types for scientific and general-purpose binary files. + */ +export enum MimeType { + /** Portable Network Graphics: lossless raster image. */ + PNG = 'image/png', + /** Joint Photographic Experts Group: lossy raster image. */ + JPEG = 'image/jpeg', + /** Graphics Interchange Format: limited-color raster image. */ + GIF = 'image/gif', + /** Scalable Vector Graphics: XML-based vector image. */ + SVG = 'image/svg+xml', + /** Web Picture: high-efficiency image format. */ + WEBP = 'image/webp', + /** Portable Document Format: fixed-layout document representation. */ + PDF = 'application/pdf', + /** Simple unformatted text. */ + TXT = 'text/plain', + /** JavaScript Object Notation: lightweight data-interchange format. */ + JSON = 'application/json', + /** Extensible Markup Language: structured data representation. */ + XML = 'application/xml', + /** Comma-Separated Values: tabular data in plain text. */ + CSV = 'text/csv', + /** Protein Data Bank format for macromolecular structures. */ + PDB = 'chemical/x-pdb', + /** MDL Molfile: chemical table format for molecular connectivity. */ + MOL = 'chemical/x-mdl-molfile', + /** Structure-Data File: wrapper for multiple MDL Molfiles and data. */ + SDF = 'chemical/x-sdf', + /** Cartesian coordinate format for molecular geometry. */ + XYZ = 'chemical/x-xyz', + /** Crystallographic Information File: standard for structural chemistry and mineralogy. */ + CIF = 'chemical/x-cif', + /** Fallback media type for arbitrary binary data. */ + STREAM = 'application/octet-stream' +}; + +/** + * Specialized file formats for 3D molecular and crystal structure visualization. + */ +export enum Model3DType { + /** Standard for protein and macromolecular structures. */ + PDB = 'pdb', + /** Classic chemical table format for small molecules. */ + MOL = 'mol', + /** Format used for transporting structural and associated metadata. */ + SDF = 'sdf', + /** Simple representation using XYZ coordinates. */ + XYZ = 'xyz', + /** Universal standard for crystallographic data exchange. */ + CIF = 'cif' +}; + +/** + * Analytical techniques used to study the interaction of matter with electromagnetic radiation. + */ +export enum SpectrumType { + /** Light emitted when electrons transition to lower energy levels. */ + EMISSION = 'emission', + /** Light absorbed when electrons transition to higher energy levels. */ + ABSORPTION = 'absorption', + /** Probes molecular vibrations and rotations in the infrared range. */ + IR = 'ir', + /** Nuclear Magnetic Resonance: probes the magnetic environment of atomic nuclei. */ + NMR = 'nmr', + /** Probes electronic transitions in the ultraviolet and visible range. */ + UV = 'uv', + /** Probes inner-shell electronic transitions or diffraction patterns. */ + XRAY = 'xray' +}; + +/** + * Functional categories of textual documentation in a scientific context. + */ +export enum DocumentType { + /** Technical specifications or datasheets. */ + SPEC = 'spec', + /** Safety Data Sheet: information on chemical hazards and safety. */ + SDS = 'sds', + /** Scientific publication, journal article, or preprint. */ + PAPER = 'paper', + /** General or uncategorized documentation. */ + OTHER = 'other' +}; diff --git a/enum/system/condition.ts b/enum/system/condition.ts new file mode 100644 index 00000000..3b8a69d4 --- /dev/null +++ b/enum/system/condition.ts @@ -0,0 +1,52 @@ +/** + * @file enum/system/condition.ts + * @description Defines enums for standardized environmental conditions used in scientific measurements. + */ + +/** + * Logic for defining environmental parameters such as temperature and pressure. + */ +export enum ConditionType { + /** Predefined set of temperature and pressure values (e.g., STP). */ + STANDARD = 'standard', + /** Specific, custom-defined values for a particular measurement. */ + DISCRETE = 'discrete' +}; + +/** + * Internationally recognized reference sets of temperature and pressure. + */ +export enum StandardCondition { + /** IUPAC Standard Temperature and Pressure: 273.15 K and 100 kPa. */ + STP = 'STP', + /** Historical STP based on 1 atm (101.325 kPa). */ + STP_ATM = 'STP_ATM', + /** Normal Temperature and Pressure: typically 293.15 K and 101.325 kPa. */ + NTP = 'NTP', + /** International Standard Atmosphere: 288.15 K and 101.325 kPa. */ + ISA = 'ISA', + /** American Association of Physicists in Medicine reference conditions. */ + AAPM = 'AAPM', + /** Standard Ambient Temperature and Pressure: 298.15 K and 100 kPa. */ + SATP = 'SATP', + /** Compressed Air and Gas Institute reference conditions. */ + CAGI = 'CAGI', + /** Standard Personnel Environment conditions. */ + SPE = 'SPE', + /** ISO 5011: Intake air conditioning for internal combustion engines. */ + ISO_5011 = 'ISO_5011', + /** GOST 2939-63: Russian standard for gas measurement (20°C, 101.325 kPa). */ + GOST_2939_63 = 'GOST_2939_63', + /** Electricity and Gas Inspection Act (Canada) reference. */ + EGIA = 'EGIA', + /** Standard Cubic Foot reference conditions. */ + SCF = 'SCF', + /** Air Movement and Control Association reference conditions. */ + AMCA = 'AMCA', + /** Federal Aviation Administration reference conditions. */ + FAA = 'FAA', + /** ISO 13443: Natural gas standard reference conditions. */ + ISO_13443 = 'ISO_13443', + /** DIN 1343: German standard for reference conditions (0°C, 101.325 kPa). */ + DIN_1343 = 'DIN_1343' +}; diff --git a/enum/system/domain.ts b/enum/system/domain.ts new file mode 100644 index 00000000..d630eef6 --- /dev/null +++ b/enum/system/domain.ts @@ -0,0 +1,36 @@ +/** + * @file enum/system/domain.ts + * @description Defines enums for the primary architectural domains and registries of the database. + */ + +/** + * Core scientific entities that represent the primary focus of the database. + */ +export enum DomainType { + /** Chemical elements as defined by their atomic number. */ + ELEMENT = 'element', + /** Specific isotopes or nuclear isomers of chemical elements. */ + NUCLIDE = 'nuclide', + /** Substances composed of multiple atoms in fixed stoichiometric ratios. */ + COMPOUND = 'compound', + /** Naturally occurring inorganic solids with defined crystal structures. */ + MINERAL = 'mineral', + /** Physical blends of multiple chemical species. */ + MIXTURE = 'mixture' +}; + +/** + * Supporting system-level registries used to manage metadata and shared resources. + */ +export enum RegistryType { + /** Storage for binary assets such as images and structural files. */ + BLOB = 'blob', + /** Scientific or administrative bodies and institutions. */ + ORGANIZATION = 'organization', + /** Individual contributors, researchers, or scientists. */ + PERSON = 'person', + /** Bibliographic data and scientific citations. */ + REFERENCE = 'reference', + /** Definitions and conversions for physical quantities and units. */ + UNIT = 'unit' +}; diff --git a/enum/system/form.ts b/enum/system/form.ts new file mode 100644 index 00000000..8afe7b11 --- /dev/null +++ b/enum/system/form.ts @@ -0,0 +1,20 @@ +/** + * @file enum/system/form.ts + * @description Defines enums for structural and physical variations of chemical species. + */ + +/** + * Categories of physical or structural manifestations of a chemical substance. + */ +export enum FormType { + /** Elemental variations in the same physical state (e.g., Graphite vs. Diamond). */ + ALLOTROPE = 'allotrope', + /** Specific molecular arrangement or aggregation state. */ + MOLECULAR = 'molecular', + /** Manifestation in a particular state of matter (Solid, Liquid, Gas). */ + PHASE = 'phase', + /** Crystalline variations of the same chemical compound (e.g., Calcite vs. Aragonite). */ + POLYMORPH = 'polymorph', + /** Structural form not covered by other categories. */ + OTHER = 'other' +}; diff --git a/enum/system/locale.ts b/enum/system/locale.ts new file mode 100644 index 00000000..55513854 --- /dev/null +++ b/enum/system/locale.ts @@ -0,0 +1,84 @@ +/** + * @file enum/system/locale.ts + * @description Defines enums for internationalization, including language, country, and currency codes. + */ + +/** + * ISO 639-1 two-letter language codes for internationalization. + */ +export enum LangCode { + ARABIC = 'ar', BENGALI = 'bn', BULGARIAN = 'bg', CHINESE = 'zh', CROATIAN = 'hr', CZECH = 'cs', + DANISH = 'da', DUTCH = 'nl', ENGLISH = 'en', ESTONIAN = 'et', FINNISH = 'fi', FRENCH = 'fr', + GERMAN = 'de', GREEK = 'el', HEBREW = 'he', HINDI = 'hi', HUNGARIAN = 'hu', INDONESIAN = 'id', + IRISH = 'ga', ITALIAN = 'it', JAPANESE = 'ja', KOREAN = 'ko', LATIN = 'la', LATVIAN = 'lv', + LITHUANIAN = 'lt', MALAY = 'ms', NORWEGIAN = 'no', PERSIAN = 'fa', POLISH = 'pl', PORTUGUESE = 'pt', + ROMANIAN = 'ro', RUSSIAN = 'ru', SLOVAK = 'sk', SLOVENIAN = 'sl', SPANISH = 'es', SWEDISH = 'sv', + THAI = 'th', TURKISH = 'tr', UKRAINIAN = 'uk', VIETNAMESE = 'vi' +}; + +/** + * ISO 3166-1 alpha-2 two-letter country codes for geographic classification. + */ +export enum CountryCode { + AFGHANISTAN = 'AF', ALAND_ISLANDS = 'AX', ALBANIA = 'AL', ALGERIA = 'DZ', AMERICAN_SAMOA = 'AS', + ANDORRA = 'AD', ANGOLA = 'AO', ANGUILLA = 'AI', ANTARCTICA = 'AQ', ANTIGUA_AND_BARBUDA = 'AG', + ARGENTINA = 'AR', ARMENIA = 'AM', ARUBA = 'AW', AUSTRALIA = 'AU', AUSTRIA = 'AT', AZERBAIJAN = 'AZ', + BAHAMAS = 'BS', BAHRAIN = 'BH', BANGLADESH = 'BD', BARBADOS = 'BB', BELARUS = 'BY', BELGIUM = 'BE', + BELIZE = 'BZ', BENIN = 'BJ', BERMUDA = 'BM', BHUTAN = 'BT', BOLIVIA = 'BO', BONAIRE = 'BQ', + BOSNIA_AND_HERZEGOVINA = 'BA', BOTSWANA = 'BW', BOUVET_ISLAND = 'BV', BRAZIL = 'BR', + BRITISH_INDIAN_OCEAN_TERRITORY = 'IO', BRUNEI_DARUSSALAM = 'BN', BULGARIA = 'BG', BURKINA_FASO = 'BF', + BURUNDI = 'BI', CABO_VERDE = 'CV', CAMBODIA = 'KH', CAMEROON = 'CM', CANADA = 'CA', + CAYMAN_ISLANDS = 'KY', CENTRAL_AFRICAN_REPUBLIC = 'CF', CHAD = 'TD', CHILE = 'CL', CHINA = 'CN', + CHRISTMAS_ISLAND = 'CX', COCOS_KEELING_ISLANDS = 'CC', COLOMBIA = 'CO', COMOROS = 'KM', CONGO = 'CG', + CONGO_DEMOCRATIC_REPUBLIC = 'CD', COOK_ISLANDS = 'CK', COSTA_RICA = 'CR', COTE_DIVOIRE = 'CI', + CROATIA = 'HR', CUBA = 'CU', CURACAO = 'CW', CYPRUS = 'CY', CZECH_REPUBLIC = 'CZ', DENMARK = 'DK', + DJIBOUTI = 'DJ', DOMINICA = 'DM', DOMINICAN_REPUBLIC = 'DO', ECUADOR = 'EC', EGYPT = 'EG', + EL_SALVADOR = 'SV', EQUATORIAL_GUINEA = 'GQ', ERITREA = 'ER', ESTONIA = 'EE', ESWATINI = 'SZ', + ETHIOPIA = 'ET', FALKLAND_ISLANDS = 'FK', FAROE_ISLANDS = 'FO', FIJI = 'FJ', FINLAND = 'FI', + FRANCE = 'FR', FRENCH_GUIANA = 'GF', FRENCH_POLYNESIA = 'PF', FRENCH_SOUTHERN_TERRITORIES = 'TF', + GABON = 'GA', GAMBIA = 'GM', GEORGIA = 'GE', GERMANY = 'DE', GHANA = 'GH', GIBRALTAR = 'GI', + GREECE = 'GR', GREENLAND = 'GL', GRENADA = 'GD', GUADELOUPE = 'GP', GUAM = 'GU', GUATEMALA = 'GT', + GUERNSEY = 'GG', GUINEA = 'GN', GUINEA_BISSAU = 'GW', GUYANA = 'GY', HAITI = 'HT', + HEARD_ISLAND_MCDONALD_ISLANDS = 'HM', VATICAN_CITY = 'VA', HONDURAS = 'HN', HONG_KONG = 'HK', + HUNGARY = 'HU', ICELAND = 'IS', INDIA = 'IN', INDONESIA = 'ID', IRAN = 'IR', IRAQ = 'IQ', + IRELAND = 'IE', ISLE_OF_MAN = 'IM', ISRAEL = 'IL', ITALY = 'IT', JAMAICA = 'JM', JAPAN = 'JP', + JERSEY = 'JE', JORDAN = 'JO', KAZAKHSTAN = 'KZ', KENYA = 'KE', KIRIBATI = 'KI', NORTH_KOREA = 'KP', + SOUTH_KOREA = 'KR', KUWAIT = 'KW', KYRGYZSTAN = 'KG', LAOS = 'LA', LATVIA = 'LV', LEBANON = 'LB', + LESOTHO = 'LS', LIBERIA = 'LR', LIBYA = 'LY', LIECHTENSTEIN = 'LI', LITHUANIA = 'LT', + LUXEMBOURG = 'LU', MACAO = 'MO', MADAGASCAR = 'MG', MALAWI = 'MW', MALAYSIA = 'MY', MALDIVES = 'MV', + MALI = 'ML', MALTA = 'MT', MARSHALL_ISLANDS = 'MH', MARTINIQUE = 'MQ', MAURITANIA = 'MR', + MAURITIUS = 'MU', MAYOTTE = 'YT', MEXICO = 'MX', MICRONESIA = 'FM', MOLDOVA = 'MD', MONACO = 'MC', + MONGOLIA = 'MN', MONTENEGRO = 'ME', MONTSERRAT = 'MS', MOROCCO = 'MA', MOZAMBIQUE = 'MZ', + MYANMAR = 'MM', NAMIBIA = 'NA', NAURU = 'NR', NEPAL = 'NP', NETHERLANDS = 'NL', NEW_CALEDONIA = 'NC', + NEW_ZEALAND = 'NZ', NICARAGUA = 'NI', NIGER = 'NE', NIGERIA = 'NG', NIUE = 'NU', NORFOLK_ISLAND = 'NF', + NORTH_MACEDONIA = 'MK', NORTHERN_MARIANA_ISLANDS = 'MP', NORWAY = 'NO', OMAN = 'OM', PAKISTAN = 'PK', + PALAU = 'PW', PALESTINE = 'PS', PANAMA = 'PA', PAPUA_NEW_GUINEA = 'PG', PARAGUAY = 'PY', + PERU = 'PE', PHILIPPINES = 'PH', PITCAIRN = 'PN', POLAND = 'PL', PORTUGAL = 'PT', PUERTO_RICO = 'PR', + QATAR = 'QA', REUNION = 'RE', ROMANIA = 'RO', RUSSIAN_FEDERATION = 'RU', RWANDA = 'RW', + SAINT_BARTHELEMY = 'BL', SAINT_HELENA = 'SH', SAINT_KITTS_AND_NEVIS = 'KN', SAINT_LUCIA = 'LC', + SAINT_MARTIN = 'MF', SAINT_PIERRE_AND_MIQUELON = 'PM', SAINT_VINCENT_AND_THE_GRENADINES = 'VC', + SAMOA = 'WS', SAN_MARINO = 'SM', SAO_TOME_AND_PRINCIPE = 'ST', SAUDI_ARABIA = 'SA', SENEGAL = 'SN', + SERBIA = 'RS', SEYCHELLES = 'SC', SIERRA_LEONE = 'SL', SINGAPORE = 'SG', SINT_MAARTEN = 'SX', + SLOVAKIA = 'SK', SLOVENIA = 'SI', SOLOMON_ISLANDS = 'SB', SOMALIA = 'SO', SOUTH_AFRICA = 'ZA', + SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS = 'GS', SOUTH_SUDAN = 'SS', SPAIN = 'ES', + SRI_LANKA = 'LK', SUDAN = 'SD', SURINAME = 'SR', SVALBARD_AND_JAN_MAYEN = 'SJ', SWEDEN = 'SE', + SWITZERLAND = 'CH', SYRIA = 'SY', TAIWAN = 'TW', TAJIKISTAN = 'TJ', TANZANIA = 'TZ', + THAILAND = 'TH', TIMOR_LESTE = 'TL', TOGO = 'TG', TOKELAU = 'TK', TONGA = 'TO', + TRINIDAD_AND_TOBAGO = 'TT', TUNISIA = 'TN', TURKEY = 'TR', TURKMENISTAN = 'TM', + TURKS_AND_CAICOS_ISLANDS = 'TC', TUVALU = 'TV', UGANDA = 'UG', UKRAINE = 'UA', + UNITED_ARAB_EMIRATES = 'AE', UNITED_KINGDOM = 'GB', UNITED_STATES = 'US', + UNITED_STATES_MINOR_OUTLYING_ISLANDS = 'UM', URUGUAY = 'UY', UZBEKISTAN = 'UZ', VANUATU = 'VU', + VENEZUELA = 'VE', VIET_NAM = 'VN', BRITISH_VIRGIN_ISLANDS = 'VG', VIRGIN_ISLANDS = 'VI', + WALLIS_AND_FUTUNA = 'WF', WESTERN_SAHARA = 'EH', YEMEN = 'YE', ZAMBIA = 'ZM', ZIMBABWE = 'ZW' +}; + +/** + * ISO 4217 three-letter currency codes for economic and financial data. + */ +export enum Currency { + USD = 'USD', EUR = 'EUR', JPY = 'JPY', GBP = 'GBP', AUD = 'AUD', CAD = 'CAD', CHF = 'CHF', + CNY = 'CNY', SEK = 'SEK', NZD = 'NZD', MXN = 'MXN', SGD = 'SGD', HKD = 'HKD', NOK = 'NOK', + KRW = 'KRW', TRY = 'TRY', RUB = 'RUB', INR = 'INR', BRL = 'BRL', ZAR = 'ZAR', DKK = 'DKK', + PLN = 'PLN', TWD = 'TWD', THB = 'THB', MYR = 'MYR', IDR = 'IDR', CZK = 'CZK', HUF = 'HUF', + ILS = 'ILS', CLP = 'CLP', PHP = 'PHP', AED = 'AED', COP = 'COP', SAR = 'SAR', RON = 'RON' +}; diff --git a/enum/system/organization.ts b/enum/system/organization.ts new file mode 100644 index 00000000..8b8b2563 --- /dev/null +++ b/enum/system/organization.ts @@ -0,0 +1,18 @@ +/** + * @file enum/system/organization.ts + * @description Defines enums for classifying scientific, academic, and industrial organizations. + */ + +/** + * Categories of institutions and bodies involved in scientific research and administration. + */ +export enum OrganizationType { + /** Academic institution providing higher education and research facilities. */ + UNIVERSITY = 'university', + /** Specialized research body often focused on specific scientific disciplines. */ + INSTITUTE = 'institute', + /** Commercial entity involved in chemical production, instrumentation, or research. */ + COMPANY = 'company', + /** Dedicated facility for experimental testing and analysis. */ + LABORATORY = 'laboratory' +}; diff --git a/enum/system/person.ts b/enum/system/person.ts new file mode 100644 index 00000000..901f338f --- /dev/null +++ b/enum/system/person.ts @@ -0,0 +1,16 @@ +/** + * @file enum/system/person.ts + * @description Defines enums for personal metadata related to contributors and researchers. + */ + +/** + * Standard gender classification for demographic and administrative metadata. + */ +export enum Gender { + /** Identifies as male. */ + MALE = 'male', + /** Identifies as female. */ + FEMALE = 'female', + /** Identifies as non-binary or outside the traditional gender binary. */ + NON_BINARY = 'nonBinary' +}; diff --git a/enum/system/reference.ts b/enum/system/reference.ts new file mode 100644 index 00000000..3f1f7f80 --- /dev/null +++ b/enum/system/reference.ts @@ -0,0 +1,40 @@ +/** + * @file enum/system/reference.ts + * @description Defines enums for scientific reference types based on standard BibTeX classifications. + */ + +/** + * Categories of published and unpublished scientific works used for citations. + */ +export enum ReferenceType { + /** An article from a journal or magazine. */ + ARTICLE = 'article', + /** A book with an explicit publisher. */ + BOOK = 'book', + /** A bound work without a formal publisher or sponsoring institution. */ + BOOKLET = 'booklet', + /** A paper presented at a scientific conference or workshop. */ + CONFERENCE = 'conference', + /** A part of a book, such as a chapter or a range of pages. */ + INBOOK = 'inbook', + /** A part of a book having its own title, usually in a collection. */ + INCOLLECTION = 'incollection', + /** An article in a conference proceedings. */ + INPROCEEDINGS = 'inproceedings', + /** Technical documentation or a user guide. */ + MANUAL = 'manual', + /** A Master's thesis. */ + MASTERSTHESIS = 'mastersthesis', + /** A general academic thesis (fallback category). */ + THESIS = 'thesis', + /** Miscellaneous reference type for works that do not fit elsewhere. */ + MISC = 'misc', + /** A Ph.D. thesis or dissertation. */ + PHDTHESIS = 'phdthesis', + /** The full proceedings of a conference. */ + PROCEEDINGS = 'proceedings', + /** A report published by a school or other institution, usually numbered. */ + TECHREPORT = 'techreport', + /** A document that has not been formally published. */ + UNPUBLISHED = 'unpublished' +}; diff --git a/enum/system/uncertainty.ts b/enum/system/uncertainty.ts new file mode 100644 index 00000000..21b24522 --- /dev/null +++ b/enum/system/uncertainty.ts @@ -0,0 +1,38 @@ +/** + * @file enum/system/uncertainty.ts + * @description Defines enums for representing scientific and statistical uncertainty in measurements. + */ + +/** + * The mathematical nature of the uncertainty value. + */ +export enum UncertaintyType { + /** Expressed in the same units as the measured value. */ + ABSOLUTE = 'absolute', + /** Expressed as a ratio or percentage of the measured value. */ + RELATIVE = 'relative' +}; + +/** + * The geometric or statistical distribution of the uncertainty. + */ +export enum UncertaintyShape { + /** Equal variance in both positive and negative directions (±x). */ + SYMMETRICAL = 'symmetrical', + /** Different variances for positive and negative deviations (+x/-y). */ + ASYMMETRICAL = 'asymmetrical', + /** A defined range [min, max] where the value is expected to lie. */ + INTERVAL = 'interval', + /** The distribution shape is not specified. */ + UNKNOWN = 'unknown' +}; + +/** + * Methods for specifying the statistical reliability of a measurement. + */ +export enum ConfidenceType { + /** Percentage indicating the probability that the true value lies within the range. */ + LEVEL = 'level', + /** Multiples of the standard deviation (σ) in a normal distribution. */ + SIGMA = 'sigma' +}; diff --git a/enum/system/unit.ts b/enum/system/unit.ts new file mode 100644 index 00000000..f1938424 --- /dev/null +++ b/enum/system/unit.ts @@ -0,0 +1,18 @@ +/** + * @file enum/system/unit.ts + * @description Defines enums for standardized measurement systems and units. + */ + +/** + * Broad categories of unit systems used to quantify physical properties. + */ +export enum MeasurementSystem { + /** The International System of Units (SI) and associated metric variations. */ + METRIC = 'metric', + /** Historical system of units used primarily in the UK. */ + IMPERIAL = 'imperial', + /** United States customary units. */ + US = 'us', + /** Natural units based on universal physical constants. */ + PLANCK = 'planck' +}; diff --git a/enum/system/value.ts b/enum/system/value.ts new file mode 100644 index 00000000..de2f483d --- /dev/null +++ b/enum/system/value.ts @@ -0,0 +1,38 @@ +/** + * @file enum/system/value.ts + * @description Defines enums for the structural nature and scientific origin of data values. + */ + +/** + * The architectural data structure used to represent a value. + */ +export enum ValueType { + /** A single, basic data type (number, string, boolean). */ + PRIMITIVE = 'primitive', + /** A complex object containing multiple related properties. */ + STRUCT = 'struct', + /** A single quantified value with an optional unit. */ + SINGLE = 'single', + /** A collection of multiple values of the same type. */ + ARRAY = 'array', + /** A continuous interval between a minimum and maximum value. */ + RANGE = 'range', + /** Values that are grouped together (e.g. triple point). */ + COUPLED = 'coupled' +}; + +/** + * The scientific or methodology-based source of a data value. + */ +export enum ValueOrigin { + /** Obtained through direct physical measurement or observation. */ + MEASURED = 'measured', + /** Derived from other data using mathematical formulas. */ + CALCULATED = 'calculated', + /** Approximated based on expert knowledge or incomplete data. */ + ESTIMATED = 'estimated', + /** Resulting from controlled laboratory conditions. */ + EXPERIMENTAL = 'experimental', + /** Predicted by physical models or fundamental principles. */ + THEORETICAL = 'theoretical' +}; diff --git a/enum/util.ts b/enum/util.ts deleted file mode 100644 index 00e06ad7..00000000 --- a/enum/util.ts +++ /dev/null @@ -1,231 +0,0 @@ -/** - * @file util.ts - * @description Defines technical enums for data structuring, metadata, and scientific standards. - * This module includes value types, confidence levels, standard conditions, and units of measurement. - */ - -/** - * Categorization of high-level scientific entities managed within the database. - * These types are used for internal routing, validation, and metadata enrichment. - */ -export enum EntityType { - /** Individual chemical elements of the periodic table. */ - ELEMENT = 'element', - /** Specific isotopes and nuclear isomers including decay data. */ - NUCLIDE = 'nuclide', - /** Multi-element substances with fixed or variable stoichiometry. */ - COMPOUND = 'compound', - /** Naturally occurring solid substances with defined crystal structures. */ - MINERAL = 'mineral', - /** Physical combinations of multiple substances without chemical bonding. */ - MIXTURE = 'mixture' -}; - -/** - * Technical representation models for data values within the schema. - */ -export enum ValueType { - /** A single, primitive data point (e.g., number or string). */ - PRIMITIVE = 'primitive', - /** A complex object containing nested fields and sub-properties. */ - STRUCT = 'struct', - /** A discrete individual measurement or value. */ - SINGLE = 'single', - /** A collection of values of the same type. */ - ARRAY = 'array', - /** A continuous interval between two numeric bounds. */ - RANGE = 'range', - /** Coupled values for entries based on multiple physical properties. */ - COUPLED = 'coupled' -}; - -/** - * Degree of scientific reliability and origin of a specific data point. - */ -export enum ValueConfidence { - /** Obtained through direct physical observation or instrumentation. */ - MEASURED = 'measured', - /** Derived from established formulas or numerical simulations. */ - CALCULATED = 'calculated', - /** Approximated through heuristic models or incomplete data. */ - ESTIMATED = 'estimated', - /** Validated through specific, controlled scientific experiments. */ - EXPERIMENTAL = 'experimental', - /** Based on theoretical physics or chemical principles without empirical validation. */ - THEORETICAL = 'theoretical' -}; - -/** - * Structural classification for a variant of a substance; see allotropes. - */ -export enum FormType { - /** Elemental variants in the same physical state (e.g., Diamond vs Graphite). */ - ALLOTROPE = 'allotrope', - /** Based on the connectivity or arrangement of atoms in a molecule. */ - MOLECULAR = 'molecular', - /** Corresponding to a specific state of matter (Solid, Liquid, Gas). */ - PHASE = 'phase', - /** Solid crystalline forms of the same compound (e.g., Quartz vs Cristobalite). */ - POLYMORPH = 'polymorph', - /** Non-crystalline solid lacking long-range atomic order. */ - AMORPHOUS = 'amorphous', - /** Categorized into a non-standard or miscellaneous structural type. */ - OTHER = 'other' -}; - -/** - * Systems of units used to represent physical quantities. - */ -export enum MetricSystem { - /** The International System of Units (SI) or its variants. */ - METRIC = 'metric', - /** Historical system used primarily in the UK. */ - IMPERIAL = 'imperial', - /** Customary system used in the United States. */ - US = 'us', - /** Non-standard or application-specific unit set. */ - CUSTOM = 'custom', - /** System of measurement is not specified or recognized. */ - UNKNOWN = 'unknown' -}; - -/** - * Standard conditions for temperature and pressure in scientific measurements. - */ -export enum StandardCondition { - /** T=0°C (273.15K); P=100kPa (1 bar). IUPAC standard since 1982. */ - STP = 'STP', - /** T=0°C; P=101.325kPa (1 atm). Older NIST and ISO standard. */ - STP_ATM = 'STP_ATM', - /** T=20°C; P=101.325kPa. EPA and NIST standard conditions. */ - NTP = 'NTP', - /** T=15°C; P=101.325kPa. International Standard Atmosphere. */ - ISA = 'ISA', - /** T=22°C; P=101.325kPa. Medical physics standard (AAPM). */ - AAPM = 'AAPM', - /** T=25°C; P=101.325kPa. Standard Ambient Temperature and Pressure. */ - SATP = 'SATP', - /** T=20°C; P=100kPa. Compressed Air and Gas Institute standard. */ - CAGI = 'CAGI', - /** T=15°C; P=100kPa. Society of Petroleum Engineers standard. */ - SPE = 'SPE', - /** T=20°C; P=101.3kPa. ISO internal combustion engine standard. */ - ISO_5011 = 'ISO_5011', - /** T=20°C; P=101.33kPa. Former Soviet Union GOST standard. */ - GOST_2939_63 = 'GOST_2939_63', - /** T=15.56°C (60°F); P=101.6kPa. Energy-related industrial standard. */ - EGIA = 'EGIA', - /** T=15.56°C; P=101.35kPa. U.S. Department of Transportation standard. */ - SCF = 'SCF', - /** T=21.11°C (70°F); P=101.3kPa. Air Movement and Control Association. */ - AMCA = 'AMCA', - /** T=15°C; P=101.3kPa. Federal Aviation Administration standard. */ - FAA = 'FAA', - /** T=15°C; P=101.325kPa. Standard reference for natural gas (ISO). */ - ISO_13443 = 'ISO_13443', - /** T=0°C; P=101.325kPa. Industrial standard from DIN 1343. */ - DIN_1343 = 'DIN_1343' -}; - -/** - * Types of statistical or measurement errors associated with data points. - */ -export enum UncertaintyType { - /** Expressed in the same units as the measurement itself. */ - ABSOLUTE = 'absolute', - /** Expressed as a ratio or percentage of the measured value. */ - RELATIVE = 'relative', - /** Upper and lower bounds are not equidistant from the mean value. */ - ASYMMETRICAL = 'asymmetrical' -}; - -/** - * High-level categorization of binary large objects. - */ -export enum BlobType { - /** Visual assets such as photographs, diagrams, or spectra. */ - IMAGE = 'image', - /** Three-dimensional structural models (e.g., molecule, crystal). */ - MODEL_3D = '3d', - /** Specialized scientific data formats or raw logs. */ - DATA = 'data' -}; - -/** - * Classification of bibliographic references and data sources based on BibTeX. - */ -export enum ReferenceType { - /** Peer-reviewed paper in a scientific journal. */ - ARTICLE = 'article', - /** Complete published work on a specific subject. */ - BOOK = 'book', - /** Small, unbound publication or pamphlet. */ - BOOKLET = 'booklet', - /** Paper presented at a professional meeting or symposium. */ - CONFERENCE = 'conference', - /** Specific section or chapter within a book. */ - INBOOK = 'inbook', - /** Article within a collection edited by others. */ - INCOLLECTION = 'incollection', - /** Full transcript or record of a conference. */ - INPROCEEDINGS = 'inproceedings', - /** Technical documentation or user guide. */ - MANUAL = 'manual', - /** Academic work for a Master's degree. */ - MASTERSTHESIS = 'mastersthesis', - /** General classification for academic dissertations. */ - THESIS = 'thesis', - /** Fallback for sources that do not fit standard categories. */ - MISC = 'misc', - /** Academic work for a Doctor of Philosophy degree. */ - PHDTHESIS = 'phdthesis', - /** Published minutes or records of a scientific meeting. */ - PROCEEDINGS = 'proceedings', - /** Formal report on research or technical developments. */ - TECHREPORT = 'techreport', - /** Document that has not yet been formally published. */ - UNPUBLISHED = 'unpublished' -}; - -/** - * Standard digital image encodings supported for visual assets. - */ -export enum ImageFormat { - /** Compressed photographic format with lossy encoding. */ - JPG = 'jpg', - /** Lossless raster format with transparency support. */ - PNG = 'png', - /** Vector format based on XML for resolution-independent graphics. */ - SVG = 'svg', - /** Modern high-performance container for lossy and lossless images. */ - WEBP = 'webp' -}; - -/** - * Chemical and spatial file formats for 3D molecular structures. - */ -export enum D3Format { - /** Protein Data Bank format for three-dimensional structures. */ - PDB = 'pdb', - /** MDL Molfile format for chemical bonding and structure. */ - MOL = 'mol', - /** Structure-Data File for handling chemical data sets. */ - SDF = 'sdf', - /** Simple Cartesian coordinates for atomic positions. */ - XYZ = 'xyz', - /** Crystallographic Information File for crystal structures. */ - CIF = 'cif' -}; - -/** - * Two-letter ISO 639-1 language identifiers for scientific nomenclature. - */ -export enum LangCode { - ARABIC = 'ar', BENGALI = 'bn', BULGARIAN = 'bg', CHINESE = 'zh', CROATIAN = 'hr', CZECH = 'cs', - DANISH = 'da', DUTCH = 'nl', ENGLISH = 'en', ESTONIAN = 'et', FINNISH = 'fi', FRENCH = 'fr', - GERMAN = 'de', GREEK = 'el', HEBREW = 'he', HINDI = 'hi', HUNGARIAN = 'hu', INDONESIAN = 'id', - IRISH = 'ga', ITALIAN = 'it', JAPANESE = 'ja', KOREAN = 'ko', LATIN = 'la', LATVIAN = 'lv', - LITHUANIAN = 'lt', MALAY = 'ms', NORWEGIAN = 'no', PERSIAN = 'fa', POLISH = 'pl', PORTUGUESE = 'pt', - ROMANIAN = 'ro', RUSSIAN = 'ru', SLOVAK = 'sk', SLOVENIAN = 'sl', SPANISH = 'es', SWEDISH = 'sv', - THAI = 'th', TURKISH = 'tr', UKRAINIAN = 'uk', VIETNAMESE = 'vi' -}; diff --git a/model/base/condition.ts b/model/base/condition.ts new file mode 100644 index 00000000..32cb9ee4 --- /dev/null +++ b/model/base/condition.ts @@ -0,0 +1,37 @@ +/** + * @file model/base/condition.ts + * @description Models the environmental parameters (temperature, pressure, etc.) under + * which a scientific measurement was conducted. + */ + +import type { ConditionType, StandardCondition } from '../../enum/system/condition'; +import type { PhysicalQuantity } from '../registry/unit'; +import type { NumberValue } from './value'; + +/** + * A collection of specific physical quantities serving as measurement conditions. + * + * @template Q The physical quantity being defined. + */ +type Discrete< Q extends PhysicalQuantity = PhysicalQuantity > = { + [ K in Q ]?: NumberValue< K >; +}; + +/** + * Classification of measurement environments into predefined standards or custom discrete parameters. + * + * @template Q The physical quantity of the associated property. + */ +export type Condition< Q extends PhysicalQuantity = PhysicalQuantity > = { + /** Discriminator for standardized reference conditions. */ + type: ConditionType.STANDARD, + /** The specific international standard applied (e.g., STP, SATP). */ + base: StandardCondition, + /** Optional overrides or additional parameters for the standard condition. */ + properties?: Discrete< Q > +} | { + /** Discriminator for specifically defined measurement conditions. */ + type: ConditionType.DISCRETE, + /** A set of custom physical parameters (e.g., a specific temperature). */ + properties: Discrete< Q > +}; diff --git a/model/base/factory.ts b/model/base/factory.ts new file mode 100644 index 00000000..df9336b4 --- /dev/null +++ b/model/base/factory.ts @@ -0,0 +1,25 @@ +/** + * @file model/base/factory.ts + * @description Helper types for generating type-safe database entities across different domains and registries. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { DomainType, RegistryType } from '../../enum/system/domain'; +import type { Collection } from './modifier'; +import type { Struct } from './primitive'; + +/** + * Structural template for creating database entries, ensuring domain-specific branding and data integrity. + * + * @template T The scientific domain or system registry of the entity. + * @template C The collection structure defining the entity's data. + * @template K The unique identifiers and metadata associated with the entity. + */ +export type Factory< + T extends DomainType | RegistryType, + C extends Collection< unknown >, + K extends Struct< string | number > +> = Expand< Brand< K & { + /** Scientific or administrative data of the entity. */ + data: C +}, T, 'type', true > >; diff --git a/model/base/form.ts b/model/base/form.ts new file mode 100644 index 00000000..6149a7e0 --- /dev/null +++ b/model/base/form.ts @@ -0,0 +1,86 @@ +/** + * @file model/base/form.ts + * @description Models structural, allotropic, and phase variations of chemical species, + * allowing for property overrides. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { Phase } from '../../enum/science/physics'; +import type { FormType } from '../../enum/system/form'; +import type { Condition } from './condition'; +import type { Collection, DeepOptional } from './modifier'; + +/** + * Structural framework for a specific manifestation of a chemical entity, + * supporting property overrides. + * + * @template T The architectural type of the form. + * @template C The collection structure being overridden. + */ +type BaseForm< T extends FormType, C extends Collection< unknown > > = Brand< { + /** Property overrides specific to this structural form. */ + overrides: DeepOptional< C >; + /** Environmental conditions associated with this manifestation. */ + conditions?: Condition; + /** Additional qualitative notes regarding the structural form. */ + notes?: string; +}, T, 'type', true >; + +/** + * Representation of an elemental variation (e.g., Graphite vs. Diamond). + * + * @template C The collection structure being overridden. + */ +export type AllotropeForm< C extends Collection< unknown > > = Expand< BaseForm< FormType.ALLOTROPE, C > >; + +/** + * Representation of a specific molecular arrangement or aggregate. + * + * @template C The collection structure being overridden. + */ +export type MolecularForm< C extends Collection< unknown > > = Expand< BaseForm< FormType.MOLECULAR, C > & { + /** The chemical formula specific to this molecular manifestation. */ + formula: string; +} >; + +/** + * Representation of a substance in a specific state of matter (Solid, Liquid, Gas). + * + * @template C The collection structure being overridden. + */ +export type PhaseForm< C extends Collection< unknown > > = Expand< BaseForm< FormType.PHASE, C > & { + /** The thermodynamic phase of the substance. */ + phase: Phase; +} >; + +/** + * Representation of a compound in a specific crystal structure (e.g., Rutile vs. Anatase). + * + * @template C The collection structure being overridden. + */ +export type PolymorphForm< C extends Collection< unknown > > = Expand< BaseForm< FormType.POLYMORPH, C > >; + +/** + * Miscellaneous structural manifestations not covered by standard categories. + * + * @template C The collection structure being overridden. + */ +export type OtherForm< C extends Collection< unknown > > = Expand< BaseForm< FormType.OTHER, C > >; + +/** Unique identifier for a specific structural form. */ +export type FormId = Brand< string, 'formId' >; + +/** + * A collection of diverse structural manifestations indexed by their unique identifiers. + * + * @template C The collection structure of the underlying entities. + */ +export type FormCollection< C extends Collection< unknown > > = { + [ K in FormId ]: Collection< + | AllotropeForm< C > + | MolecularForm< C > + | PhaseForm< C > + | PolymorphForm< C > + | OtherForm< C > + >; +}; diff --git a/model/base/modifier.ts b/model/base/modifier.ts new file mode 100644 index 00000000..2ce21c69 --- /dev/null +++ b/model/base/modifier.ts @@ -0,0 +1,85 @@ +/** + * @file model/base/modifier.ts + * @description Utility types for modifying and grouping scientific properties within + * collections and registry definitions. + */ + +import type { Expand } from 'devtypes/types/util'; +import type { PropertyWrapper } from './property'; + +/** + * Marker for values that should be treated as unique entities rather than simple properties. + * + * @template T The data type of the distinct entity. + */ +export type Distinct< T = unknown > = T; + +/** + * Flexible representation of either a single property instance or an array of instances. + * + * @template T The property type. + */ +export type OneOrMany< T extends PropertyWrapper > = T | T[]; + +/** + * Explicit single instance of a property. + * + * @template T The property type. + */ +export type One< T extends PropertyWrapper > = T; + +/** + * Explicit collection of property instances. + * + * @template T The property type. + */ +export type Many< T extends PropertyWrapper > = T[]; + +/** + * Logical grouping of related properties and distinct data entities. + * + * @template T The structure of the grouping. + */ +export type Group< T extends Record< string, OneOrMany< PropertyWrapper > | Distinct< unknown > > > = T; + +/** + * Keyed collection of data grouped by a specific string literal (e.g., by element symbol). + * + * @template L The string literal type for the keys. + * @template T The data type of the mapped values. + */ +export type Mapping< L extends string, T = unknown > = Group< { [ K in L ]?: T } >; + +/** + * Recursive resolver for property types within a collection structure. + * + * @template T The raw data type to resolve. + */ +type CollectionValue< T > = + [ T ] extends [ OneOrMany< infer P > ] ? P | P[] : + [ T ] extends [ Group< infer G > ] ? { [ GK in keyof G ]: Collection< G[ GK ] > } : + [ T ] extends [ PropertyWrapper ] ? Expand< T > : + [ T ] extends [ Distinct< infer D > ] ? Distinct< D > : + [ T ] extends [ object ] ? Expand< T > : + T; + +/** + * A structured set of properties and data entities forming a functional data unit. + * + * @template T The template structure for the collection. + */ +export type Collection< T > = { + [ K in keyof T ]: CollectionValue< T[ K ] >; +}; + +/** + * Recursive utility to make all fields of a collection structure optional for overrides + * but keep property types as is. + * + * @template T The structure to make optional. + */ +export type DeepOptional< T > = + T extends PropertyWrapper ? T : + T extends ( infer U )[] ? DeepOptional< U >[] : + T extends object ? { [ K in keyof T ]?: DeepOptional< T[ K ] > } : + T; diff --git a/model/base/primitive.ts b/model/base/primitive.ts new file mode 100644 index 00000000..c00bdc4a --- /dev/null +++ b/model/base/primitive.ts @@ -0,0 +1,36 @@ +/** + * @file model/base/primitive.ts + * @description Fundamental utility types and constants used throughout the database schema + * for data structure and localization. + */ + +import type { Expand } from 'devtypes/types/util'; +import type { LangCode } from '../../enum/system/locale'; + +/** The authoritative GitHub repository for the scientific database. */ +export type RepoBase = 'https://github.com/pseinfo/database'; + +/** Standardized ISO 8601 UTC timestamp format for data versioning and event logging. */ +export type IsoDate = `${ number }:${ number }:${ number }T${ number }:${ number }:${ number }Z`; + +/** Type-safe representation of HTTP/HTTPS URLs for external resources and citations. */ +export type UrlString = `https://${ string }` | `http://${ string }`; + +/** + * A flexible key-value record used for defining structured chemical or physical properties. + * + * @template T The data type of the record values. + * @template K The type of keys used in the record. + */ +export type Struct< T = unknown, K extends PropertyKey = string > = Record< K, T >; + +/** + * Grouping of localized strings, requiring English as the primary scientific language. + * + * @template T The data type of the localized content. + * @template L The primary language code for required content. + */ +export type LangGroup< T = string, L extends LangCode = LangCode.ENGLISH > = Expand< + Required< { [ K in L ]: T } > & + Partial< { [ K in Exclude< LangCode, L > ]: T } > +>; diff --git a/model/base/property.ts b/model/base/property.ts new file mode 100644 index 00000000..b1b6500e --- /dev/null +++ b/model/base/property.ts @@ -0,0 +1,169 @@ +/** + * @file model/base/property.ts + * @description Extends scientific values with experimental conditions, reaction contexts, + * and literature references. + */ + +import type { Primitive } from 'devtypes/types/primitive'; +import type { Expand } from 'devtypes/types/util'; +import type { ReactionRef } from '../collection/reaction'; +import type { RefId } from '../registry/reference'; +import type { NoUnit, PhysicalQuantity } from '../registry/unit'; +import type { Condition } from './condition'; +import type { Struct } from './primitive'; +import type * as v from './value'; + +/** + * Shared structural framework for properties, integrating environmental conditions + * and bibliographic metadata. + * + * @template C The physical quantity of the environmental conditions. + * @template T Additional structural fields for the property. + */ +type BaseProperty< C extends PhysicalQuantity, T extends Struct = {} > = { + /** Environmental parameters (temperature, pressure, etc.) during measurement. */ + conditions?: Condition< C >; + /** References to chemical reactions associated with this property. */ + reactions?: ReactionRef[]; + /** Citations of scientific literature supporting this data. */ + references?: RefId[]; +} & T; + +/** + * A qualitative property associated with specific experimental conditions. + * + * @template P The type of the primitive value. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type PrimitiveProperty< + P extends Primitive = Primitive, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.PrimitiveValue< P > +>; + +/** + * A complex structured property associated with specific experimental conditions. + * + * @template S The structure of the scientific data. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type StructProperty< + S extends Struct = Struct, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.StructValue< S > +>; + +/** + * A sequence of quantitative measurements sharing common experimental conditions. + * + * @template Q The physical quantity of the measurements. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type ArrayProperty< + Q extends PhysicalQuantity | NoUnit, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.ArrayValue< Q > +>; + +/** + * A quantitative measurement span associated with specific experimental conditions. + * + * @template Q The physical quantity of the range boundaries. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type RangeProperty< + Q extends PhysicalQuantity | NoUnit, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.RangeValue< Q > +>; + +/** + * A group of related numerical measurements (e.g., critical point data) sharing the same conditions. + * + * @template Q The physical quantities included in the coupled set. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type CoupledNumberProperty< + Q extends PhysicalQuantity | NoUnit, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.CoupledNumberValue< Q > +>; + +/** + * A general grouping of related properties of any data type sharing common conditions. + * + * @template Q The physical quantities of numerical properties. + * @template P The type of primitive properties. + * @template S The type of structured properties. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type CoupledProperty< + Q extends PhysicalQuantity | NoUnit, + P extends Primitive = Primitive, + S extends Struct = Struct, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.CoupledValue< Q, P, S > +>; + +/** + * Union of all quantitative property representations. + * + * @template Q The physical quantity of the measurements. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type NumberProperty< + Q extends PhysicalQuantity | NoUnit, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.NumberValue< Q > +>; + +/** + * Comprehensive union of all scientific property models supported in the database. + * + * @template Q The physical quantity of numerical properties. + * @template P The type of primitive properties. + * @template S The type of structured properties. + * @template T Additional structural fields for the property. + * @template C The physical quantity of the environmental conditions. + */ +export type Property< + Q extends PhysicalQuantity | NoUnit, + P extends Primitive = Primitive, + S extends Struct = Struct, + T extends Struct = {}, + C extends PhysicalQuantity = PhysicalQuantity +> = Expand< + BaseProperty< C, T > & + v.Value< Q, P, S > +>; + +/** Utility type for handling both quantified and non-quantified properties. */ +export type PropertyWrapper = Property< PhysicalQuantity > | Property< NoUnit >; diff --git a/model/base/uncertainty.ts b/model/base/uncertainty.ts new file mode 100644 index 00000000..f51fdcd6 --- /dev/null +++ b/model/base/uncertainty.ts @@ -0,0 +1,51 @@ +/** + * @file model/base/uncertainty.ts + * @description Represents the statistical reliability and error margins of experimental + * or calculated data. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { ConfidenceType, UncertaintyShape, UncertaintyType } from '../../enum/system/uncertainty'; + +/** + * Structural framework for defining measurement errors, including distribution shapes + * and confidence intervals. + * + * @template T The type of uncertainty (absolute or relative). + */ +type BaseUncertainty< T extends UncertaintyType > = Expand< Brand< { + /** The geometric or statistical distribution of the error margin. */ + shape: + /** Equal variance in both positive and negative directions (±x). */ + | { type: UncertaintyShape.SYMMETRICAL, value: number } + /** Different variances for positive and negative deviations (+x/-y). */ + | { type: UncertaintyShape.ASYMMETRICAL, plus: number, minus: number } + /** A defined range [min, max] where the value is expected to lie. */ + | { type: UncertaintyShape.INTERVAL, min: number, max: number } + /** The distribution shape is not formally specified. */ + | { type: UncertaintyShape.UNKNOWN }; + /** The statistical reliability or coverage factor of the measurement. */ + confidence?: + /** Percentage indicating the probability that the true value lies within the range. */ + | { type: ConfidenceType.LEVEL, value: number } + /** Multiples of the standard deviation (σ) in a normal distribution. */ + | { type: ConfidenceType.SIGMA, value: number }; + /** Technical metadata regarding the error estimation. */ + meta?: { + /** The origin for the uncertainty value. */ + source?: string; + /** The mathematical or experimental method used to determine the uncertainty. */ + method?: string; + }; + /** Additional qualitative notes regarding the error margin. */ + notes?: string; +}, T, 'type', true > >; + +/** Error margin expressed in the same physical unit as the measured value. */ +export type AbsoluteUncertainty = BaseUncertainty< UncertaintyType.ABSOLUTE >; + +/** Error margin expressed as a fraction or percentage of the measured value. */ +export type RelativeUncertainty = BaseUncertainty< UncertaintyType.RELATIVE >; + +/** Universal type encompassing both absolute and relative error models. */ +export type Uncertainty = AbsoluteUncertainty | RelativeUncertainty; diff --git a/model/base/value.ts b/model/base/value.ts new file mode 100644 index 00000000..601b3a27 --- /dev/null +++ b/model/base/value.ts @@ -0,0 +1,177 @@ +/** + * @file model/base/value.ts + * @description Defines the core data structures for scientific values, supporting units, + * uncertainty, and diverse origin types. + */ + +import type { RequireAtLeastOne } from 'devtypes/types/constraint'; +import type { Primitive } from 'devtypes/types/primitive'; +import type { Brand, Expand } from 'devtypes/types/util'; +import type { ValueOrigin, ValueType } from '../../enum/system/value'; +import type { NoUnit, PhysicalQuantity, UnitId } from '../registry/unit'; +import type { Struct } from './primitive'; +import type { Uncertainty } from './uncertainty'; + +/** + * Conditional field for attaching a physical unit to a measurement. + * Only applicable to quantified values. + * + * @template Q The physical quantity of the unit. + */ +type UnitField< Q extends PhysicalQuantity | NoUnit > = [ Q ] extends [ NoUnit ] ? {} : { + /** The specific unit used for the measurement (e.g., 'K' for temperature). */ + unit: UnitId< Q >; +}; + +/** + * Conditional field for attaching statistical error margins to applicable value types. + * Only applicable to quantified values. + * + * @template T The type of the associated value. + */ +type UncertaintyField< T extends ValueType > = T extends ValueType.SINGLE | ValueType.RANGE | ValueType.ARRAY ? { + /** Statistical reliability and error margins of the data. */ + uncertainty?: Uncertainty; +} : {}; + +/** + * Shared metadata for all value types, tracking scientific origin and descriptive context. + * + * @template T The architectural type of the value. + */ +type BaseValue< T extends ValueType > = Brand< { + /** The scientific or methodology-based source of the data value. */ + origin?: ValueOrigin; + /** Descriptive context regarding the measurement environment or methodology. */ + context?: string; + /** Additional qualitative notes regarding the data value. */ + notes?: string; +} & UncertaintyField< T >, T, 'type', true >; + +/** Quantitative interval for representing measurement spans. */ +type Range = RequireAtLeastOne< Record< 'lower' | 'upper', { + /** The numerical boundary of the range. */ + value: number; + /** Indicates if the boundary value itself is excluded from the interval. */ + exclusive?: boolean; +} > >; + +/** + * Basic non-numerical data like names, symbols, or qualitative descriptors. + * + * @template P The type of the primitive value. + */ +export type PrimitiveValue< P extends Primitive = Primitive > = Expand< + BaseValue< ValueType.PRIMITIVE > & ( { value: P } | { values: P[] } ) +>; + +/** + * Complex structured data for multi-dimensional scientific properties. + * + * @template S The structure of the scientific data. + */ +export type StructValue< S extends Struct = Struct > = Expand< + BaseValue< ValueType.STRUCT > & { struct: S } +>; + +/** + * A single quantitative measurement associated with a physical unit. + * + * @template Q The physical quantity of the measurement. + */ +export type SingleValue< Q extends PhysicalQuantity | NoUnit = PhysicalQuantity > = Expand< + BaseValue< ValueType.SINGLE > & { value: number } & UnitField< Q > +>; + +/** + * A sequence of quantitative measurements sharing the same physical unit. + * + * @template Q The physical quantity of the measurements. + */ +export type ArrayValue< Q extends PhysicalQuantity | NoUnit = PhysicalQuantity > = Expand< + BaseValue< ValueType.ARRAY > & { values: number[] } & UnitField< Q > +>; + +/** + * A quantitative interval representing a spread of measurements. + * + * @template Q The physical quantity of the range boundaries. + */ +export type RangeValue< Q extends PhysicalQuantity | NoUnit = PhysicalQuantity > = Expand< + BaseValue< ValueType.RANGE > & { + /** The lower and upper boundaries of the measurement span. */ + range: Range, + /** An optional representative single value for the range (e.g., mean). */ + value?: number + } & UnitField< Q > +>; + +/** + * Group of related numerical properties (e.g., thermodynamic coordinates of a state point). + * + * @template Q The physical quantities included in the coupled set. + */ +export type CoupledNumberValue< Q extends PhysicalQuantity | NoUnit = PhysicalQuantity > = Expand< + BaseValue< ValueType.COUPLED > & { + /** Collection of physical properties measured or calculated as a single set. */ + properties: RequireAtLeastOne< { + [ K in Q ]?: + | SingleValue< K > + | ArrayValue< K > + | RangeValue< K >; + } >; + } +>; + +/** + * General grouping of related properties of any data type. + * + * @template Q The physical quantities of numerical properties. + * @template P The type of primitive properties. + * @template S The type of structured properties. + */ +export type CoupledValue< + Q extends PhysicalQuantity | NoUnit = PhysicalQuantity, + P extends Primitive = Primitive, + S extends Struct = Struct +> = Expand< + BaseValue< ValueType.COUPLED > & { + /** Collection of properties grouped together for scientific context. */ + properties: RequireAtLeastOne< { + [ K in Q ]?: + | PrimitiveValue< P > + | StructValue< S > + | SingleValue< K > + | ArrayValue< K > + | RangeValue< K >; + } >; + } +>; + +/** + * Union of all numerical measurement representations. + * + * @template Q The physical quantity of the measurements. + */ +export type NumberValue< Q extends PhysicalQuantity | NoUnit = PhysicalQuantity > = + | SingleValue< Q > + | ArrayValue< Q > + | RangeValue< Q > + | CoupledNumberValue< Q >; + +/** + * Comprehensive union of all data types supported in the database. + * + * @template Q The physical quantity of numerical properties. + * @template P The type of primitive properties. + * @template S The type of structured properties. + */ +export type Value< + Q extends PhysicalQuantity | NoUnit = PhysicalQuantity, + P extends Primitive = Primitive, + S extends Struct = Struct +> = + | NumberValue< Q > + | PrimitiveValue< P > + | StructValue< S > + | CoupledValue< Q, P, S >; diff --git a/model/collection/abundance.ts b/model/collection/abundance.ts new file mode 100644 index 00000000..cc6c8b9a --- /dev/null +++ b/model/collection/abundance.ts @@ -0,0 +1,17 @@ +/** + * @file model/collection/abundance.ts + * @description Models the distribution and prevalence of chemical elements and isotopes + * across different cosmic and terrestrial spheres. + */ + +import type { AbundanceType, NaturalOccurrence } from '../../enum/science/abundance'; +import type { Collection, Mapping, One, OneOrMany } from '../base/modifier'; +import type { NumberProperty, PrimitiveProperty } from '../base/property'; + +/** Collection of properties describing the natural occurrence and quantitative abundance of a species. */ +export type AbundanceCollection = Collection< { + /** Qualitative classification of the species' presence in nature (e.g., Primordial, Synthetic). */ + naturalOccurrence?: One< PrimitiveProperty< NaturalOccurrence > >; + /** Quantitative measurements of mass fractions across different environments (e.g., Universe, Earth's Crust). */ + abundances?: Mapping< AbundanceType, OneOrMany< NumberProperty< 'massFraction' > > >; +} >; diff --git a/model/collection/atomic.ts b/model/collection/atomic.ts new file mode 100644 index 00000000..a8f547e2 --- /dev/null +++ b/model/collection/atomic.ts @@ -0,0 +1,125 @@ +/** + * @file model/collection/atomic.ts + * @description Models the fundamental properties of an atom, including its nuclear structure, + * electronic configuration, and resulting physical attributes. + */ + +import type { ElementSymbol, PaulingSpin, ShellModel, Subshell } from '../../enum/science/element'; +import type { Collection, Group, One, OneOrMany } from '../base/modifier'; +import type { ArrayProperty, NumberProperty, PrimitiveProperty, StructProperty } from '../base/property'; +import type { NoUnit } from '../registry/unit'; + +/** Structural model for the arrangement of electrons in shells and subshells. */ +export type ElectronConfig = { + /** Optional noble gas core used for abbreviated notation. */ + baseElement?: ElementSymbol; + /** List of specific electron placements in the quantum shell model. */ + terms: Array< { + /** The principal quantum shell (e.g., K, L, M). */ + shell: ShellModel; + /** The azimuthal quantum subshell (s, p, d, f). */ + subshell: Subshell; + /** The number of electrons occupying this subshell. */ + value: number; + } >; +}; + +/** Representation of an orbital box in the Pauling notation. */ +type Box = PaulingSpin | null; + +/** Visualization of electron spins using the Pauling box model. */ +export type PaulingNotation = { + /** Optional noble gas core used for abbreviated notation. */ + baseElement?: ElementSymbol; + /** Mapping of shells to their subshell spin states. */ + shells: { + [ K in ShellModel ]?: { + /** Spin states for the s-orbital. */ + s: [ Box ]; + /** Spin states for the three p-orbitals. */ + p: [ Box, Box, Box ]; + /** Spin states for the five d-orbitals. */ + d: [ Box, Box, Box, Box, Box ]; + /** Spin states for the seven f-orbitals. */ + f: [ Box, Box, Box, Box, Box, Box, Box ]; + }; + }; +}; + +/** Comprehensive collection of properties defining an atom's identity and fundamental behavior. */ +export type AtomicCollection = Collection< { + /** The number of protons in the atomic nucleus. */ + atomicNumber?: One< PrimitiveProperty< number > >; + /** The total number of nucleons (protons and neutrons) in the nucleus. */ + massNumber?: One< PrimitiveProperty< number > >; + /** The net positive charge experienced by an electron in a multi-electron atom. */ + effectiveNuclearCharge?: OneOrMany< PrimitiveProperty< number > >; + + /** Grouping of properties related to the electronic structure. */ + electrons?: Group< { + /** The number of electrons in the outermost shell involved in bonding. */ + valenceElectrons?: One< PrimitiveProperty< number > >; + /** Total number of electrons per principal quantum shell. */ + shellModel?: One< StructProperty< { [ K in ShellModel ]?: number } > >; + /** Detailed quantum mechanical arrangement of electrons. */ + electronConfig?: OneOrMany< StructProperty< ElectronConfig > >; + /** Spin-based representation of electron arrangement. */ + paulingNotation?: OneOrMany< StructProperty< PaulingNotation > >; + } >; + + /** Fundamental energy levels associated with the atom. */ + energy?: Group< { + /** Energies required to remove electrons sequentially from the atom. */ + ionizationEnergies?: One< ArrayProperty< 'energy' > >; + /** The difference between the actual atomic mass and the mass number in energy units. */ + massExcess?: OneOrMany< NumberProperty< 'energy' > >; + } >; + + /** Quantitative mass properties of the atom. */ + mass?: Group< { + /** The actual mass of a single atom. */ + atomicMass?: OneOrMany< NumberProperty< 'mass' > >; + /** The weighted average of atomic masses of naturally occurring isotopes. */ + standardAtomicWeight?: OneOrMany< NumberProperty< NoUnit > >; + /** The ratio of the average mass per atom to the atomic mass constant. */ + relativeAtomicMass?: OneOrMany< NumberProperty< NoUnit > >; + } >; + + /** Physical dimensions of the atom across different measurement models. */ + radius?: Group< { + /** Experimentally determined atomic radius. */ + empirical?: OneOrMany< NumberProperty< 'length' > >; + /** Theoretically derived atomic radius based on wave functions. */ + calculated?: OneOrMany< NumberProperty< 'length' > >; + /** Half the distance between two identical atoms in a covalent bond. */ + covalent?: OneOrMany< NumberProperty< 'length' > >; + /** Half the distance between the nuclei of two non-bonded, adjacent atoms. */ + vdw?: OneOrMany< NumberProperty< 'length' > >; + } >; + + /** The tendency of an atom to attract a shared pair of electrons, according to various scientific scales. */ + electronegativity?: Group< { + /** Allen electronegativity scale based on average electron energy. */ + allen?: OneOrMany< NumberProperty< NoUnit > >; + /** Allred-Rochow scale based on electrostatic force. */ + allredRochow?: OneOrMany< NumberProperty< NoUnit > >; + /** Ghosh-Gupta scale based on the valence-shell potential. */ + ghoshGupta?: OneOrMany< NumberProperty< 'energy' > >; + /** Gordy electronegativity scale. */ + gordy?: OneOrMany< NumberProperty< NoUnit > >; + /** Martynov-Batsanov scale based on ionization potential. */ + martynov?: OneOrMany< NumberProperty< NoUnit > >; + /** Mulliken scale based on the average of ionization energy and electron affinity. */ + mulliken?: OneOrMany< NumberProperty< NoUnit > >; + /** Nagle electronegativity scale based on atomic polarizability. */ + nagle?: OneOrMany< NumberProperty< NoUnit > >; + /** Pauling scale, the most common measure of electronegativity. */ + pauling?: OneOrMany< NumberProperty< NoUnit > >; + /** Pearson absolute electronegativity. */ + pearson?: OneOrMany< NumberProperty< 'energy' > >; + /** Rahm electronegativity scale based on atomic volume. */ + rahm?: OneOrMany< NumberProperty< 'energy' > >; + /** Sanderson scale based on electron density. */ + sanderson?: OneOrMany< NumberProperty< NoUnit > >; + } >; +} >; diff --git a/model/collection/chemistry.ts b/model/collection/chemistry.ts new file mode 100644 index 00000000..d0dce334 --- /dev/null +++ b/model/collection/chemistry.ts @@ -0,0 +1,294 @@ +/** + * @file model/collection/chemistry.ts + * @description Core chemical and thermodynamic properties, including acid-base behavior, + * redox states, and crystallographic parameters. + */ + +import type { + AcidBaseCharacter, BasicityType, BondType, BronstedCharacter, CleavageQuality, + CleavageType, CrystalFamily, CrystalHabit, CrystalSystem, FractureType, Goldschmidt, + HSAB, Hybridization, LewisModel, MolecularShape, OxideCharacter, SolubilityQualifier, + Tenacity, TwinningMode, TwinningType +} from '../../enum/science/chemistry'; +import type { ElementSymbol } from '../../enum/science/element'; +import type { DomainType } from '../../enum/system/domain'; +import type { Collection, Group, Many, OneOrMany } from '../base/modifier'; +import type { NumberProperty, PrimitiveProperty, StructProperty } from '../base/property'; +import type { NumberValue } from '../base/value'; +import type { CompoundId } from '../domain/compound'; +import type { MixtureId } from '../domain/mixture'; +import type { NoUnit } from '../registry/unit'; + +/** Structural model for the concentration of a substance in a solvent at equilibrium. */ +export type Solubility = { + /** The substance in which the solute is dissolved. */ + solvent: + | { type: DomainType.COMPOUND, id: CompoundId } + | { type: DomainType.MIXTURE, id: MixtureId } + | string; + /** Quantitative concentration (e.g., mol/L) of the solute. */ + value?: NumberValue< 'concentration' >; + /** The solubility product constant for ionic compounds. */ + ksp?: NumberValue< NoUnit >; + /** Qualitative description of the degree of solubility. */ + qualifier?: SolubilityQualifier; +}; + +/** Grouping of fundamental chemical characteristics and structural data. */ +export type ChemistryCollection = Collection< { + /** Mass of one mole of the substance. */ + molarMass?: OneOrMany< NumberProperty< 'molarMass' > >; + /** Volume occupied by one mole of the substance. */ + molarVolume?: OneOrMany< NumberProperty< 'molarVolume' > >; + /** Mass of a single molecule or formula unit. */ + molecularMass?: OneOrMany< NumberProperty< 'mass' > >; + /** Ratio of the average mass per molecule to the atomic mass constant. */ + relativeMolecularMass?: OneOrMany< NumberProperty< NoUnit > >; + + /** Thermodynamic state functions and bonding energies. */ + thermochemistry?: Group< { + /** Properties defining the thermodynamic state. */ + state?: Group< { + /** Measure of the system's thermal energy per unit temperature that is unavailable for work. */ + entropy?: OneOrMany< NumberProperty< 'entropy' > >; + /** Molar entropy of the substance at standard conditions. */ + standardMolarEntropy?: OneOrMany< NumberProperty< 'entropy' > >; + /** Total heat content of the system. */ + enthalpy?: OneOrMany< NumberProperty< 'energy' > >; + /** The maximum reversible work that may be performed by the system at constant temperature and pressure. */ + gibbsEnergy?: OneOrMany< NumberProperty< 'energy' > >; + } >; + /** Energies associated with the formation of the substance. */ + formation?: Group< { + /** Heat change during the formation of one mole of the substance. */ + enthalpy?: OneOrMany< NumberProperty< 'energy' > >; + /** Change in Gibbs free energy during formation. */ + gibbsEnergy?: OneOrMany< NumberProperty< 'energy' > >; + } >; + /** Energies associated with chemical bonds. */ + bonding?: Group< { + /** Total energy of chemical bonding. */ + energy?: OneOrMany< NumberProperty< 'energy' > >; + /** Energy required to break a specific chemical bond. */ + dissociationEnergy?: OneOrMany< NumberProperty< 'energy' > >; + } >; + } >; + + /** Properties related to the relationship between electrical potential and chemical change. */ + electrochemistry?: Group< { + /** Quantitative measures of electrode potential. */ + potentials?: Group< { + /** Potential of an electrode under standard conditions. */ + standardPotential?: OneOrMany< NumberProperty< 'electricPotential' > >; + /** Tendency of a species to be reduced. */ + reductionPotential?: OneOrMany< NumberProperty< 'electricPotential' > >; + /** Tendency of a species to be oxidized. */ + oxidationPotential?: OneOrMany< NumberProperty< 'electricPotential' > >; + /** The difference between the theoretically determined and actual reduction potential. */ + overpotential?: OneOrMany< NumberProperty< 'electricPotential' > >; + } >; + /** Parameters governing mass transfer in electrochemical reactions. */ + transfer?: Group< { + /** Mass of a substance altered at an electrode by one coulomb of electricity. */ + electrochemicalEquivalent?: OneOrMany< NumberProperty< 'mass' > >; + } >; + } >; + + /** Quantitative and qualitative properties of acidity and basicity. */ + acidBase?: Group< { + /** The nature of the substance's basicity. */ + basicityType?: OneOrMany< PrimitiveProperty< BasicityType > >; + /** General classification as an acid or base. */ + character?: OneOrMany< PrimitiveProperty< AcidBaseCharacter > >; + /** Quantitative constants defining acid-base strength. */ + constants?: Group< { + /** Negative base-10 logarithm of the acid dissociation constant. */ + pKa?: OneOrMany< NumberProperty< NoUnit > >; + /** Negative base-10 logarithm of the base dissociation constant. */ + pKb?: OneOrMany< NumberProperty< NoUnit > >; + /** Measure of the acidity or basicity of an aqueous solution. */ + pH?: OneOrMany< NumberProperty< NoUnit > >; + /** The pH at which a molecule carries no net electrical charge. */ + isoelectricPoint?: OneOrMany< NumberProperty< NoUnit > >; + } >; + /** Characterization according to standard acid-base models. */ + models?: Group< { + /** Classification according to the Brønsted-Lowry proton transfer model. */ + bronstedCharacter?: OneOrMany< PrimitiveProperty< BronstedCharacter > >; + /** Acidity according to the Lewis electron-pair model. */ + lewisAcidity?: OneOrMany< PrimitiveProperty< LewisModel > >; + /** Basicity according to the Lewis electron-pair model. */ + lewisBasicity?: OneOrMany< PrimitiveProperty< LewisModel > >; + } >; + /** Advanced classifications like HSAB or Goldschmidt. */ + concepts?: Group< { + /** Classification according to the Goldschmidt geochemical model. */ + goldschmidt?: OneOrMany< PrimitiveProperty< Goldschmidt > >; + /** Hard and Soft Acids and Bases (Pearson) classification. */ + hsab?: OneOrMany< PrimitiveProperty< HSAB > >; + } >; + } >; + + /** Properties related to reduction-oxidation reactions. */ + redox?: Group< { + /** Acid-base character of the entity's oxides. */ + oxideCharacter?: OneOrMany< PrimitiveProperty< OxideCharacter > >; + /** List of documented oxidation states of the entity. */ + oxidationStates?: Many< StructProperty< { + /** The numerical oxidation state. */ + value: number; + /** Indicates the most common or stable oxidation state. */ + main?: boolean; + /** Indicates states that are rare or difficult to stabilize. */ + unstable?: boolean; + } > >; + } >; + + /** Parameters governing the distribution and dissolution of the substance. */ + solubility?: Group< { + /** Relationship between the partial pressure of a gas and its concentration in a liquid. */ + henryConstant?: OneOrMany< NumberProperty< NoUnit > >; + /** Ratio of concentrations of a solute between two immiscible phases. */ + partitionCoefficient?: OneOrMany< NumberProperty< NoUnit > >; + /** Detailed solubility measurements in various solvents. */ + solubilities?: Many< StructProperty< Solubility > >; + } >; + + /** geometric and topological properties of molecules and bonds. */ + structural?: Group< { + /** Spatial arrangement of atoms. */ + geometry?: Group< { + /** Geometric arrangement of atoms in a molecule. */ + molecularShape?: OneOrMany< PrimitiveProperty< MolecularShape > >; + /** Type of atomic orbital hybridization (e.g., sp3). */ + hybridization?: OneOrMany< PrimitiveProperty< Hybridization > >; + } >; + /** Connectivity and coordination properties. */ + topology?: Group< { + /** Total number of atoms and lone pairs surrounding a central atom. */ + stericNumber?: OneOrMany< PrimitiveProperty< number > >; + /** Number of atoms directly bonded to a central atom. */ + coordinationNumber?: OneOrMany< PrimitiveProperty< number > >; + /** Number of non-bonding electron pairs in the valence shell. */ + lonePairs?: OneOrMany< PrimitiveProperty< number > >; + } >; + /** Detailed parameters of chemical bonding. */ + bonding?: Group< { + /** The nature of the chemical bond (e.g., Covalent, Metallic). */ + bondType?: OneOrMany< PrimitiveProperty< BondType > >; + /** Numerical measure of the degree of electronic bonding between atoms. */ + bondOrder?: OneOrMany< PrimitiveProperty< number > >; + /** Angle between two adjacent chemical bonds. */ + bondAngle?: OneOrMany< NumberProperty< 'angle' > >; + /** Angle between two planes defined by four atoms (dihedral angle). */ + torsionalAngle?: OneOrMany< NumberProperty< 'angle' > >; + /** Average distance between the nuclei of two bonded atoms. */ + bondLength?: OneOrMany< NumberProperty< 'length' > >; + } >; + /** Electronic distribution within the structure. */ + electronic?: Group< { + /** Theoretical charge of an atom assuming equal shared electron distribution. */ + formalCharge?: OneOrMany< PrimitiveProperty< number > >; + } >; + } >; + + /** Detailed symmetric, lattice, and mechanical properties of crystalline solids. */ + crystallography?: Group< { + /** Symmetry-based classification of the crystal structure. */ + symmetry?: Group< { + /** Broadest classification of crystal symmetry. */ + crystalFamily?: OneOrMany< PrimitiveProperty< CrystalFamily > >; + /** Symmetry classification based on lattice parameters. */ + crystalSystem?: OneOrMany< PrimitiveProperty< CrystalSystem > >; + /** Alphanumeric shorthand for describing crystal structures. */ + pearsonSymbol?: OneOrMany< PrimitiveProperty< string > >; + /** Geometric symmetry of the crystal's physical form. */ + pointGroup?: OneOrMany< StructProperty< { + /** International number of the point group. */ + number: number; + /** Short name of the group. */ + name: string; + /** Hermann-Mauguin (International) notation. */ + hermannMauguin?: string; + /** Schoenflies notation. */ + schoenflies?: string; + } > >; + /** Centrosymmetric point group representing the lattice symmetry. */ + laueGroup?: OneOrMany< PrimitiveProperty< string > >; + /** Full symmetry of the crystal structure including translations. */ + spaceGroup?: OneOrMany< StructProperty< { + /** International number of the space group. */ + number: number; + /** Standard symbol of the space group. */ + symbol: string; + } > >; + } >; + /** Mathematical framework of the crystal structure. */ + lattice?: Group< { + /** Parameters defining the geometry of the unit cell. */ + unitCell?: OneOrMany< StructProperty< { + /** Length of the 'a' axis. */ + a?: NumberValue< 'length' >; + /** Length of the 'b' axis. */ + b?: NumberValue< 'length' >; + /** Length of the 'c' axis. */ + c?: NumberValue< 'length' >; + /** Angle between 'b' and 'c' axes. */ + alpha?: NumberValue< 'angle' >; + /** Angle between 'a' and 'c' axes. */ + beta?: NumberValue< 'angle' >; + /** Angle between 'a' and 'b' axes. */ + gamma?: NumberValue< 'angle' >; + /** Number of formula units per unit cell. */ + Z?: number; + } > >; + } >; + /** Arrangements of atoms surrounding a central site. */ + coordination?: Group< { + /** Number and identity of atoms surrounding a central atom. */ + ligancy?: OneOrMany< StructProperty< { + [ K in ElementSymbol ]?: number; + } > >; + } >; + /** External physical appearance of the crystal. */ + morphology?: Group< { + /** Characteristic external shape of individual crystals. */ + crystalHabit?: OneOrMany< PrimitiveProperty< CrystalHabit > >; + } >; + /** Structural imperfections within the crystal lattice. */ + defects?: Group< { + /** Intergrowth of two or more crystal grains of the same species. */ + twinning?: OneOrMany< StructProperty< { + /** Qualitative type of twinning. */ + type?: TwinningType; + /** Mechanical mode of twin formation. */ + mode?: TwinningMode; + /** The specific crystallographic twin law. */ + law?: string; + /** The mathematical symmetry operation defining the twin. */ + operation?: string; + } > >; + } >; + /** Mechanical behavior of the solid under stress. */ + mechanical?: Group< { + /** Tendency of the crystal to split along specific structural planes. */ + cleavage?: OneOrMany< StructProperty< { + /** Qualitative type of cleavage. */ + type?: CleavageType; + /** Measure of how easily and smoothly the crystal splits. */ + quality?: CleavageQuality; + /** Crystallographic plane (Miller index) of the cleavage. */ + millerIndex?: string; + } > >; + /** Nature of the surface produced when the crystal is broken. */ + fracture?: OneOrMany< StructProperty< { + /** Qualitative type of fracture surface (e.g., Conchoidal). */ + type?: FractureType; + /** Resistance of the material to crack propagation. */ + toughness?: NumberValue< 'energy' >; + /** Ability of the material to undergo plastic deformation. */ + tenacity?: Tenacity; + } > >; + } >; + } >; +} >; diff --git a/model/collection/composition.ts b/model/collection/composition.ts new file mode 100644 index 00000000..6595db1d --- /dev/null +++ b/model/collection/composition.ts @@ -0,0 +1,68 @@ +/** + * @file model/collection/composition.ts + * @description Defines the chemical makeup of substances, supporting stoichiometric + * ratios, concentration ranges, and fractional distributions. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { CompositionType } from '../../enum/science/composition'; +import type { ElementSymbol } from '../../enum/science/element'; +import type { DomainType } from '../../enum/system/domain'; +import type { Collection, Distinct } from '../base/modifier'; +import type { CompoundId } from '../domain/compound'; +import type { MineralId } from '../domain/mineral'; +import type { MixtureId } from '../domain/mixture'; + +/** + * Structural framework for a single constituent within a chemical composition. + * + * @template T The type of composition representation. + */ +type BaseComponent< T extends CompositionType > = Brand< { + /** Reference to the chemical entity forming the constituent. */ + ref: + | { type: DomainType.ELEMENT, id: ElementSymbol } + | { type: DomainType.COMPOUND, id: CompoundId } + | { type: DomainType.MIXTURE, id: MixtureId } + | { type: DomainType.MINERAL, id: MineralId }; + /** The ionic charge state of the constituent within the structure. */ + charge?: number; +}, T, 'type', true >; + +/** Constituent defined by a fixed integral or decimal ratio (e.g., in a chemical formula). */ +type StoichiometryComponent = Expand< BaseComponent< CompositionType.STOICHIOMETRY > & { + /** The stoichiometric coefficient or molar ratio of the constituent. */ + amount: number; +} >; + +/** Constituent defined by a concentration span, typical for minerals and natural materials. */ +type RangeComponent = Expand< BaseComponent< CompositionType.RANGE > & { + /** The lower and upper boundaries of the constituent's prevalence. */ + amount: { + /** Minimum concentration or ratio. */ + min: number; + /** Maximum concentration or ratio. */ + max: number; + }; +} >; + +/** Constituent defined by its relative mass or molar fraction within a mixture. */ +type FractionComponent = Expand< BaseComponent< CompositionType.FRACTION > & { + /** The quantitative portion of the constituent relative to the whole. */ + fraction: number; +} >; + +/** + * Domain-specific collection of constituents forming a compound, mineral, or mixture. + * + * @template D The scientific domain of the substance. + */ +export type CompositionCollection< D extends DomainType > = Collection< { + /** List of constituents forming the substance. */ + components: Distinct< + D extends DomainType.COMPOUND ? StoichiometryComponent : + D extends DomainType.MINERAL ? StoichiometryComponent | RangeComponent : + D extends DomainType.MIXTURE ? FractionComponent : + never + >[]; +} >; diff --git a/model/collection/descriptive.ts b/model/collection/descriptive.ts new file mode 100644 index 00000000..cb39413d --- /dev/null +++ b/model/collection/descriptive.ts @@ -0,0 +1,27 @@ +/** + * @file model/collection/descriptive.ts + * @description Qualitative information, localized nomenclature, and sensory + * properties of a chemical entity. + */ + +import type { SensoryProperty } from '../../enum/science/descriptive'; +import type { Collection, Group, Many, Mapping, One } from '../base/modifier'; +import type { LangGroup } from '../base/primitive'; +import type { PrimitiveProperty } from '../base/property'; + +/** Grouping of descriptive metadata and qualitative observations. */ +export type DescriptiveCollection = Collection< { + /** The primary scientific name of the entity. */ + name?: LangGroup< One< PrimitiveProperty< string > > >; + /** Alternative names, symbols, or common identifiers. */ + aliases?: Group< { + /** Language-independent symbols or systematic names (e.g., IUPAC). */ + global?: Many< PrimitiveProperty< string > >; + /** Common or trivial names specific to certain languages. */ + localized?: LangGroup< Many< PrimitiveProperty< string > >, never >; + } >; + /** Comprehensive qualitative summary of the entity's properties and significance. */ + description?: LangGroup< One< PrimitiveProperty< string > > >; + /** Localized observations regarding appearance, odor, or other sensory characteristics. */ + sensory?: Mapping< SensoryProperty, LangGroup< One< PrimitiveProperty< string > > > >; +} >; diff --git a/model/collection/formula.ts b/model/collection/formula.ts new file mode 100644 index 00000000..087fd0a5 --- /dev/null +++ b/model/collection/formula.ts @@ -0,0 +1,26 @@ +/** + * @file model/collection/formula.ts + * @description Representations of chemical formulas, including systematic notation + * and typographic renderings. + */ + +import type { FormulaType } from '../../enum/science/formula'; +import type { BlobType } from '../../enum/system/blob'; +import type { Collection, OneOrMany } from '../base/modifier'; +import type { StructProperty } from '../base/property'; +import type { BlobId } from '../registry/blob'; + +/** Structural model for a chemical formula representation. */ +export type Formula = { + /** Plain text representation of the chemical formula (e.g., "H{2}O"). */ + notation?: string; + /** High-quality typographic rendering of the formula using LaTeX. */ + latexNotation?: string; + /** Visual representations or structural diagrams of the chemical formula. */ + images?: BlobId< BlobType.FORMULA >[]; +}; + +/** Collection of diverse formula types (e.g., empirical, structural, skeletal). */ +export type FormulaCollection = Collection< { + [ K in FormulaType ]?: OneOrMany< StructProperty< Formula > >; +} >; diff --git a/model/collection/generic.ts b/model/collection/generic.ts new file mode 100644 index 00000000..fc923097 --- /dev/null +++ b/model/collection/generic.ts @@ -0,0 +1,47 @@ +/** + * @file model/collection/generic.ts + * @description General non-chemical properties, including market value and economic data + * associated with a substance. + */ + +import type { RequireAtLeastOne } from 'devtypes/types/constraint'; +import type { PriceContext, PriceTax, PriceValue } from '../../enum/science/generic'; +import type { Currency } from '../../enum/system/locale'; +import type { Collection, Many } from '../base/modifier'; +import type { IsoDate } from '../base/primitive'; +import type { StructProperty } from '../base/property'; +import type { NumberValue } from '../base/value'; +import type { PhysicalQuantity } from '../registry/unit'; + +/** Structural model for representing the market price of a scientific commodity. */ +export type Price = { + /** The quantitative cost of the substance. */ + value: + /** Exact market price. */ + | { type: PriceValue.EXACT, value: number } + /** Price range for bulk or varying grades. */ + | { type: PriceValue.RANGE, min: number, max: number } + /** Starting price for custom orders. */ + | { type: PriceValue.FROM, value: number }; + /** The currency unit used for the price specification. */ + currency: Currency; + /** The temporal period or point in time for which the price was verified. */ + validity?: { at: IsoDate } | RequireAtLeastOne< { from?: IsoDate, to?: IsoDate }, 'from' | 'to' >; + /** Administrative and market context of the price data. */ + context?: { + /** Classification of the price (e.g., Industrial, Laboratory grade). */ + type?: PriceContext; + /** Information regarding included or excluded value-added taxes. */ + tax?: PriceTax; + /** The amount of substance for which the price is specified. */ + quantity?: NumberValue< PhysicalQuantity >; + /** Geographic or organizational market where the price applies. */ + market?: string; + }; +}; + +/** Collection of diverse non-scientific properties. */ +export type GenericCollection = Collection< { + /** Market price entries for the substance. */ + price: Many< StructProperty< Price > >; +} >; diff --git a/model/collection/history.ts b/model/collection/history.ts new file mode 100644 index 00000000..6503eab5 --- /dev/null +++ b/model/collection/history.ts @@ -0,0 +1,105 @@ +/** + * @file model/collection/history.ts + * @description Chronological documentation of the scientific milestones, including discovery, + * isolation, and naming of a substance. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { EventTimeType, EventType } from '../../enum/science/history'; +import type { CountryCode } from '../../enum/system/locale'; +import type { Collection, Distinct } from '../base/modifier'; +import type { IsoDate } from '../base/primitive'; +import type { OrgId } from '../registry/organization'; +import type { PersonId } from '../registry/person'; +import type { RefId } from '../registry/reference'; + +/** + * Structural framework for a historical event, integrating temporal data, actors, and locations. + * + * @template E The specific type of historical milestone. + */ +type BaseEvent< E extends EventType > = Brand< { + /** The precise or approximate temporal point or period of the event. */ + time: + /** Discrete timestamp of the event. */ + | { type: EventTimeType.DATE, date: IsoDate } + /** Specific year of the event, optionally approximate. */ + | { type: EventTimeType.YEAR, year: number; approximate?: boolean } + /** Temporal period defined by start and end years. */ + | { type: EventTimeType.RANGE, fromYear: number; toYear: number } + /** Qualitative or non-standard temporal description. */ + | { type: EventTimeType.TEXT, text: string }; + /** List of individuals (scientists) primarily involved in the event. */ + actors?: PersonId[]; + /** Research institutions or laboratories where the event took place. */ + organizations?: OrgId[]; + /** Geographic and institutional places associated with the event. */ + locations?: { + /** Country where the event occurred. */ + country?: CountryCode; + /** Specific city. */ + place?: string; + }[]; + /** Qualitative descriptions and historical context of the event. */ + context?: string; + /** Bibliographic evidence supporting the historical account. */ + references?: RefId[]; +}, E, 'type', true >; + +/** Shared field for events requiring methodology descriptions. */ +type MethodField = { + /** The experimental or theoretical methodology used for the milestone. */ + method: string; +}; + +/** Shared fields for nomenclature-related events. */ +type NamingFields = { + /** The proposed or finalized name of the entity. */ + name: string; + /** Etymological origin of the name. */ + namedAfter?: { + /** Scientists or historical figures after whom the entity was named. */ + persons?: PersonId[]; + /** Institutions or groups involved in the naming. */ + organizations?: OrgId[]; + /** Literal or celestial origins (e.g., 'Planet Venus'). */ + literal?: string; + }; +}; + +/** Scientific event marking the initial identification of a new species or phenomenon. */ +export type DiscoveryEvent = Expand< BaseEvent< EventType.DISCOVERY > & MethodField >; +/** Initial documented sighting or qualitative measurement of a species. */ +export type FirstObservationEvent = Expand< BaseEvent< EventType.FIRST_OBSERVATION > >; +/** Successful physical separation of the species into a pure form. */ +export type IsolationEvent = Expand< BaseEvent< EventType.ISOLATION > >; +/** Intentional artificial production of the species through chemical or nuclear processes. */ +export type SynthesisEvent = Expand< BaseEvent< EventType.SYNTHESIS > & MethodField >; +/** Formal proposal or international acceptance of the species' nomenclature. */ +export type NamingEvent = Expand< BaseEvent< EventType.NAMING > & NamingFields >; +/** Independent verification of a previous discovery or observation. */ +export type ConfirmationEvent = Expand< BaseEvent< EventType.CONFIRMATION > >; +/** Comprehensive determination of fundamental physical or chemical properties. */ +export type CharacterizationEvent = Expand< BaseEvent< EventType.CHARACTERIZATION > >; +/** Other significant historical milestones not covered by standard categories. */ +export type MiscEvent = Expand< BaseEvent< EventType.MISC > & { + /** Specific context or nature of the miscellaneous event. */ + context: string +} >; + +/** Union of all documented scientific historical milestones. */ +export type HistoryEvent = + | DiscoveryEvent + | FirstObservationEvent + | IsolationEvent + | SynthesisEvent + | NamingEvent + | ConfirmationEvent + | CharacterizationEvent + | MiscEvent; + +/** Chronological sequence of historical events defining the entity's scientific journey. */ +export type HistoryCollection = Collection< { + /** List of historical events associated with the entity. */ + events?: Distinct< HistoryEvent >[]; +} >; diff --git a/model/collection/identification.ts b/model/collection/identification.ts new file mode 100644 index 00000000..adf19f08 --- /dev/null +++ b/model/collection/identification.ts @@ -0,0 +1,105 @@ +/** + * @file model/collection/identification.ts + * @description Standardized identifiers and database keys for ensuring unambiguous + * chemical entity recognition across global scientific platforms. + */ + +import type { Collection, Distinct, Group } from '../base/modifier'; + +/** Unique numerical identifier assigned by the Chemical Abstracts Service. */ +export type CASNumber = `${ number }-${ number }-${ number }`; +/** Numerical identifier for substances within the European Union (EINECS, ELINCS, or NLP). */ +export type ECNumber = `${ number }-${ number }-${ number }`; +/** Unique compound identifier within the PubChem database. */ +export type PubChemCID = `${ number }`; +/** Unique identifier within the ChemSpider chemical database. */ +export type ChemSpiderID = `${ number }`; +/** Unique identifier within the Chemical Entities of Biological Interest (ChEBI) database. */ +export type ChEBIID = `CHEBI:${ number }`; +/** Unique identifier within the ChEMBL bioactivity database. */ +export type ChEMBLID = `CHEMBL${ number }`; +/** Unique identifier within the Kyoto Encyclopedia of Genes and Genomes. */ +export type KEGGID = `C${ string }` | `D${ string }`; +/** Unique identifier within the DrugBank database for pharmacological data. */ +export type DrugBankID = `DB${ string }`; +/** Link to the European Chemicals Agency (ECHA) information page. */ +export type ECHAInfoCard = `100.${ number }.${ number }`; +/** Unique identifier within the Registry of Toxic Effects of Chemical Substances. */ +export type RTECSNumber = `RTECS${ string }`; +/** Unique Ingredient Identifier assigned by the FDA for substance tracking. */ +export type UNII = string; +/** Anatomical Therapeutic Chemical (ATC) classification system code. */ +export type ATCCode = string; +/** Unique identifier within the Beilstein database for organic chemistry. */ +export type BeilsteinNumber = `${ number }`; +/** Unique identifier within the Gmelin database for inorganic chemistry. */ +export type GmelinNumber = `${ number }`; +/** Unique identifier assigned by the National Cancer Institute (NSC). */ +export type NSCNumber = `NSC${ number }`; +/** Unique identifier for macromolecular structures in the Protein Data Bank. */ +export type PDBID = string; +/** Unique identifier within the Wikidata knowledge base. */ +export type WikidataID = `Q${ number }`; + +/** Grouping of diverse international identifiers categorized by their scientific or regulatory context. */ +export type IdentificationCollection = Collection< { + /** Common regulatory identifiers like CAS and EC numbers. */ + general?: Group< { + /** Chemical Abstracts Service registry number. */ + cas?: Distinct< CASNumber >; + /** European Community number. */ + ec?: Distinct< ECNumber >; + /** European Inventory of Existing Commercial Chemical Substances. */ + einecs?: Distinct< ECNumber >; + /** European List of Notified Chemical Substances. */ + elincs?: Distinct< ECNumber >; + } >; + /** Identifiers from major chemical and biological databases. */ + databases?: Group< { + /** PubChem Compound ID. */ + pubchem?: Distinct< PubChemCID >; + /** ChemSpider Identifier. */ + chemspider?: Distinct< ChemSpiderID >; + /** ChEBI Registry ID. */ + chebi?: Distinct< ChEBIID >; + /** ChEMBL Identifier. */ + chembl?: Distinct< ChEMBLID >; + /** KEGG Compound or Drug ID. */ + kegg?: Distinct< KEGGID >; + /** DrugBank Identifier. */ + drugbank?: Distinct< DrugBankID >; + } >; + /** Identifiers related to chemical safety and toxicological registry. */ + safety?: Group< { + /** ECHA Information Card number. */ + echa?: Distinct< ECHAInfoCard >; + /** Registry of Toxic Effects of Chemical Substances number. */ + rtecs?: Distinct< RTECSNumber >; + /** FDA Unique Ingredient Identifier. */ + unii?: Distinct< UNII >; + } >; + /** Pharmacological and therapeutic classification codes. */ + classification?: Group< { + /** WHO Anatomical Therapeutic Chemical codes. */ + atc?: Distinct< ATCCode >[]; + } >; + /** Historical identifiers from the Beilstein and Gmelin registries. */ + legacy?: Group< { + /** Beilstein Registry Number. */ + beilstein?: Distinct< BeilsteinNumber >; + /** Gmelin Registry Number. */ + gmelin?: Distinct< GmelinNumber >; + /** National Service Center number. */ + nsc?: Distinct< NSCNumber >; + } >; + /** Identifiers for structural data repositories. */ + structure?: Group< { + /** Protein Data Bank identifiers. */ + pdb?: Distinct< PDBID >[]; + } >; + /** Identifiers from general knowledge graphs and collaborative databases. */ + external?: Group< { + /** Wikidata item identifier. */ + wikidata?: Distinct< WikidataID >; + } >; +} >; diff --git a/model/collection/media.ts b/model/collection/media.ts new file mode 100644 index 00000000..816089c5 --- /dev/null +++ b/model/collection/media.ts @@ -0,0 +1,48 @@ +/** + * @file model/collection/media.ts + * @description Visual and digital assets associated with a scientific entity, + * including spectra, models, and documentation. + */ + +import type { Expand } from 'devtypes/types/util'; +import type { BlobType, DocumentType, Model3DType, SpectrumType } from '../../enum/system/blob'; +import type { Collection, Distinct } from '../base/modifier'; +import type { BlobId } from '../registry/blob'; + +/** Mapping of media types to their specific classification enums. */ +type MediaSubtypeMap = { + [ BlobType.IMAGE ]: never; + [ BlobType.MODEL_3D ]: Model3DType; + [ BlobType.FORMULA ]: never; + [ BlobType.SPECTRUM ]: SpectrumType; + [ BlobType.DOCUMENT ]: DocumentType; + [ BlobType.DATA ]: never; + [ BlobType.OTHER ]: never; +}; + +/** + * Conditional field for subtype classification based on blob type. + * + * @template T The architectural type of the binary asset. + */ +type SubtypeField< T extends BlobType > = [ MediaSubtypeMap[ T ] ] extends [ never ] ? {} : { + /** Specific classification of the media (e.g., IR spectrum, PDB model). */ + subtype: MediaSubtypeMap[ T ]; +}; + +/** + * Structural grouping of binary assets with shared context and classification. + * + * @template T The architectural type of the binary asset. + */ +export type MediaEntry< T extends BlobType > = Expand< { + /** List of identifiers for the binary data files. */ + blobs: BlobId< T >[]; + /** Descriptive information regarding the purpose or environment of the media assets. */ + context?: string; +} & SubtypeField< T > >; + +/** Registry-like collection of all digital assets categorized by their primary data type. */ +export type MediaCollection = Collection< { + [ T in BlobType ]?: Distinct< MediaEntry< T > >[]; +} >; diff --git a/model/collection/nuclear.ts b/model/collection/nuclear.ts new file mode 100644 index 00000000..6b8dcae5 --- /dev/null +++ b/model/collection/nuclear.ts @@ -0,0 +1,419 @@ +/** + * @file model/collection/nuclear.ts + * @description Nuclear structure and behavior, including ground states, excited levels, + * radioactive decay, and interactions with particles. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { + BetaRadiationType, BetaTransitionType, DecayMode, DelayedParticle, + IncidentNeutronEnergy, MomentMeasurementMethod, MomentMeasurementRef, + RadiationType, SpinParity +} from '../../enum/science/nuclear'; +import type { Collection, Many, Mapping, One } from '../base/modifier'; +import type { StructProperty } from '../base/property'; +import type { NumberValue } from '../base/value'; +import type { NuclideId } from '../domain/nuclide'; +import type { NoUnit } from '../registry/unit'; + +/** Structural model for the intrinsic angular momentum and parity of a nuclear state. */ +export type Spin = { + /** Symmetry property of the nuclear wave function under spatial inversion. */ + parity: SpinParity; + /** Calculated numerical spin value. */ + calculatedValue: number; + /** Typographic representation of the spin (e.g., '1/2+'). */ + value: string; +}; + +/** Reference to a specific nuclear state by its energy and characteristics. */ +export type NuclearRef = { + /** Excitation energy of the nuclear state relative to the ground state. */ + energy: NumberValue< 'energy' >; + /** Angular momentum and parity of the state. */ + spinParity?: Spin; + /** Time required for half of the population in this state to decay. */ + halfLife?: NumberValue< 'time' >; +}; + +/** Quantitative description of a radioactive decay mode. */ +export type DecayChannel = { + /** The specific physical mode of radioactive decay. */ + mode: DecayMode; + /** The probability of the parent nucleus decaying via this specific mode. */ + branchingRatio?: NumberValue< 'quantity' >; + /** Total energy released during the decay process (Q-value). */ + energy?: NumberValue< 'energy' >; + /** Types of radiation emitted during the decay. */ + radiation?: RadiationType[]; +}; + +/** Shared base properties for excited and ground nuclear levels. */ +type NuclearBaseLevel = NuclearRef & { + /** Documented radioactive decay channels from this state. */ + decayChannel?: DecayChannel[]; + /** Quantum number relating to the proton and neutron content of the nucleus. */ + isospin?: Spin; + /** Measure of the interaction between the nucleus and an external magnetic field. */ + magneticMoment?: NumberValue< 'magneticMoment' >; + /** Measure of the deviation of the nuclear charge distribution from spherical symmetry. */ + quadrupoleMoment?: NumberValue< 'area' >; +}; + + +/** Properties of the nuclide's most stable nuclear configuration. */ +export type NuclearGroundState = Expand< NuclearBaseLevel & { + /** Relative prevalence of the nuclide in a natural sample of the element. */ + abundance?: NumberValue< 'moleFraction' >; + /** Root-mean-square radius of the nuclear charge distribution. */ + radius?: NumberValue< 'length' >; + /** Energy released in various radioactive decay modes of the ground state. */ + qValues?: { + /** Q-value for beta-minus decay. */ + betaMinus?: NumberValue< 'energy'>; + /** Q-value for alpha decay. */ + alpha?: NumberValue< 'energy' >; + /** Q-value for electron capture. */ + ec?: NumberValue< 'energy' >; + /** Q-value for beta-delayed neutron emission. */ + betaDelayedNeutron?: NumberValue< 'energy' >; + }; + /** Minimum energy required to remove a nucleon from the ground state. */ + separationEnergy?: { + /** Energy required to remove a single neutron. */ + neutron?: NumberValue< 'energy' >; + /** Energy required to remove a single proton. */ + proton?: NumberValue< 'energy' >; + }; + /** Average energy required to separate a nucleon from the nucleus. */ + bindingEnergyPerNucleon?: NumberValue< 'energy' >; + /** The mass of the neutral atom in its nuclear ground state. */ + atomicMass?: NumberValue< 'mass' >; + /** The difference between the actual atomic mass and the mass number in energy units. */ + massExcess?: NumberValue< 'energy' >; +} >; + + +/** Unique identifier for a specific excited nuclear level. */ +export type NuclearLevelId = Brand< number, 'nuclearLevelId' >; + +/** Properties of a nuclide in an excited energy state. */ +export type NuclearLevel = Expand< NuclearBaseLevel & { + /** Classification of the level within a rotational or vibrational band. */ + band?: number; +} >; + + +/** Description of a electromagnetic transition (gamma-ray) between nuclear levels. */ +export type NuclearGamma = { + /** The initial excited nuclear state. */ + fromLevel: NuclearLevelId; + /** The final nuclear state after transition. */ + toLevel: NuclearLevelId; + /** Energy of the emitted gamma-ray photon. */ + gammaEnergy?: NumberValue< 'energy' >; + /** Relative frequency of this transition. */ + intensity?: NumberValue< NoUnit >; + /** Classification of the radiation field (e.g., E1, M2). */ + multipolarity?: string; + /** Ratio of the intensities of different multipolarity components. */ + mixingRatio?: NumberValue< NoUnit >; + /** Ratio of the rate of internal conversion to the rate of gamma emission. */ + conversionCoefficient?: NumberValue< NoUnit >; + /** Mathematical probability of transition normalized by the phase space. */ + reducedTransitionProbability?: { + /** Electric component of the transition probability. */ + electric?: NumberValue< NoUnit >; + /** Magnetic component of the transition probability. */ + magnetic?: NumberValue< NoUnit >; + }; +}; + + +/** Administrative and energy balance data for a decay sequence. */ +export type DecayRadiationDataset = { + /** The nuclide resulting from the radioactive decay. */ + daughterNuclide: NuclideId; + /** The specific nuclear level of the parent from which decay originates. */ + parentLevel?: NuclearLevelId; + /** Effective half-life for this specific decay branch. */ + halfLife?: NumberValue< 'time' >; + /** The specific mode of radioactive decay. */ + decayMode?: DecayChannel; + /** Total energy released in the decay dataset. */ + qValue?: NumberValue< 'energy' >; + /** Distribution of the released energy across various particles. */ + energyBalance?: { + /** Energy carried by alpha particles. */ + alpha?: NumberValue< 'energy' >; + /** Energy carried by beta particles. */ + beta?: NumberValue< 'energy' >; + /** Energy carried by conversion and Auger electrons. */ + electronConversionAuger?: NumberValue< 'energy' >; + /** Energy carried by gamma and X-ray photons. */ + gammaXray?: NumberValue< 'energy' >; + /** Energy carried by the recoiling daughter nucleus. */ + recoil?: NumberValue< 'energy' >; + /** Energy carried by neutrinos or antineutrinos. */ + neutrino?: NumberValue< 'energy' >; + /** Total energy accounted for in the balance. */ + total?: NumberValue< 'energy' >; + /** Weighted average Q-value per decay. */ + qBranching?: NumberValue< 'energy' >; + /** Measure of the energy balance completeness. */ + delta?: NumberValue< 'quantity' >; + /** Energy released but not yet attributed to specific particles. */ + unplaced?: NumberValue< 'energy' >; + }; +}; + +/** Shared base for quantitative radiation data. */ +type RadiationBase = { + /** Mean or discrete energy of the emitted radiation. */ + energy?: NumberValue< 'energy' >; + /** Number of particles or photons emitted per decay. */ + intensity?: NumberValue< 'quantity' >; + /** The resulting level of the daughter nucleus. */ + daughterLevel?: NuclearLevelId; +}; + +/** Properties of beta (minus or plus) or electron capture radiation. */ +export type BetaRadiation = Expand< RadiationBase & { + /** Classification as beta minus, beta plus, or EC. */ + type: BetaRadiationType; + /** Average energy of the continuous beta spectrum. */ + meanEnergy?: NumberValue< 'energy' >; + /** Maximum energy (endpoint) of the beta spectrum. */ + maxEnergy?: NumberValue< 'energy' >; + /** Total energy released in an electron capture process. */ + electronCaptureEnergy?: NumberValue< 'energy' >; + /** Relative intensity of associated conversion electrons. */ + conversionElectronIntensity?: NumberValue< 'quantity' >; + /** Logarithm of the comparative half-life (measure of transition probability). */ + logFt?: NumberValue< NoUnit >; + /** Classification based on the selection rules of the transition. */ + transitionType?: BetaTransitionType; +} >; + +/** Properties of alpha particle emission. */ +export type AlphaRadiation = Expand< RadiationBase & { + /** Ratio of the experimental half-life to the theoretically calculated one. */ + hindranceFactor?: NumberValue< NoUnit >; +} >; + +/** Properties of photon emission during nuclear transitions. */ +export type GammaRadiation = Expand< RadiationBase & { + /** Intensity of the gamma emission relative to beta-plus decay. */ + intensityBetaPlus?: NumberValue< 'quantity' >; + /** Initial nuclear level of the transition. */ + fromLevel?: NuclearLevelId; + /** Final nuclear level of the transition. */ + toLevel?: NuclearLevelId; + /** Multipolarity of the electromagnetic radiation field. */ + multipolarity?: string; + /** Mixing ratio between different multipolarities. */ + mixingRatio?: NumberValue< NoUnit >; + /** Internal conversion coefficient for the transition. */ + conversionCoefficient?: NumberValue< NoUnit >; +} >; + +/** Emission of particles from excited states following a primary radioactive decay. */ +export type DelayedParticleRadiation = Expand< RadiationBase & { + /** The type of delayed particle emitted (e.g., Neutron, Proton). */ + particle: DelayedParticle; + /** Energy of the excited state in the intermediate nucleus. */ + intermediateEnergy?: NumberValue< 'energy' >; + /** Energy width of the emitting state. */ + width?: NumberValue< 'energy' >; + /** Change in orbital angular momentum during emission. */ + angularMomentumTransfer?: NumberValue< NoUnit >; + /** Spin and parity of the emitting state. */ + spinParity?: Spin; +} >; + +/** Emission of photons or electrons resulting from atomic shell processes. */ +export type AtomicRadiation = Expand< RadiationBase & { + /** The atomic shell or subshell where the process originates. */ + originShell?: string; + /** X-ray nomenclature or line identifier (e.g., 'K-alpha'). */ + line?: string; + /** Energy of the initiating process (e.g., binding energy). */ + sourceEnergy?: NumberValue< 'energy' >; + /** Probability of electron capture from this specific shell. */ + electronCaptureProbability?: NumberValue< 'quantity' >; + /** Internal conversion coefficient for the specific shell. */ + conversionCoefficientShell?: NumberValue< NoUnit >; +} >; + +/** Grouping of radiation data for a specific decay dataset. */ +export type DecayRadiation = { + /** Administrative and energy balance context. */ + dataset: DecayRadiationDataset; + /** Categorized lists of emitted radiation. */ + radiation?: { + /** Beta radiation data. */ + beta?: BetaRadiation[]; + /** Alpha radiation data. */ + alpha?: AlphaRadiation[]; + /** Gamma radiation data. */ + gamma?: GammaRadiation[]; + /** Delayed particle emission data. */ + delayed?: DelayedParticleRadiation[]; + /** Atomic shell radiation data. */ + atomic?: AtomicRadiation[]; + }; +}; + + +/** Experimental data regarding magnetic and quadrupole moments. */ +export type NuclearMomentMeasurement = { + /** The nuclear state or context being measured. */ + ref: + | { type: MomentMeasurementRef.LEVEL, level: NuclearLevelId } + | { type: MomentMeasurementRef.CONTEXT, context: NuclearRef }; + /** Measured magnetic dipole moment. */ + magneticMoment?: NumberValue< 'magneticMoment' >; + /** Measured electric quadrupole moment. */ + quadrupoleMoment?: NumberValue< 'area' >; + /** The experimental method used for the measurement. */ + method?: MomentMeasurementMethod; + /** The reference nuclide used for calibration. */ + referenceStandard?: NuclideId; + /** Identifier in the International Network of Nuclear Structure and Decay Data. */ + indcTable?: string; + /** Key for the Nuclear Science References (NSR) database. */ + nsrKey?: string; +}; + +/** Collection of documented nuclear moments. */ +export type NuclearMoments = Collection< { + /** Officially recommended moment values. */ + recommended?: Many< StructProperty< NuclearMomentMeasurement > >; + /** Chronological or alternative compiled measurements. */ + compiled?: Many< StructProperty< NuclearMomentMeasurement > >; +} >; + + +/** Quantitative distribution of fission products. */ +export type NuclearFissionYield = { + /** Indicates if the yield is for a metastable state. */ + metastable: boolean; + /** The parent nuclide undergoing fission. */ + parent: NuclideId; + /** Yield values indexed by the energy of the incident neutrons. */ + yields: Mapping< IncidentNeutronEnergy, NumberValue< 'quantity' > >; +}; + +/** Collection of data related to nuclear fission processes. */ +export type NuclearFission = Collection< { + /** Total yield of the nuclide including contributions from precursors. */ + cumulative?: Many< StructProperty< NuclearFissionYield > >; + /** Direct yield of the nuclide from the fission event. */ + independent?: Many< StructProperty< NuclearFissionYield > >; +} >; + + +/** Parameters governing the interaction of the nuclide with neutrons. */ +export type NuclearNeutronCapture = { + /** Spin and parity of the capturing state. */ + spinParity?: Spin; + /** Effective area representing the probability of a specific reaction. */ + crossSection?: { + /** Capture cross-section for a Maxwellian neutron distribution. */ + maxwellianCapture?: NumberValue< 'area' >; + /** Total radiative capture cross-section. */ + capture?: NumberValue< 'area' >; + /** Probability of elastic neutron scattering. */ + elastic?: NumberValue< 'area' >; + /** Probability of neutron-induced alpha emission. */ + alpha?: NumberValue< 'area' >; + /** Probability of neutron-induced proton emission. */ + proton?: NumberValue< 'area' >; + /** Probability of neutron-induced fission. */ + fission?: NumberValue< 'area' >; + }; + /** Potential scattering radius of the nucleus. */ + radius?: NumberValue< 'length' >; + /** Parameters of the nuclear resonance structure. */ + resonance?: { + /** Average energy spacing between resonances. */ + averageSpacing?: NumberValue< 'energy' >; + /** Reduced neutron width for s-wave neutrons. */ + sWave?: NumberValue< 'energy' >; + /** Reduced neutron width for p-wave neutrons. */ + pWave?: NumberValue< 'energy' >; + }; + /** Cross-section integrated over a 1/E neutron spectrum. */ + resonanceIntegrals?: { + /** Integral for radiative capture. */ + capture?: NumberValue< 'area' >; + /** Integral for alpha emission. */ + alpha?: NumberValue< 'area' >; + /** Integral for proton emission. */ + proton?: NumberValue< 'area' >; + /** Integral for neutron-induced fission. */ + fission?: NumberValue< 'area' >; + /** Integral for total neutron absorption. */ + absorption?: NumberValue< 'area' >; + }; + /** Maxwellian-averaged capture cross-section at kT = 30 keV. */ + macs30?: NumberValue< 'area' >; +}; + +/** Collection of data related to specific nuclear reactions. */ +export type NuclearReactions = Collection< { + /** Detailed parameters of neutron capture processes. */ + neutronCapture?: One< StructProperty< NuclearNeutronCapture > >; +} >; + + +/** Properties relevant to Nuclear Magnetic Resonance (NMR) spectroscopy. */ +export type NuclearNMR = { + /** Nuclear spin state used for NMR. */ + spin?: Spin; + /** Ratio of the magnetic moment to the angular momentum. */ + gyromagneticRatio?: NumberValue< 'gyromagneticRatio' >; + /** Relationship between the external field and the resonance frequency. */ + larmorFrequency?: { + /** Strength of the external magnetic flux density. */ + field: NumberValue< 'magneticFluxDensity' >; + /** Resulting Larmor precession frequency. */ + frequency: NumberValue< 'frequency' >; + }; + /** NMR sensitivity of the nuclide relative to a reference. */ + relativeSensitivity?: { + /** Numerical sensitivity factor. */ + value: NumberValue< NoUnit >; + /** The reference nuclide (usually 1H or 13C). */ + reference?: NuclideId; + }; +}; + +/** Collection of data for various nuclear spectroscopy techniques. */ +export type NuclearSpectroscopy = Collection< { + /** Data for Nuclear Magnetic Resonance applications. */ + nmr?: One< StructProperty< NuclearNMR > >; +} >; + + +/** Comprehensive collection of nuclear data, categorized by states, transitions, and interactions. */ +export type NuclearCollection = Collection< { + /** Properties of the nuclear ground state. */ + ground?: One< StructProperty< NuclearGroundState > >; + /** Registry of excited nuclear energy levels. */ + levels?: Collection< { + [ K in NuclearLevelId ]: One< StructProperty< NuclearLevel > > + } >; + /** Documented gamma-ray transitions. */ + gammas?: Many< StructProperty< NuclearGamma > >; + /** Comprehensive radioactive decay datasets. */ + decay?: Many< StructProperty< DecayRadiation > >; + /** Experimental magnetic and electric moments. */ + moments?: NuclearMoments; + /** Documented nuclear reaction parameters. */ + reactions?: NuclearReactions; + /** Fission yield and probability data. */ + fission?: NuclearFission; + /** Parameters for spectroscopic applications. */ + spectroscopy?: NuclearSpectroscopy; +} >; diff --git a/model/collection/physics.ts b/model/collection/physics.ts new file mode 100644 index 00000000..ea6a96a3 --- /dev/null +++ b/model/collection/physics.ts @@ -0,0 +1,299 @@ +/** + * @file model/collection/physics.ts + * @description Comprehensive physical properties covering thermodynamics, electromagnetism, + * mechanics, optics, and acoustics. + */ + +import type { Diaphaneity, Gloss, Lustre, MagneticOrdering, Phase, Superconductivity } from '../../enum/science/physics'; +import type { Collection, Group, OneOrMany } from '../base/modifier'; +import type { LangGroup } from '../base/primitive'; +import type { CoupledNumberProperty, NumberProperty, PrimitiveProperty, RangeProperty, StructProperty } from '../base/property'; +import type { NumberValue } from '../base/value'; +import type { NoUnit } from '../registry/unit'; + +/** Grouping of fundamental physical characteristics and behavior. */ +export type PhysicsCollection = Collection< { + /** Mass per unit volume. */ + density?: OneOrMany< NumberProperty< 'density' > >; + /** Ratio of the density of a substance to the density of a reference material. */ + relativeDensity?: OneOrMany< NumberProperty< NoUnit > >; + /** The distinct state of matter at given conditions (Solid, Liquid, Gas, Plasma). */ + phase?: OneOrMany< PrimitiveProperty< Phase > >; + + /** Thermal properties and phase transition parameters. */ + thermodynamics?: Group< { + /** Critical points and state transformation temperatures. */ + temperature?: Group< { + /** Temperature at which a solid becomes a liquid. */ + meltingPoint?: OneOrMany< NumberProperty< 'temperature' > >; + /** Temperature at which a liquid becomes a gas. */ + boilingPoint?: OneOrMany< NumberProperty< 'temperature' > >; + /** Temperature range over which the substance remains liquid. */ + liquidRange?: OneOrMany< RangeProperty< 'temperature' > >; + /** Generic temperature for other phase transformations. */ + phaseTransition?: OneOrMany< NumberProperty< 'temperature' > >; + /** Temperature at which an amorphous solid becomes viscous. */ + glassTransition?: OneOrMany< NumberProperty<'temperature'> >; + /** Temperature at which a solid directly becomes a gas. */ + sublimationPoint?: OneOrMany< NumberProperty< 'temperature' > >; + /** Lowest temperature at which a liquid can form an ignitable vapor. */ + flashPoint?: OneOrMany< NumberProperty< 'temperature' > >; + /** Lowest temperature at which a substance spontaneously ignites. */ + autoignitionTemp?: OneOrMany< NumberProperty< 'temperature' > >; + /** Temperature and pressure at which liquid and gas phases become indistinguishable. */ + criticalPoint?: OneOrMany< CoupledNumberProperty< 'temperature' | 'pressure' > >; + /** Temperature and pressure at which three phases coexist in equilibrium. */ + triplePoint?: OneOrMany< CoupledNumberProperty< 'temperature' | 'pressure' > >; + /** Temperature of a crystal's highest-frequency normal mode of vibration. */ + debyeTemp?: OneOrMany< NumberProperty< 'temperature' > >; + } >; + /** Energy changes associated with state transitions and reactions. */ + enthalpy?: Group< { + /** Heat change during fusion (melting). */ + fusion?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + /** Heat change during vaporization. */ + vaporization?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + /** Heat change during sublimation. */ + sublimation?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + /** Energy required to separate a molecule into its constituent atoms. */ + atomization?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + /** Heat change during the formation of the substance. */ + formation?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + /** Heat released during complete combustion of the substance. */ + combustion?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + /** Heat change during a specific chemical reaction. */ + reaction?: OneOrMany< NumberProperty< 'energy' > | NumberProperty< 'molarEnergy' > >; + } >; + /** Parameters governing thermal energy storage and transfer. */ + heat?: Group< { + /** Amount of heat required to change the temperature of the sample by one degree. */ + heatCapacity?: OneOrMany< NumberProperty< 'heatCapacity' > >; + /** Heat capacity per unit of substance (mole). */ + molarHeatCapacity?: OneOrMany< NumberProperty< 'molarHeatCapacity' > >; + /** Heat capacity per unit mass. */ + specificHeatCapacity?: OneOrMany< NumberProperty< 'specificHeatCapacity' > >; + /** Ability of the material to conduct heat. */ + thermalConductivity?: OneOrMany< NumberProperty< 'thermalConductivity' > >; + /** Tendency of the material to change its volume in response to a change in temperature. */ + thermalExpansion?: OneOrMany< NumberProperty< 'tempCoefficient' > >; + /** Rate at which heat spreads through the material. */ + thermalDiffusivity?: OneOrMany< NumberProperty< 'thermalDiffusivity' > >; + /** Ratio of the specific heat at constant pressure to that at constant volume. */ + adiabaticIndex?: OneOrMany< NumberProperty< NoUnit > >; + } >; + } >; + + /** Electrical and magnetic behavior and responses. */ + electromagnetism?: Group< { + /** Properties related to the flow and storage of electric charge. */ + electric?: Group< { + /** Ability of the material to conduct electric current. */ + conductivity?: OneOrMany< NumberProperty< 'electricConductivity' > >; + /** Measure of how strongly the material opposes the flow of electric current. */ + resistivity?: OneOrMany< NumberProperty< 'electricResistivity' > >; + /** Relative change in electrical properties per degree of temperature. */ + tempCoefficient?: Group< { + /** Temperature coefficient of electrical conductivity. */ + conductivity?: OneOrMany< NumberProperty< 'tempCoefficient' > >; + /** Temperature coefficient of electrical resistivity. */ + resistivity?: OneOrMany< NumberProperty< 'tempCoefficient' > >; + } >; + /** Minimum energy required to remove an electron from the solid to a point in vacuum. */ + workFunction?: OneOrMany< NumberProperty< 'energy' > >; + /** Energy range in a solid where no electron states can exist. */ + bandGap?: OneOrMany< NumberProperty< 'energy' > >; + /** Ratio of the permittivity of the material to the permittivity of free space. */ + dielectricConstant?: OneOrMany< NumberProperty< NoUnit > >; + /** Ability of the material to store electrical energy in an electric field. */ + permittivity?: OneOrMany< NumberProperty< 'electricPermittivity' > >; + /** Separation of positive and negative electrical charges. */ + dipoleMoment?: OneOrMany< NumberProperty< 'electricDipoleMoment' > >; + /** State of zero electrical resistance and expulsion of magnetic fields. */ + superconductivity?: OneOrMany< StructProperty< { + /** Classification of the superconducting behavior. */ + type: Superconductivity; + /** Temperature below which the material becomes superconducting. */ + criticalTemp?: NumberValue< 'temperature' >; + } > >; + /** Ratio of the induced electric field to the product of current density and magnetic field. */ + hallCoefficient?: OneOrMany< NumberProperty< 'hallCoefficient' > >; + /** Ease with which an electron can move through the solid under an electric field. */ + electronMobility?: OneOrMany< NumberProperty< 'electronMobility' > >; + } >; + /** Response of the material to magnetic fields and its internal magnetic structure. */ + magnetic?: Group< { + /** The nature of the material's magnetic alignment. */ + magneticOrdering?: OneOrMany< PrimitiveProperty< MagneticOrdering > >; + /** Degree of magnetization in response to an applied magnetic field. */ + susceptibility?: OneOrMany< StructProperty< { + /** Susceptibility per unit volume. */ + volumetric?: NumberValue< 'magneticSusceptibility' >; + /** Susceptibility per unit of substance (mole). */ + molar?: NumberValue< 'molarMagneticSusceptibility' >; + /** Susceptibility per unit mass. */ + mass?: NumberValue< 'massMagneticSusceptibility' >; + } > >; + /** Temperatures defining magnetic state transitions. */ + phaseTransitionTemp?: OneOrMany< StructProperty< { + /** Temperature above which a ferromagnetic material becomes paramagnetic. */ + curie?: NumberValue< 'temperature' >; + /** Temperature above which an antiferromagnetic material becomes paramagnetic. */ + neel?: NumberValue< 'temperature' >; + } > >; + /** Strength of the material's internal magnetic source. */ + magneticMoment?: OneOrMany< NumberProperty< 'magneticMoment' > >; + /** Resistance of a ferromagnetic material to becoming demagnetized. */ + coercivity?: OneOrMany< NumberProperty< 'magneticFieldStrength' > >; + /** Magnetization remaining after the external magnetic field is removed. */ + remanence?: OneOrMany< NumberProperty< 'magneticFluxDensity' > >; + /** Ability of the material to support the formation of a magnetic field. */ + permeability?: OneOrMany< NumberProperty< 'magneticPermeability' > >; + /** Density of permanent or induced magnetic dipole moments. */ + magnetization?: OneOrMany< NumberProperty< 'magnetization' > >; + } >; + } >; + + /** Response to physical forces, including hardness, elasticity, and fluid behavior. */ + mechanics?: Group< { + /** Resistance of the solid to various kinds of permanent shape change when a force is applied. */ + hardness?: Group< { + /** Hardness determined by indentation with a steel or carbide ball. */ + brinell?: OneOrMany< NumberProperty< NoUnit > >; + /** Qualitative scale of mineral hardness based on scratch resistance. */ + mohs?: OneOrMany< NumberProperty< NoUnit > >; + /** Hardness determined by indentation with a diamond pyramid. */ + vickers?: OneOrMany< NumberProperty< NoUnit > >; + /** Hardness based on the depth of penetration of an indenter. */ + rockwell?: OneOrMany< NumberProperty< NoUnit > >; + /** Microhardness test for brittle materials or thin sheets. */ + knoop?: OneOrMany< NumberProperty< NoUnit > >; + } >; + /** Ability of the material to resist distorting influences and return to its original size/shape. */ + elasticity?: Group< { + /** Fundamental constants of linear elasticity. */ + elasticConstants?: Group< { + /** Resistance to uniform compression. */ + bulkModulus?: OneOrMany< NumberProperty< 'pressure' > >; + /** Resistance to shearing strain. */ + shearModulus?: OneOrMany< NumberProperty< 'pressure' > >; + /** Resistance to linear compression or extension. */ + youngModulus?: OneOrMany< NumberProperty< 'pressure' > >; + /** Ratio of transverse strain to axial strain. */ + poissonRatio?: OneOrMany< NumberProperty< NoUnit > >; + } >; + /** Points of structural failure under stress. */ + strengthLimits?: Group< { + /** Maximum stress the material can withstand while being stretched. */ + tensile?: OneOrMany< NumberProperty< 'pressure' > >; + /** The absolute maximum stress before catastrophic failure. */ + ultimate?: OneOrMany< NumberProperty< 'pressure' > >; + /** Stress level at which plastic deformation begins. */ + yield?: OneOrMany< NumberProperty< 'pressure' > >; + } >; + /** Measure of the relative volume change of a fluid or solid as a response to pressure. */ + compressibility?: OneOrMany< NumberProperty< 'compressibility' > >; + } >; + /** Properties of the interface between the material and its environment. */ + surface?: Group< { + /** Tendency of liquid surfaces to shrink into the minimum surface area possible. */ + surfaceTension?: OneOrMany< NumberProperty< 'surfaceTension' > >; + /** Angle at which a liquid-vapor interface meets a solid surface. */ + contactAngle?: OneOrMany< NumberProperty< 'angle' > >; + /** Work required to separate two surfaces. */ + adhesionEnergy?: OneOrMany< NumberProperty< 'energy' > >; + } >; + /** Parameters governing structural degradation and mechanical failure. */ + failure?: Group< { + /** Failure through crack propagation. */ + fracture?: Group< { + /** Resistance of the material to crack propagation. */ + fractureToughness?: OneOrMany< NumberProperty< 'fractureToughness' > >; + /** Rate at which a fatigue crack increases in length. */ + crackGrowthRate?: OneOrMany< NumberProperty< 'rate' > >; + /** Factor used in fracture mechanics to predict the stress state near a crack tip. */ + stressIntensityFactor?: OneOrMany< NumberProperty< 'stressIntensityFactor' > >; + } >; + /** Weakening of a material caused by repeatedly applied loads. */ + fatigue?: Group< { + /** Maximum cyclic stress that can be applied to the material. */ + fatigueStrength?: OneOrMany< NumberProperty< 'pressure' > >; + /** Stress level below which fatigue failure does not occur. */ + fatigueLimit?: OneOrMany< NumberProperty< 'pressure' > >; + /** Number of load cycles a sample can sustain before failure. */ + cyclesToFailure?: OneOrMany< NumberProperty< NoUnit > >; + } >; + /** Tendency of a solid material to move slowly or deform permanently under the influence of persistent stresses. */ + creep?: Group< { + /** Maximum stress the material can withstand for a given time without exceeding a creep limit. */ + creepStrength?: OneOrMany< NumberProperty< 'pressure' > >; + /** Rate of deformation per unit time during creep. */ + creepRate?: OneOrMany< NumberProperty< 'rate' > >; + /** Time-dependent strain per unit stress. */ + creepCompliance?: OneOrMany< NumberProperty< 'compressibility' > >; + } >; + } >; + /** Physical properties of the material in a fluid state. */ + fluid?: Group< { + /** Measure of a fluid's resistance to flow. */ + viscosity?: Group< { + /** Resistance to shearing flows (internal friction). */ + dynamicViscosity?: OneOrMany< NumberProperty< 'dynamicViscosity' > >; + /** Ratio of dynamic viscosity to the density of the fluid. */ + kinematicViscosity?: OneOrMany< NumberProperty< 'kinematicViscosity' > >; + } >; + } >; + } >; + + /** Interaction with electromagnetic radiation, primarily in the visible spectrum. */ + optics?: Group< { + /** Fundamental indices of refraction and absorption. */ + opticalConstants?: Group< { + /** Ratio of the speed of light in vacuum to the speed of light in the material. */ + refractiveIndex?: OneOrMany< NumberProperty< NoUnit > >; + /** Measure of the material's ability to attenuate light. */ + extinctionCoefficient?: OneOrMany< NumberProperty< NoUnit > >; + /** Difference between the refractive indices of a material for different light polarizations. */ + birefringence?: OneOrMany< NumberProperty< NoUnit > >; + /** Angle between the two optic axes in a biaxial crystal. */ + biaxialAngle?: OneOrMany< NumberProperty< 'angle' > >; + } >; + /** Quantitative measures of light interaction. */ + lightInteraction?: Group< { + /** Proportion of incident light that is reflected by the surface. */ + reflectance?: OneOrMany< NumberProperty< NoUnit > >; + /** Proportion of incident light that passes through the material. */ + transmittance?: OneOrMany< NumberProperty< NoUnit > >; + /** Effectiveness of the surface in emitting energy as thermal radiation. */ + emissivity?: OneOrMany< NumberProperty< NoUnit > >; + /** Measure of the rate of light energy loss in the material. */ + absorptionCoefficient?: OneOrMany< NumberProperty< 'attenuationCoefficient' > >; + /** Measure of light redirection by particles or inhomogeneities. */ + scatteringCoefficient?: OneOrMany< NumberProperty< 'attenuationCoefficient' > >; + } >; + /** Qualitative and localized observations of visual properties. */ + appearance?: Group< { + /** Degree to which a surface reflects light in a specular way. */ + gloss?: OneOrMany< PrimitiveProperty< Gloss > >; + /** The way light interacts with the surface of a crystal, mineral, or rock. */ + lustre?: OneOrMany< PrimitiveProperty< Lustre > >; + /** Ability of the material to transmit light (transparency). */ + diaphaneity?: OneOrMany< PrimitiveProperty< Diaphaneity > >; + /** Localized description of the material's visual color. */ + color?: LangGroup< OneOrMany< PrimitiveProperty< string > > >; + /** The color of the powder produced when the material is dragged across an unweathered surface. */ + streak?: LangGroup< OneOrMany< PrimitiveProperty< string > > >; + } >; + } >; + + /** Propagation of mechanical waves (sound) through the material. */ + acoustics?: Group< { + /** Speed at which sound waves travel through the material. */ + soundSpeed?: OneOrMany< NumberProperty< 'velocity' > >; + /** Speed of longitudinal sound waves in a bulk material. */ + bulkSoundSpeed?: OneOrMany< NumberProperty< 'velocity' > >; + /** Rate at which sound energy is lost as it travels. */ + attenuationCoefficient?: OneOrMany< NumberProperty< 'attenuationCoefficient' > >; + /** Opposition of the material to the acoustic flow. */ + acousticImpedance?: OneOrMany< NumberProperty< 'acousticImpedance' > >; + } >; +} >; diff --git a/model/collection/reaction.ts b/model/collection/reaction.ts new file mode 100644 index 00000000..474a5647 --- /dev/null +++ b/model/collection/reaction.ts @@ -0,0 +1,95 @@ +/** + * @file model/collection/reaction.ts + * @description Detailed modeling of chemical and nuclear reactions, including stoichiometry, + * transition steps, conditions, and thermodynamics. + */ + +import type { Brand } from 'devtypes/types/util'; +import type { + ReactionAnnotation, ReactionEffect, ReactionModifier, ReactionSpecies, + ReactionState, ReactionTransition +} from '../../enum/science/reaction'; +import type { ElementSymbol } from '../../enum/science/element'; +import type { CompoundId } from '../domain/compound'; +import type { MineralId } from '../domain/mineral'; +import type { MixtureId } from '../domain/mixture'; +import type { RefId } from '../registry/reference'; +import type { Condition } from '../base/condition'; +import type { Collection, Distinct } from '../base/modifier'; +import type { NumberValue } from '../base/value'; + +/** Structural model for a participant (reactant or product) in a reaction step. */ +export type ReactionTerm = { + /** The specific scientific species involved in the reaction. */ + reactant: + /** Reference to a chemical element. */ + | { type: ReactionSpecies.ELEMENT, id: ElementSymbol } + /** Reference to a chemical compound. */ + | { type: ReactionSpecies.COMPOUND, id: CompoundId } + /** Reference to a mineral species. */ + | { type: ReactionSpecies.MINERAL, id: MineralId } + /** Reference to a chemical mixture. */ + | { type: ReactionSpecies.MIXTURE, id: MixtureId } + /** Reference to the entity itself (self-reacting). */ + | { type: ReactionSpecies.SELF } + /** Direct structural formula representation. */ + | { type: ReactionSpecies.FORMULA, formula: string }; + /** Stoichiometric coefficient defining the molar ratio. */ + coefficient: number; + /** Net electrical charge of the species in the reaction context. */ + charge?: number; + /** Physical state of the reactant (e.g., Aqueous, Gas). */ + state?: ReactionState; + /** Visual or chemical side-effects associated with the species. */ + effect?: ReactionEffect; +}; + +/** A discrete transformation within a chemical reaction. */ +export type ReactionStep = { + /** Nature of the chemical transformation (e.g., Forward, Reverse, Equilibrium). */ + transition: ReactionTransition; + /** List of reactants and products participating in this step. */ + terms: ReactionTerm[]; + /** Environmental parameters required for this specific step. */ + condition?: Condition; + /** External agents or energies influencing the reaction. */ + modifiers?: Array< + /** Chemical agent that increases the reaction rate. */ + | { type: ReactionModifier.CATALYST, value: ReactionTerm } + /** Energy input in the form of heat or light. */ + | { type: ReactionModifier.ENERGY_HEAT | ReactionModifier.ENERGY_LIGHT, value?: number } + /** Environmental pH modifiers. */ + | { type: ReactionModifier.ACID | ReactionModifier.BASE, value?: string } + >; + /** Qualitative notes or descriptors attached to specific terms. */ + annotations?: Array< { + /** The participant being annotated. */ + term: ReactionTerm; + /** Relative position or nature of the annotation. */ + position: ReactionAnnotation; + } >; +}; + +/** Comprehensive description of a multi-step chemical or nuclear process. */ +export type Reaction = { + /** Sequential steps defining the reaction pathway. */ + steps: ReactionStep[]; + /** Global conditions applicable to the entire reaction. */ + condition?: Condition; + /** Molar heat change (enthalpy of reaction) associated with the process. */ + enthalpy?: NumberValue< 'molarEnergy' >; + /** Typographic representation of the reaction equation in LaTeX. */ + latex?: string; + /** Qualitative scientific notes and context. */ + context?: string; + /** Bibliographic evidence supporting the reaction data. */ + references?: RefId[]; +}; + +/** Unique reference identifier for a reaction entry. */ +export type ReactionRef = Brand< string, 'reactionRef' >; + +/** Registry of documented reactions, indexed by unique references. */ +export type ReactionCollection = Collection< { + [ K in ReactionRef ]: Distinct< Reaction >; +} >; diff --git a/model/collection/safety.ts b/model/collection/safety.ts new file mode 100644 index 00000000..0538257a --- /dev/null +++ b/model/collection/safety.ts @@ -0,0 +1,113 @@ +/** + * @file model/collection/safety.ts + * @description Comprehensive safety and regulatory data, including hazard classifications, + * labeling, and toxicological information. + */ + +import type { + ADRClass, DOTClass, GHSClass, GHSPictogram, NFPACode, NFPANotice, Organism, SignalWord, + ToxicityApplication, ToxicityOrganism, ToxicityType, WHMISClass +} from '../../enum/science/safety'; +import type { Collection, Group, Many, One } from '../base/modifier'; +import type { LangGroup } from '../base/primitive'; +import type { PrimitiveProperty, StructProperty } from '../base/property'; +import type { RangeValue, SingleValue } from '../base/value'; + +/** GHS Hazard statement code (H-statement). */ +export type HStatement = `H${ '2' | '3' | '4' | '5' }${ number }`; +/** GHS Precautionary statement code (P-statement). */ +export type PStatement = `P${ '1' | '2' | '3' | '4' | '5' }${ number }`; +/** Supplemental EU-specific hazard statement code. */ +export type EUHStatement = `EUH${ '0' | '2' | '3' | '4' }${ number }`; + +/** Kemler Code or Hazard Identification Number. */ +export type HazardIdentification = `${ 'X' | '' }${ number }`; +/** Four-digit number identifying dangerous goods in international transport. */ +export type UNNumber = `${ '0' | '1' | '2' | '3' | '8' | '9' }${ number }`; + +/** Standardized phrases for describing chemical hazards and precautions. */ +export type HazardStatements = { + /** Globally Harmonized System (GHS) hazard statements. */ + hazard?: HStatement[]; + /** GHS precautionary statements for handling and storage. */ + precautionary?: PStatement[]; + /** Supplemental European Union hazard statements. */ + eu?: EUHStatement[]; +}; + +/** Fire protection association rating for emergency response. */ +export type NFPA = { + /** Level of health hazard. */ + health: NFPACode; + /** Flammability rating. */ + fire: NFPACode; + /** Chemical reactivity or instability rating. */ + reactivity: NFPACode; + /** Special notices for emergency responders. */ + specific?: NFPANotice[]; +}; + +/** Regulatory identification numbers for transport and handling. */ +export type SafetyLabel = { + /** Hazard identification number. */ + hazNo?: HazardIdentification; + /** United Nations substance identification number. */ + unNo?: UNNumber; +}; + +/** Collection of regulatory identifiers and qualitative safety data. */ +export type HazardGroup = Group< { + /** Set of applicable GHS or EU hazard phrases. */ + statements?: One< StructProperty< HazardStatements > >; + /** GHS Signal word (Danger or Warning). */ + signalWord?: One< PrimitiveProperty< SignalWord > >; + /** Visual GHS hazard symbols. */ + pictograms?: Many< PrimitiveProperty< GHSPictogram > >; + /** NFPA 704 'Fire Diamond' ratings. */ + nfpa?: One< StructProperty< NFPA > >; + /** Regulatory classifications across different systems. */ + classes?: Group< { + /** GHS hazard classification. */ + ghs?: Many< PrimitiveProperty< GHSClass > >; + /** Workplace Hazardous Materials Information System classification. */ + whmis?: Many< PrimitiveProperty< WHMISClass > >; + /** European Agreement concerning the International Carriage of Dangerous Goods by Road. */ + adr?: Many< PrimitiveProperty< ADRClass > >; + /** Department of Transportation classification (USA). */ + dot?: Many< PrimitiveProperty< DOTClass > >; + } >; + /** Regulatory labels for transport containers. */ + labels?: Many< StructProperty< SafetyLabel > >; + /** Localized qualitative safety remarks and instructions. */ + remarks?: LangGroup< Many< PrimitiveProperty< string > >, never >; +} >; + +/** Quantitative measure of the adverse effects of a substance on living organisms. */ +export type Toxicity = { + /** Classification of the toxicity endpoint (e.g., LD50, LC50). */ + type: ToxicityType; + /** Route of biological exposure. */ + application?: ToxicityApplication; + /** Biological species or system used in the toxicity test. */ + organism: + | { type: ToxicityOrganism.ORGANISM, value: Organism } + | { type: ToxicityOrganism.OTHER, value: string }; + /** Quantitative toxicological limit or range. */ + value: + | SingleValue< 'massFraction' > + | SingleValue< 'massPerMass' > + | RangeValue< 'massFraction' > + | RangeValue< 'massPerMass' >; + /** Temporal period of exposure during the test. */ + duration?: + | SingleValue< 'time' > + | RangeValue< 'time' >; +}; + +/** Grouping of all safety and toxicological properties. */ +export type SafetyCollection = Collection< { + /** Hazard classification and regulatory labeling data. */ + hazard?: HazardGroup; + /** Quantified toxicological data. */ + toxicity?: Many< StructProperty< Toxicity > >; +} >; diff --git a/model/collection/structure.ts b/model/collection/structure.ts new file mode 100644 index 00000000..bcca8f39 --- /dev/null +++ b/model/collection/structure.ts @@ -0,0 +1,46 @@ +/** + * @file model/collection/structure.ts + * @description Mathematical and string-based representations of chemical structure and nomenclature. + */ + +import type { Collection, Distinct, Group } from '../base/modifier'; + +/** Systematically generated name according to the IUPAC nomenclature rules. */ +export type IUPACName = string; +/** International Chemical Identifier for unambiguous structural representation. */ +export type InChI = `InChI=${ string }`; +/** Fixed-length hashed version of the InChI for database indexing. */ +export type InChIKey = `${ string }-${ string }-${ string }`; +/** Simplified Molecular-Input Line-Entry System (SMILES) notation in canonical form. */ +export type CanonicalSMILES = string; +/** SMILES notation including stereochemical information. */ +export type IsomericSMILES = string; +/** Generic line-entry notation for chemical structures. */ +export type SMILES = string; +/** SMiles ARbitrary Target Specification for molecular pattern matching. */ +export type SMARTS = string; +/** Wiswesser Line Notation, a historical line-entry system for chemical structures. */ +export type WLN = string; + +/** Collection of diverse structural notations and systematic nomenclature. */ +export type StructureCollection = Collection< { + /** Systematic IUPAC name of the entity. */ + iupacName?: Distinct< IUPACName >; + /** Standardized IUPAC InChI string. */ + inChI?: Distinct< InChI >; + /** Hashed InChIKey for rapid searching. */ + inChIkey?: Distinct< InChIKey >; + /** SMILES notations representing the molecular graph. */ + smiles?: Group< { + /** Unique, canonical representation of the structure. */ + canonical?: Distinct< CanonicalSMILES >; + /** Representation including absolute or relative stereochemistry. */ + isomeric?: Distinct< IsomericSMILES >; + /** Non-canonicalized or original SMILES string. */ + raw?: Distinct< SMILES >; + } >; + /** Molecular pattern matching language string. */ + smarts?: Distinct< SMARTS >; + /** Historical structural notation (Wiswesser). */ + wln?: Distinct< WLN >; +} >; diff --git a/model/domain/compound.ts b/model/domain/compound.ts new file mode 100644 index 00000000..32ed0d21 --- /dev/null +++ b/model/domain/compound.ts @@ -0,0 +1,56 @@ +/** + * @file model/domain/compound.ts + * @description Models chemical compounds, focusing on their categorical classification + * and stoichiometric composition. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { CompoundCategory, CompoundClass, CompoundComposition, CompoundProperty } from '../../enum/science/compound'; +import type { Phase } from '../../enum/science/physics'; +import type { SubstanceProperty } from '../../enum/science/substance'; +import type { DomainType } from '../../enum/system/domain'; +import type { Factory } from '../base/factory'; +import type { FormCollection } from '../base/form'; +import type { Collection, Distinct } from '../base/modifier'; +import type { Metadata } from '../utility/meta'; +import type { ComposedSubstance } from './substance'; + +/** Unique identifier for a chemical compound entity. */ +export type CompoundId = Brand< string, 'compoundId' >; + +/** Systematic classification of a chemical compound. */ +export type CompoundClassification = Collection< { + /** Broad scientific category of the compound (e.g., Organic, Inorganic). */ + category: Distinct< CompoundCategory >; + /** Type of chemical composition (e.g., Stoichiometric, Non-stoichiometric). */ + composition: Distinct< CompoundComposition >; + /** Specific chemical class or functional group designation. */ + class: Distinct< CompoundClass >; + /** Standard physical state at STP. */ + phase: Distinct< Phase >; + /** List of primary scientific properties associated with this compound. */ + properties: Distinct< SubstanceProperty | CompoundProperty >[]; +} >; + +/** Representation of a single chemical compound as a composed substance. */ +export type SingleCompound = ComposedSubstance< DomainType.COMPOUND, CompoundClassification >; + +/** Complete data model for a chemical compound, including its various physical forms or phases. */ +export type CompoundData = Expand< SingleCompound & { + /** Collection of distinct physical manifestations or polymorphs of the compound. */ + forms?: FormCollection< SingleCompound >; +} >; + +/** A chemical compound enriched with system and versioning metadata. */ +export type Compound = Metadata< CompoundData >; + +/** Collection of all chemical compounds, indexed by their unique identifiers. */ +export type CompoundDomain = Collection< { + [ key: CompoundId ]: Compound; +} >; + +/** Factory for constructing standardized compound entities. */ +export type CompoundFactory = Factory< DomainType.COMPOUND, CompoundData, { + /** The target compound's unique identifier. */ + compoundId: CompoundId; +} >; diff --git a/model/domain/element.ts b/model/domain/element.ts new file mode 100644 index 00000000..7c319c94 --- /dev/null +++ b/model/domain/element.ts @@ -0,0 +1,68 @@ +/** + * @file model/domain/element.ts + * @description Models the fundamental chemical elements, integrating their periodic + * classification with atomic and substance-level properties. + */ + +import type { Expand } from 'devtypes/types/util'; +import type { + ElementGroup, ElementProperty, ElementSet, ElementSymbol, PeriodicTableColumn, + PeriodicTablePeriod, Subshell +} from '../../enum/science/element'; +import type { Phase } from '../../enum/science/physics'; +import type { SubstanceProperty } from '../../enum/science/substance'; +import type { DomainType } from '../../enum/system/domain'; +import type { Factory } from '../base/factory'; +import type { FormCollection } from '../base/form'; +import type { Collection, Distinct } from '../base/modifier'; +import type { AtomicCollection } from '../collection/atomic'; +import type { Metadata } from '../utility/meta'; +import type { Substance } from './substance'; + +/** Fundamental classification of a chemical element within the periodic system. */ +export type ElementClassification = { + /** Standardized IUPAC chemical symbol of the element. */ + symbol: Distinct< string >; + /** The number of protons in the atomic nucleus. */ + atomicNumber: Distinct< number >; + /** Classification by valence orbital symmetry (s, p, d, f). */ + block: Distinct< Subshell >; + /** Vertical column in the periodic table (group number). */ + column: Distinct< PeriodicTableColumn >; + /** Horizontal row in the periodic table. */ + period: Distinct< PeriodicTablePeriod >; + /** Classification into chemical sets (e.g., Alkali metals, Noble gases). */ + set: Distinct< ElementSet >; + /** Systematic group designation. */ + group: Distinct< ElementGroup >; + /** Standard physical state at STP. */ + phase: Distinct< Phase >; + /** List of primary scientific properties associated with this element. */ + properties: Distinct< SubstanceProperty | ElementProperty >[]; +}; + +/** Representation of a single chemical element as a scientific substance. */ +export type SingleElement = Substance< ElementClassification, { + /** Fundamental nuclear and electronic properties. */ + atomic?: AtomicCollection; +} >; + +/** Complete data model for a chemical element, including its various allotropic or physical forms. */ +export type ElementData = Expand< SingleElement & { + /** Collection of distinct allotropes or physical manifestations of the element. */ + forms?: FormCollection< SingleElement >; +} >; + +/** A chemical element enriched with system and versioning metadata. */ +export type Element = Metadata< ElementData >; + +/** Collection of all chemical elements, indexed by their unique symbols. */ +export type ElementDomain = Collection< { + [ K in ElementSymbol ]: Element; +} >; + +/** Factory for constructing standardized element entities. */ +export type ElementFactory = Factory< DomainType.ELEMENT, ElementData, { + /** The target chemical element's symbol. */ + elementSymbol: ElementSymbol; +} >; diff --git a/model/domain/mineral.ts b/model/domain/mineral.ts new file mode 100644 index 00000000..3022dbb7 --- /dev/null +++ b/model/domain/mineral.ts @@ -0,0 +1,71 @@ +/** + * @file model/domain/mineral.ts + * @description Models minerals and mineraloids, incorporating geological classification + * systems and structural registries. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { MineralClass, MineralProperty, MineralStructure, MineralSubClass } from '../../enum/science/mineral'; +import type { Phase } from '../../enum/science/physics'; +import type { SubstanceProperty } from '../../enum/science/substance'; +import type { DomainType } from '../../enum/system/domain'; +import type { Factory } from '../base/factory'; +import type { FormCollection } from '../base/form'; +import type { Collection, Distinct, Group } from '../base/modifier'; +import type { Metadata } from '../utility/meta'; +import type { ComposedSubstance } from './substance'; + +/** Unique identifier for a mineral species. */ +export type MineralId = Brand< string, 'mineralId' >; + +/** Geological and structural classification of a mineral. */ +export type MineralClassification = Collection< { + /** Primary mineralogical class (e.g., Silicates, Sulfides). */ + class: Distinct< MineralClass >; + /** Specific subclass or division within the mineral class. */ + subclass?: Distinct< MineralSubClass >; + /** Solid solution series to which the mineral belongs. */ + series?: Distinct< string >; + /** Structural arrangement of the mineral lattice. */ + structure: Distinct< MineralStructure >; + /** Mapping of identifiers from international mineralogical classification systems. */ + system: Group< { + /** Official symbol assigned by the International Mineralogical Association. */ + imaSymbol: Distinct< string >; + /** Strunz classification code (8th edition). */ + strunz8?: Distinct< string >; + /** Strunz classification code (9th edition). */ + strunz9?: Distinct< string >; + /** Dana mineral classification code. */ + dana?: Distinct< string >; + /** Lapis mineral classification code. */ + lapis?: Distinct< string >; + } >; + /** Physical state of the mineral (always solid). */ + phase: Distinct< Phase.SOLID >; + /** List of primary scientific properties associated with this mineral. */ + properties: Distinct< SubstanceProperty | MineralProperty >[]; +} >; + +/** Representation of a single mineral species as a composed substance. */ +export type SingleMineral = ComposedSubstance< DomainType.MINERAL, MineralClassification >; + +/** Complete data model for a mineral, including its various physical habits or varieties. */ +export type MineralData = Expand< SingleMineral & { + /** Collection of distinct physical manifestations or varieties of the mineral. */ + forms?: FormCollection< SingleMineral >; +} >; + +/** A mineral enriched with system and versioning metadata. */ +export type Mineral = Metadata< MineralData >; + +/** Collection of all mineral species, indexed by their unique identifiers. */ +export type MineralDomain = Collection< { + [ key: MineralId ]: Mineral; +} >; + +/** Factory for constructing standardized mineral entities. */ +export type MineralFactory = Factory< DomainType.MINERAL, MineralData, { + /** The target mineral's unique identifier. */ + mineralId: MineralId; +} >; diff --git a/model/domain/mixture.ts b/model/domain/mixture.ts new file mode 100644 index 00000000..32f2bc0b --- /dev/null +++ b/model/domain/mixture.ts @@ -0,0 +1,60 @@ +/** + * @file model/domain/mixture.ts + * @description Models chemical mixtures and dispersions, defining their homogeneity + * and physical phase relationships. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { MixtureHomogeneity, MixtureProperty, MixtureSystem, MixtureType } from '../../enum/science/mixture'; +import type { Phase } from '../../enum/science/physics'; +import type { SubstanceProperty } from '../../enum/science/substance'; +import type { DomainType } from '../../enum/system/domain'; +import type { Factory } from '../base/factory'; +import type { FormCollection } from '../base/form'; +import type { Collection, Distinct } from '../base/modifier'; +import type { Metadata } from '../utility/meta'; +import type { ComposedSubstance } from './substance'; + +/** Unique identifier for a chemical mixture entity. */ +export type MixtureId = Brand< string, 'mixtureId' >; + +/** Physical and scientific classification of a mixture. */ +export type MixtureClassification = Collection< { + /** Broad scientific type of the mixture (e.g., Solution, Suspension). */ + type: Distinct< MixtureType >; + /** Degree of uniform distribution of constituents (Homogeneous or Heterogeneous). */ + homogeneity: Distinct< MixtureHomogeneity >; + /** Nature of the mixture system (e.g., Gas-Liquid, Solid-Solid). */ + system: Distinct< MixtureSystem >; + /** Standard physical state at STP. */ + phase: Distinct< Phase >; + /** Physical state of the continuous phase (solvent/medium). */ + mediumPhase?: Distinct< Phase >; + /** Physical state of the dispersed or solute phase. */ + dispersedPhase?: Distinct< Phase >; + /** List of primary scientific properties associated with this mixture. */ + properties: Distinct< SubstanceProperty | MixtureProperty >[]; +} >; + +/** Representation of a single mixture as a composed substance. */ +export type SingleMixture = ComposedSubstance< DomainType.MIXTURE, MixtureClassification >; + +/** Complete data model for a chemical mixture, including its various physical forms. */ +export type MixtureData = Expand< SingleMixture & { + /** Collection of distinct physical manifestations or states of the mixture. */ + forms?: FormCollection< SingleMixture >; +} >; + +/** A chemical mixture enriched with system and versioning metadata. */ +export type Mixture = Metadata< MixtureData >; + +/** Collection of all chemical mixtures, indexed by their unique identifiers. */ +export type MixtureDomain = Collection< { + [ key: MixtureId ]: Mixture; +} >; + +/** Factory for constructing standardized mixture entities. */ +export type MixtureFactory = Factory< DomainType.MIXTURE, MixtureData, { + /** The target mixture's unique identifier. */ + mixtureId: MixtureId; +} >; diff --git a/model/domain/nuclide.ts b/model/domain/nuclide.ts new file mode 100644 index 00000000..4fe6012b --- /dev/null +++ b/model/domain/nuclide.ts @@ -0,0 +1,226 @@ +/** + * @file model/domain/nuclide.ts + * @description Models atomic nuclei (nuclides), defining their nuclear properties, + * isotopic relationships, and decay characteristics. + */ + +import type { Brand } from 'devtypes/types/util'; +import type { ElementSymbol } from '../../enum/science/element'; +import type { DecayMode, SpinParity } from '../../enum/science/nuclear'; +import type { NuclideOrigin, NuclideProperty, NuclideStability, NuclideState } from '../../enum/science/nuclide'; +import type { DomainType } from '../../enum/system/domain'; +import type { Factory } from '../base/factory'; +import type { Collection, Distinct } from '../base/modifier'; +import type { DescriptiveCollection } from '../collection/descriptive'; +import type { GenericCollection } from '../collection/generic'; +import type { HistoryCollection } from '../collection/history'; +import type { MediaCollection } from '../collection/media'; +import type { NuclearCollection } from '../collection/nuclear'; +import type { Metadata } from '../utility/meta'; +import type { Weblinks } from '../utility/weblinks'; + +/** + * Unique identifier for a nuclide, combining the element symbol with its mass number and isomer state. + * + * @template E The chemical element symbol. + */ +export type NuclideId< E extends ElementSymbol = ElementSymbol > = Brand< + `${ E }-${ `${ number }` | `${ number }m` | `${ number }m${ number }` }`, 'nuclideID' +>; + +/** + * Fundamental classification and nuclear parameters of a nuclide. + * + * @template K The chemical element symbol. + */ +export type NuclideClassification< K extends ElementSymbol > = Collection< { + /** The parent chemical element of the nuclide. */ + element: Distinct< K >; + /** The number of protons (Z) in the nucleus. */ + atomicNumber: Distinct< number >; + /** The number of neutrons (N) in the nucleus. */ + neutronNumber: Distinct< number >; + /** The total number of nucleons (A = Z + N). */ + massNumber: Distinct< number >; + /** Excitation state of the nuclide (Ground state or Isomer). */ + state: Distinct< NuclideState >; + /** Nuclear stability classification (Stable or Radioactive). */ + stability: Distinct< NuclideStability >; + /** Natural or artificial origin of the nuclide. */ + origin: Distinct< NuclideOrigin >; + /** The primary physical mode of radioactive decay. */ + mainDecayMode: Distinct< DecayMode | null >; + /** Total angular momentum and parity of the ground state. */ + parity: Distinct< SpinParity >; + /** List of primary scientific properties associated with this nuclide. */ + properties: Distinct< NuclideProperty >[]; +} >; + +/** + * Representation of a single nuclide as a discrete nuclear entity. + * + * @template K The chemical element symbol. + */ +export type SingleNuclide< K extends ElementSymbol > = Collection< { + /** Fundamental nuclear classification data. */ + classification: NuclideClassification< K >; + /** Qualitative observations and localized names. */ + descriptive: DescriptiveCollection; + /** General non-scientific and economic properties. */ + generic?: GenericCollection; + /** Chronological documentation of discovery and characterization. */ + history?: HistoryCollection; + /** Comprehensive nuclear structure and radiation data. */ + nuclear?: NuclearCollection; + /** Visual assets and digital nuclear documentation. */ + media?: MediaCollection; + /** External links to nuclear databases (e.g., ENSDF). */ + weblinks?: Weblinks; +} >; + +/** + * Complete data model for a nuclide. + * + * @template K The chemical element symbol. + */ +export type NuclideData< K extends ElementSymbol > = SingleNuclide< K >; + +/** + * A nuclide enriched with system and versioning metadata. + * + * @template K The chemical element symbol. + */ +export type Nuclide< K extends ElementSymbol > = Metadata< NuclideData< K > >; + +/** Nested collection of all nuclides, categorized by element and nuclide ID. */ +export type NuclideCollection = Collection< { + [ K in ElementSymbol ]?: Collection< { + [ N in NuclideId< K > ]?: Nuclide< K >; + } >; +} >; + +/** + * Factory for constructing standardized nuclide entities. + * + * @template K The chemical element symbol. + */ +export type NuclideFactory< K extends ElementSymbol > = Factory< DomainType.NUCLIDE, NuclideData< K >, { + /** The parent element symbol. */ + element: K; + /** The specific nuclide identifier. */ + nuclide: NuclideId< K >; + /** Number of protons. */ + z: number; + /** Number of neutrons. */ + n: number; +} >; + +/** + * Compact indexing structure for efficient nuclide lookup and data overlays. + * This structure is automatically generated from the primary nuclide dataset. + * + * @template Z The atomic number. + * @template N The neutron number. + */ +export type NuclideIndexEntry< Z extends number, N extends number > = { + /** The target nuclide identifier. */ + nuclide: NuclideId; + /** Proton count. */ + z: Z; + /** Neutron count. */ + n: N; + /** Nucleon count (A). */ + a: number; + /** Parent chemical element. */ + element: ElementSymbol; + /** Selection of pre-calculated nuclear parameters for indexing. */ + layer: { + /** Documented half-life in seconds. */ + halfLife?: number; + /** Primary radioactive decay mode. */ + mainDecayMode?: DecayMode; + /** Minimum number of transitions to reach a stable state. */ + minStepsToStable?: number; + /** Nuclear charge radius. */ + nuclearRadius?: number; + /** Mass excess in energy units. */ + massExcess?: number; + /** Atomic mass of the neutral atom. */ + atomicMass?: number; + /** Average binding energy per nucleon. */ + bindingEnergy?: number; + /** Year of initial discovery or observation. */ + discovery?: number; + }; +}; + +/** + * Multi-dimensional index of all nuclides, organized by Z and N coordinates. + * Used for rendering the nuclide chart and is automatically generated. + */ +export type NuclideIndex = Collection< { + [ Z in number ]?: Collection< { + [ N in number ]?: Distinct< NuclideIndexEntry< Z, N > >; + } >; +} >; + +/** Represents a single link within a nuclear decay chain. */ +export type NuclideDecayChainLink = { + /** Target nuclide in the decay sequence. */ + nuclide: NuclideId; + /** The specific mode of transition. */ + mode: DecayMode; + /** Mathematical probability of the specific decay branch. */ + probability: number | null; +}; + +/** + * Comprehensive entry defining the position of a nuclide within global decay networks. + * These entries are automatically generated by analyzing radioactive transitions. + * + * @template N The nuclide identifier. + */ +export type NuclideDecayChainEntry< N extends NuclideId > = { + /** The specific nuclide identifier. */ + nuclide: N; + /** Proton count. */ + z: number; + /** Neutron count. */ + n: number; + /** Nucleon count. */ + a: number; + /** Parent chemical element. */ + element: ElementSymbol; + /** Half-life of the nuclide or null if stable. */ + halfLife: number | null; + /** Indicates if the nuclide is stable. */ + stable: boolean; + /** Documented transitions to subsequent nuclides. */ + daughterChains: NuclideDecayChainLink[]; + /** Documented transitions from precursor nuclides. */ + parentChains: NuclideDecayChainLink[]; + /** Total number of steps from the initial primordial source. */ + chainDepth: number; + /** Number of steps until reaching a terminal stable nuclide. */ + minStepsToStable: number; + /** Indicates if the nuclide is a terminal point in a decay chain. */ + isTerminal: boolean; +}; + +/** + * Collection of all decay chain data, indexed by nuclide ID. + * This registry is automatically generated to model nuclear transformation pathways. + */ +export type NuclideDecayChains = Collection< { + [ N in NuclideId ]?: Distinct< NuclideDecayChainEntry< N > >; +} >; + +/** The complete nuclide domain, integrating primary data, indices, and decay networks. */ +export type NuclideDomain = Collection< { + /** Registry of detailed nuclide data. */ + nuclides: NuclideCollection; + /** Coordinate-based lookup index (auto-generated). */ + index: NuclideIndex; + /** Network-based radioactive decay chains (auto-generated). */ + decayChains: NuclideDecayChains; +} >; diff --git a/model/domain/substance.ts b/model/domain/substance.ts new file mode 100644 index 00000000..04139c9c --- /dev/null +++ b/model/domain/substance.ts @@ -0,0 +1,78 @@ +/** + * @file model/domain/substance.ts + * @description Abstract base models for all chemical and physical entities, defining the + * shared architectural framework for properties and collections. + */ + +import type { DomainType } from '../../enum/system/domain'; +import type { Collection } from '../base/modifier'; +import type { AbundanceCollection } from '../collection/abundance'; +import type { ChemistryCollection } from '../collection/chemistry'; +import type { CompositionCollection } from '../collection/composition'; +import type { DescriptiveCollection } from '../collection/descriptive'; +import type { FormulaCollection } from '../collection/formula'; +import type { GenericCollection } from '../collection/generic'; +import type { HistoryCollection } from '../collection/history'; +import type { IdentificationCollection } from '../collection/identification'; +import type { MediaCollection } from '../collection/media'; +import type { PhysicsCollection } from '../collection/physics'; +import type { ReactionCollection } from '../collection/reaction'; +import type { SafetyCollection } from '../collection/safety'; +import type { StructureCollection } from '../collection/structure'; +import type { Weblinks } from '../utility/weblinks'; + +/** + * Universal model for a physical or chemical substance, integrating all available scientific collections. + * + * @template C The classification type specific to the entity's scientific domain. + * @template T Additional domain-specific fields to be merged into the substance model. + */ +export type Substance< + C extends Collection< unknown >, + T extends object = {} +> = Collection< { + /** Domain-specific scientific classification and categorization. */ + classification: C; + /** International regulatory and database identifiers. */ + identification?: IdentificationCollection; + /** Mathematical and notation-based structural representations. */ + structure?: StructureCollection; + /** Chemical formula notations and renderings. */ + formula?: FormulaCollection; + /** Qualitative observations and localized nomenclature. */ + descriptive?: DescriptiveCollection; + /** General non-scientific properties. */ + generic?: GenericCollection; + /** Chronological documentation of scientific milestones. */ + history?: HistoryCollection; + /** Fundamental physical properties and state functions. */ + physics?: PhysicsCollection; + /** Core chemical, thermodynamic, and crystallographic parameters. */ + chemistry?: ChemistryCollection; + /** Stoichiometry and transitions of chemical reactions. */ + reaction?: ReactionCollection; + /** Natural prevalence and isotopic abundance data. */ + abundance?: AbundanceCollection; + /** Safety data and toxicological limits. */ + safety?: SafetyCollection; + /** Visual assets, spectra, and digital documentation. */ + media?: MediaCollection; + /** Curated links to external scientific databases and resources. */ + weblinks?: Weblinks; +} & T >; + +/** + * Specialization for substances defined by their internal constituent makeup. + * + * @template D The target scientific domain (Compound, Mineral, Mixture). + * @template C The classification type specific to the entity's scientific domain. + * @template T Additional domain-specific fields to be merged into the substance model. + */ +export type ComposedSubstance< + D extends DomainType, + C extends Collection< unknown >, + T extends object = {} +> = Substance< C, T & { + /** Qualitative and quantitative definition of the substance's constituents. */ + composition: CompositionCollection< D >; +} >; diff --git a/model/index.ts b/model/index.ts new file mode 100644 index 00000000..b9dab056 --- /dev/null +++ b/model/index.ts @@ -0,0 +1,62 @@ +/** + * @file model/index.ts + * @description + * Central entry point for the PSE-Info database schema. This architecture provides a strictly typed, + * scientifically grounded framework for modeling the entire spectrum of chemical and physical entities. + * + * The schema is organized into three primary architectural layers: + * 1. **Domains**: Scientifically delimited data silos representing fundamental entities like chemical + * elements, nuclides, compounds, minerals, and mixtures. + * 2. **Registries**: Centralized repositories for shared scientific metadata, including bibliographic + * references, physical units, organizational data, and digital assets. + * 3. **Base/Utility**: Core technical primitives and modifiers that ensure data integrity, versioning, + * and automated schema generation. + * + * This model prioritizes scientific accuracy and data normalization, facilitating the construction + * of a comprehensive knowledge graph for the chemical sciences. + */ + +import type { Collection, Group } from './base/modifier'; +import type { CompoundDomain } from './domain/compound'; +import type { ElementDomain } from './domain/element'; +import type { MineralDomain } from './domain/mineral'; +import type { MixtureDomain } from './domain/mixture'; +import type { NuclideDomain } from './domain/nuclide'; +import type { BlobRegistry } from './registry/blob'; +import type { OrganizationRegistry } from './registry/organization'; +import type { PersonRegistry } from './registry/person'; +import type { ReferenceRegistry } from './registry/reference'; +import type { UnitRegistry } from './registry/unit'; +import type { DBMeta } from './utility/meta'; + +/** The complete database model, integrating all scientific domains and registries. */ +export type Database = Collection< { + /** Repository-wide metadata, versioning information, and system statistics. */ + meta: DBMeta; + /** Categorized scientific domains containing the core data entities. */ + domains: Group< { + /** Primary database of chemical elements and their periodic properties. */ + elements: ElementDomain; + /** Comprehensive registry of atomic nuclei, isotopes, and decay networks. */ + nuclides: NuclideDomain; + /** Registry of chemical compounds classified by category and class. */ + compounds: CompoundDomain; + /** Mineralogical database including structural and geological classifications. */ + minerals: MineralDomain; + /** Registry of homogeneous and heterogeneous chemical mixtures. */ + mixtures: MixtureDomain; + } >; + /** Centralized scientific registries for shared metadata and assets. */ + registries: Group< { + /** Storage registry for binary assets, spectra, and visual models. */ + blobs: BlobRegistry; + /** Registry for physical units, measurement systems, and conversion factors. */ + units: UnitRegistry; + /** Bibliographic citation registry for scientific peer-reviewed sources. */ + references: ReferenceRegistry; + /** Registry of research institutions, laboratories, and organizations. */ + orgs: OrganizationRegistry; + /** Registry of scientific contributors and historical researchers. */ + persons: PersonRegistry; + } >; +} >; diff --git a/model/registry/blob.ts b/model/registry/blob.ts new file mode 100644 index 00000000..4a7ad50d --- /dev/null +++ b/model/registry/blob.ts @@ -0,0 +1,88 @@ +/** + * @file model/registry/blob.ts + * @description Registry for binary assets, supporting diverse scientific data formats and storage methods. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { BlobEncoding, BlobType, MimeType, StorageType } from '../../enum/system/blob'; +import type { RegistryType } from '../../enum/system/domain'; +import type { Factory } from '../base/factory'; +import type { Collection, Distinct } from '../base/modifier'; +import type { IsoDate, UrlString } from '../base/primitive'; +import type { Attribution } from '../utility/attribution'; + +/** + * Mapping of scientific data types to their authoritative Internet Media Types (MIME). + * + * @template T The architectural type of the binary asset. + */ +export type AllowedMimeTypes< T extends BlobType > = + T extends BlobType.IMAGE | BlobType.FORMULA | BlobType.SPECTRUM + ? MimeType.PNG | MimeType.JPEG | MimeType.GIF | MimeType.SVG | MimeType.WEBP + : T extends BlobType.MODEL_3D + ? MimeType.PDB | MimeType.MOL | MimeType.SDF | MimeType.XYZ | MimeType.CIF + : T extends BlobType.DOCUMENT + ? MimeType.PDF | MimeType.TXT + : T extends BlobType.DATA + ? MimeType.JSON | MimeType.XML | MimeType.CSV + : T extends BlobType.OTHER + ? MimeType.STREAM + : never; + +/** + * Structural model for a binary asset, including its physical storage and descriptive metadata. + * + * @template T The architectural type of the binary asset. + */ +export type Blob< T extends BlobType > = Expand< Brand< { + /** The media type standard used for the binary data. */ + mimeType: AllowedMimeTypes< T >; + /** Method used to retrieve or reference the binary content. */ + storage: + /** Data is embedded directly as a string or base64. */ + | { type: StorageType.RAW, value: string } + /** Data is stored at a specific file path within the repository. */ + | { type: StorageType.PATH, value: string } + /** Data is accessible via a remote URL. */ + | { type: StorageType.URL, value: UrlString }; + /** The character or binary encoding of the data (e.g., UTF-8). */ + encoding: BlobEncoding; + /** Total size of the asset in bytes. */ + size?: number; + /** Cryptographic fingerprint for data integrity verification. */ + hash?: string; + /** Concise descriptive label for the asset. */ + title?: string; + /** Detailed summary of the asset's content and purpose. */ + description?: string; + /** Qualitative technical notes regarding the data. */ + notes?: string; + /** Authorship and licensing information for the asset. */ + attribution?: Attribution; + /** Timestamp of the asset's initial creation or ingestion. */ + created?: IsoDate; +}, T, 'type', true > >; + +/** + * Unique identifier for a binary asset, branded by its data type. + * + * @template T The architectural type of the binary asset. + */ +export type BlobId< T extends BlobType > = Brand< string, `blobId:${ T }` >; + +/** System-wide collection of binary assets indexed by their type and unique IDs. */ +export type BlobRegistry = Collection< { + [ T in BlobType ]?: { + [ K in BlobId< T > ]: Distinct< Blob< T > >; + }; +} >; + +/** + * Helper type for generating type-safe binary asset entries for the database. + * + * @template T The architectural type of the binary asset. + */ +export type BlobFactory< T extends BlobType > = Factory< RegistryType.BLOB, Blob< T >, { + /** Unique registry identifier of the binary asset. */ + blobId: BlobId< T >; +} >; diff --git a/model/registry/organization.ts b/model/registry/organization.ts new file mode 100644 index 00000000..cad381e5 --- /dev/null +++ b/model/registry/organization.ts @@ -0,0 +1,44 @@ +/** + * @file model/registry/organization.ts + * @description Registry of scientific institutions, laboratories, and organizations + * contributing to research and data. + */ + +import type { Brand } from 'devtypes/types/util'; +import type { RegistryType } from '../../enum/system/domain'; +import type { CountryCode } from '../../enum/system/locale'; +import type { OrganizationType } from '../../enum/system/organization'; +import type { Factory } from '../base/factory'; +import type { Collection, Distinct } from '../base/modifier'; +import type { Weblinks } from '../utility/weblinks'; +import type { RefId } from './reference'; + +/** Structural model for representing a scientific institution or group. */ +export type Organization = { + /** Full official name of the organization. */ + name: string; + /** Commonly used abbreviation or acronym (e.g., 'CERN'). */ + shortName?: string; + /** The primary geographic location of the organization's headquarters. */ + country?: CountryCode; + /** Classification of the organization (e.g., University, Laboratory). */ + type?: OrganizationType; + /** Digital resources and official web presence of the organization. */ + weblinks?: Weblinks; + /** Bibliographic citations for this entry. */ + references?: RefId[]; +}; + +/** Unique identifier for an organization within the registry. */ +export type OrgId = Brand< string, 'orgId' >; + +/** System-wide collection of scientific organizations indexed by their unique IDs. */ +export type OrganizationRegistry = Collection< { + [ K in OrgId ]: Distinct< Organization >; +} >; + +/** Helper type for generating type-safe organization entries for the database. */ +export type OrganizationFactory = Factory< RegistryType.ORGANIZATION, Organization, { + /** Unique registry identifier of the organization. */ + orgId: OrgId; +} >; diff --git a/model/registry/person.ts b/model/registry/person.ts new file mode 100644 index 00000000..900331dd --- /dev/null +++ b/model/registry/person.ts @@ -0,0 +1,57 @@ +/** + * @file model/registry/person.ts + * @description Registry of scientists, researchers, and contributors associated with the data. + */ + +import type { Brand } from 'devtypes/types/util'; +import type { RegistryType } from '../../enum/system/domain'; +import type { CountryCode } from '../../enum/system/locale'; +import type { Gender } from '../../enum/system/person'; +import type { Factory } from '../base/factory'; +import type { Collection, Distinct } from '../base/modifier'; +import type { Weblinks } from '../utility/weblinks'; +import type { OrgId } from './organization'; +import type { RefId } from './reference'; + +/** Structural model for representing an individual researcher or contributor. */ +export type Person = { + /** Full nomenclature of the individual. */ + name: { + /** The complete name as it appears in scientific publications. */ + fullName: string; + /** The hereditary name or surname. */ + familyName?: string; + /** The individual name or first name. */ + givenName?: string; + /** Alternative names used in literature. */ + aliases?: string[]; + }; + /** Administrative gender metadata for demographic classification. */ + gender?: Gender; + /** Geographic origin or primary citizenship of the individual. */ + nationality?: CountryCode; + /** Year of birth. */ + birthYear?: number; + /** Year of death. */ + deathYear?: number; + /** List of institutions with which the individual is or was affiliated. */ + organization?: OrgId[]; + /** Digital resources and professional profiles. */ + weblinks?: Weblinks; + /** Bibliographic citations for this person. */ + references?: RefId[]; +}; + +/** Unique identifier for a person within the registry. */ +export type PersonId = Brand< string, 'personId' >; + +/** System-wide collection of individuals indexed by their unique IDs. */ +export type PersonRegistry = Collection< { + [ K in PersonId ]: Distinct< Person >; +} >; + +/** Helper type for generating type-safe person entries for the database. */ +export type PersonFactory = Factory< RegistryType.PERSON, Person, { + /** Unique registry identifier of the person. */ + personId: PersonId; +} >; diff --git a/model/registry/reference.ts b/model/registry/reference.ts new file mode 100644 index 00000000..5a00c778 --- /dev/null +++ b/model/registry/reference.ts @@ -0,0 +1,231 @@ +/** + * @file model/registry/reference.ts + * @description Bibliographic registry supporting standard BibTeX reference types for + * citing scientific literature and data sources. + */ + +import type { RequireAtLeastOne, RequireExactlyOneFrom } from 'devtypes/types/constraint'; +import type { Brand, Expand } from 'devtypes/types/util'; +import type { RegistryType } from '../../enum/system/domain'; +import type { LangCode } from '../../enum/system/locale'; +import type { ReferenceType } from '../../enum/system/reference'; +import type { Factory } from '../base/factory'; +import type { Collection, Distinct } from '../base/modifier'; +import type { IsoDate, UrlString } from '../base/primitive'; + +/** + * Structural framework for bibliographic entries, integrating digital identifiers and language metadata. + * + * @template R The specific type of bibliographic reference. + */ +type BaseReference< R extends ReferenceType > = Brand< { + /** Digital Object Identifier (DOI) for the referenced work. */ + doi?: `doi:${ string }`; + /** Direct digital location (URL) of the referenced work. */ + url?: UrlString; + /** Timestamp of the last digital access to the resource. */ + accessed?: IsoDate; + /** The primary language of the referenced work. */ + language?: LangCode; +}, R, 'type', true >; + +/** Fundamental bibliographic fields shared across most reference types. */ +type CoreFields = { + /** The full title of the referenced work. */ + title?: string; + /** The year of publication or release. */ + year?: number | string; + /** The month of publication or release. */ + month?: string; + /** Additional qualitative information regarding the reference. */ + note?: string; +}; + +/** Fields for identifying individuals responsible for the work. */ +type PersonFields = { + /** List of primary authors responsible for the content. */ + author?: string | string[]; + /** List of editors responsible for the publication. */ + editor?: string | string[]; +}; + +/** Fields for specifying the physical or digital location within a larger work. */ +type LocFields = { + /** The volume of a journal, periodical, or multi-volume book. */ + volume?: number | string; + /** The specific issue number of a journal or technical report. */ + number?: number | string; + /** Page range or specific page identifiers within the larger work. */ + pages?: number | string; + /** Specific chapter number or title within a book. */ + chapter?: string; +}; + +/** Fields for identifying the publication venue, publisher, or institution. */ +type VenueFields = { + /** The official name of the scientific journal. */ + journal?: string; + /** The title of the book if the reference is a part of it. */ + booktitle?: string; + /** The organization or company responsible for publication. */ + publisher?: string; + /** The institution hosting a conference or scientific event. */ + organization?: string; + /** The organization sponsoring or issuing a technical report. */ + institution?: string; + /** The academic institution where a thesis was submitted. */ + school?: string; +}; + +/** Secondary metadata for specific bibliographic reference types. */ +type MetaFields = { + /** Geographic location of the publisher or conference venue. */ + address?: string; + /** The version or edition identifier of a book. */ + edition?: string; + /** The title of a series if the work is part of a larger collection. */ + series?: string; + /** Description of the publication method for non-standard or unconventional works. */ + howpublished?: string; + /** International Standard Book Number (ISBN). */ + isbn?: string; + /** Specific classification of a technical report or academic thesis. */ + reportType?: string; +}; + +/** Aggregated collection of all bibliographic data fields. */ +type Fields = CoreFields & PersonFields & LocFields & VenueFields & MetaFields; + +/** Helper for marking a bibliographic field as required. */ +type Req< K extends keyof Fields > = Required< Pick< Fields, K > >; +/** Helper for marking a bibliographic field as optional. */ +type Opt< K extends keyof Fields > = Pick< Fields, K >; + +/** Basic requirements for most formal publications. */ +type CoreBase = Req< 'title' | 'year' > & Opt< 'month' | 'note' >; +/** Requirements for works defined by their authorship. */ +type Authored = CoreBase & Req< 'author' >; +/** Location parameters for periodicals and series. */ +type VolNum = Opt< 'volume' | 'number' >; +/** Structural base for conference-related citations. */ +type ConfBase = Authored & VolNum & Req< 'booktitle' > & Opt< 'editor' | 'series' | 'pages' | 'address' | 'organization' | 'publisher' >; +/** Structural base for academic theses and dissertations. */ +type ThesisBase = Authored & Req< 'school' > & Opt< 'reportType' | 'address' >; + +/** Citation for a scientific article in a journal or periodical. */ +export type ArticleReference = Expand< + BaseReference< ReferenceType.ARTICLE > & + Authored & VolNum & + Req< 'journal' > & Opt< 'pages' > +>; + +/** Citation for a published book or monograph. */ +export type BookReference = Expand< + BaseReference< ReferenceType.BOOK > & + CoreBase & VolNum & + Req< 'publisher' > & Opt< 'series' | 'address' | 'edition' | 'isbn' > & + RequireExactlyOneFrom< Fields, 'author' | 'editor' > +>; + +/** Citation for a printed work without a formal publisher or sponsoring institution. */ +export type BookletReference = Expand< + BaseReference< ReferenceType.BOOKLET > & + Req< 'title' > & Opt< 'author' | 'howpublished' | 'address' | 'month' | 'year' | 'note' > +>; + +/** Citation for papers presented at scientific conferences (BibTeX alias). */ +export type ConferenceReference = Expand< BaseReference< ReferenceType.CONFERENCE > & ConfBase >; + +/** Citation for a specific part or chapter of a book, usually without its own title. */ +export type InbookReference = Expand< + BaseReference< ReferenceType.INBOOK > & + CoreBase & VolNum & + Req< 'publisher' > & Opt< 'series' | 'reportType' | 'address' | 'edition' > & + RequireExactlyOneFrom< Fields, 'author' | 'editor' > & + RequireAtLeastOne< Fields, 'chapter' | 'pages' > +>; + +/** Citation for a part of a book having its own title and usually its own authors. */ +export type IncollectionReference = Expand< + BaseReference< ReferenceType.INCOLLECTION > & + Authored & VolNum & + Req< 'booktitle' | 'publisher' > & + Opt< 'editor' | 'series' | 'reportType' | 'chapter' | 'pages' | 'address' | 'edition' > +>; + +/** Citation for a paper in the published proceedings of a conference or symposium. */ +export type InproceedingsReference = Expand< BaseReference< ReferenceType.INPROCEEDINGS > & ConfBase >; + +/** Citation for technical documentation or user manuals. */ +export type ManualReference = Expand< + BaseReference< ReferenceType.MANUAL > & + Req< 'title' > & + Opt< 'author' | 'organization' | 'address' | 'edition' | 'month' | 'note' | 'year' > +>; + +/** Citation for a thesis submitted for a Master's degree. */ +export type MastersthesisReference = Expand< BaseReference< ReferenceType.MASTERSTHESIS > & ThesisBase >; + +/** General citation for an academic thesis not covered by specific categories. */ +export type ThesisReference = Expand< BaseReference< ReferenceType.THESIS > & ThesisBase >; + +/** Citation for a dissertation submitted for a doctoral degree. */ +export type PhdthesisReference = Expand< BaseReference< ReferenceType.PHDTHESIS > & ThesisBase >; + +/** Citation for works that do not fit into other standard categories. */ +export type MiscReference = Expand< + BaseReference< ReferenceType.MISC > & + Opt< 'author' | 'title' | 'howpublished' | 'month' | 'year' | 'note' > +>; + +/** Citation for the published proceedings of a conference or workshop. */ +export type ProceedingsReference = Expand< + BaseReference< ReferenceType.PROCEEDINGS > & + CoreBase & VolNum & + Opt< 'editor' | 'series' | 'address' | 'organization' | 'publisher' > +>; + +/** Citation for a technical report issued by an institution or organization. */ +export type TechreportReference = Expand< + BaseReference< ReferenceType.TECHREPORT > & + Authored & + Req< 'institution' > & Opt< 'reportType' | 'note' | 'number' | 'address' > +>; + +/** Citation for a work that has not yet been formally published. */ +export type UnpublishedReference = Expand< + BaseReference< ReferenceType.UNPUBLISHED > & + Req< 'author' | 'title' | 'note' > & Opt< 'month' | 'year' > +>; + +/** Union of all supported bibliographic reference models. */ +export type Reference = + | ArticleReference + | BookReference + | BookletReference + | ConferenceReference + | InbookReference + | IncollectionReference + | InproceedingsReference + | ManualReference + | MastersthesisReference + | ThesisReference + | MiscReference + | PhdthesisReference + | ProceedingsReference + | TechreportReference + | UnpublishedReference; + +/** Unique identifier for a bibliographic entry within the registry. */ +export type RefId = Brand< string, 'refId' >; + +/** System-wide collection of bibliographic references indexed by their unique IDs. */ +export type ReferenceRegistry = Collection< { + [ K in RefId ]: Distinct< Reference >; +} >; + +/** Helper type for generating type-safe bibliographic entries for the database. */ +export type ReferenceFactory = Factory< RegistryType.REFERENCE, Reference, { + /** Unique registry identifier of the bibliographic reference. */ + refId: RefId; +} >; diff --git a/model/registry/unit.ts b/model/registry/unit.ts new file mode 100644 index 00000000..6999e9f7 --- /dev/null +++ b/model/registry/unit.ts @@ -0,0 +1,157 @@ +/** + * @file model/registry/unit.ts + * @description Core definitions for the measurement system, including physical quantities, + * SI dimensions, and unit conversions. + */ + +import type { Brand, Expand } from 'devtypes/types/util'; +import type { RegistryType } from '../../enum/system/domain'; +import type { MeasurementSystem } from '../../enum/system/unit'; +import type { Factory } from '../base/factory'; +import type { Collection, Distinct } from '../base/modifier'; +import type { LangGroup } from '../base/primitive'; + +/** Import defined physical quantities and their units. */ +import ValidUnits from '../../config/units'; + +/** Key identifier for a measurable physical property. */ +export type PhysicalQuantity = keyof typeof ValidUnits; +/** The complete set of unit configurations defined in the database. */ +export type ValidUnits = typeof ValidUnits; + +/** Representation of dimensionless quantities or counts. */ +export type NoUnit = never; + +/** + * Vector of seven exponents representing the International System of Units (SI) base dimensions. + * Order: [Time, Length, Mass, Electric Current, Temperature, Amount of Substance, Luminous Intensity] + */ +export type DimensionVector = readonly [ + T: number, L: number, M: number, I: number, Θ: number, N: number, J: number +]; + +/** The set of seven base quantities defined by the International System of Units (SI). */ +export type SIDimension = ( typeof SIDimension )[ number ]; +export const SIDimension = [ + 'time', 'length', 'mass', 'electricCurrent', 'temperature', + 'amountOfSubstance', 'luminousIntensity' +] as const; + +/** Standard SI decimal prefixes and their associated scale factors. */ +export type SIPrefix = keyof typeof SIPrefix; +export const SIPrefix = { + Y: 1e24, Z: 1e21, E: 1e18, P: 1e15, T: 1e12, G: 1e9, M: 1e6, + k: 1e3, h: 1e2, da: 1e1, d: 1e-1, c: 1e-2, m: 1e-3, µ: 1e-6, + n: 1e-9, p: 1e-12, f: 1e-15, a: 1e-18, z: 1e-21, y: 1e-24 +} as const; + +/** Low-level structural configuration for a physical quantity registry. */ +export type UnitConfig = Readonly< Record< string, { + /** Typographic symbol of the physical quantity. */ + symbol: string; + /** Dimensional exponents in the SI system. */ + vector: DimensionVector | null; + /** Set of supported unit symbols for this quantity. */ + units: string[]; + /** Subset of unit symbols compatible with SI prefixes. */ + prefixableUnits: string[]; + /** Primary unit symbol used for internal calculations. */ + baseUnit: string; +} > >; + +/** The set of unit symbols natively supported for a specific quantity. */ +type BaseUnitSymbols< Q extends PhysicalQuantity > = ValidUnits[ Q ][ 'units' ][ number ]; +/** The subset of units that can be combined with SI prefixes. */ +type PrefixableUnitSymbols< Q extends PhysicalQuantity > = ValidUnits[ Q ][ 'prefixableUnits' ][ number ]; +/** All possible combinations of units and SI prefixes for a quantity. */ +type PrefixedSymbols< Q extends PhysicalQuantity > = + | BaseUnitSymbols< Q > + | `${ SIPrefix }${ PrefixableUnitSymbols< Q > }`; + +/** + * Quantitative relationship between a specific unit and the SI base unit. + * + * @template T Indicates if the unit is a base unit. + */ +type ConversionField< T extends boolean > = T extends true ? {} : { + /** Mathematical factors for converting the unit to the SI base. */ + conversion: { + /** Multiplier for the unit value. */ + factor: number; + /** Constant offset for non-proportional conversions (e.g., Celsius to Kelvin). */ + offset?: number; + }; +}; + +/** + * Detailed definition of a measurement unit, including its name and conversion factors. + * + * @template Q The physical quantity to which the unit belongs. + * @template U The unit symbol. + * @template isBase Indicates if this is the quantity's reference unit. + */ +export type Unit< + Q extends PhysicalQuantity, U extends BaseUnitSymbols< Q >, + isBase extends boolean = U extends ValidUnits[ Q ][ 'baseUnit' ] ? true : false +> = Expand< Brand< { + /** Localized name of the unit. */ + name: LangGroup; + /** Typographic representation of the unit symbol in LaTeX. */ + latex: string; + /** Indicates if the unit is the primary reference unit for its quantity. */ + isBase: isBase; + /** Indicates if the unit can be used with SI prefixes. */ + prefixable: U extends PrefixableUnitSymbols< Q > ? true : false; + /** The measurement system to which the unit belongs (e.g., Metric, Imperial). */ + system?: MeasurementSystem; +} & ConversionField< isBase >, U, 'symbol', true > >; + +/** + * Comprehensive definition of a physical property, its dimensions, and associated units. + * + * @template Q The physical quantity of the property. + */ +export type Quantity< Q extends PhysicalQuantity > = Expand< Brand< { + /** The mathematical dimensionality of the physical property. */ + dimension: { + /** Indicates if the quantity is one of the seven SI base dimensions. */ + si: Q extends SIDimension ? true : false; + /** Exponents representing the SI base dimensions. */ + vector: ValidUnits[ Q ][ 'vector' ]; + }; + /** Localized name of the physical quantity. */ + name: LangGroup; + /** Typographic representation of the quantity symbol in LaTeX. */ + latex: string; + /** The symbol of the primary reference unit for this quantity. */ + baseUnit: ValidUnits[ Q ][ 'baseUnit' ]; + /** The collection of all supported units for this specific quantity. */ + units: { + [ U in BaseUnitSymbols< Q > ]: Unit< Q, U >; + }; +}, ValidUnits[ Q ][ 'symbol' ], 'symbol', true > >; + +/** + * Unique identifier for a unit, comprising the quantity and the specific prefixed symbol. + * + * @template Q The physical quantity of the unit. + */ +export type UnitId< Q extends PhysicalQuantity = PhysicalQuantity > = Brand< + [ Q, PrefixedSymbols< Q > ], + `unitId:${ Q }` +>; + +/** System-wide collection of physical quantities indexed by their identifiers. */ +export type UnitRegistry = Collection< { + [ Q in PhysicalQuantity ]?: Distinct< Quantity< Q > >; +} >; + +/** + * Helper type for generating type-safe unit definitions for the database. + * + * @template Q The physical quantity of the unit. + */ +export type UnitFactory< Q extends PhysicalQuantity > = Factory< RegistryType.UNIT, Quantity< Q >, { + /** The physical quantity identifier. */ + quantity: Q; +} >; diff --git a/model/utility/attribution.ts b/model/utility/attribution.ts new file mode 100644 index 00000000..4440d32d --- /dev/null +++ b/model/utility/attribution.ts @@ -0,0 +1,20 @@ +/** + * @file model/utility/attribution.ts + * @description Manages authorship, licensing, and access metadata for external resources, especially images. + */ + +import type { IsoDate, UrlString } from '../base/primitive'; + +/** Structured attribution for copyrighted resources. */ +export type Attribution = { + /** The individual or group responsible for the creation of the resource. */ + author?: string; + /** The legal framework under which the resource is made available (e.g., CC BY 4.0). */ + license: string; + /** Required acknowledgement of original creators or institutions. */ + credits: string; + /** Timestamp indicating when the resource was last retrieved or verified. */ + accessed?: IsoDate; + /** Direct digital location (URL) where the original resource can be found. */ + source?: UrlString; +}; diff --git a/model/utility/meta.ts b/model/utility/meta.ts new file mode 100644 index 00000000..10bab680 --- /dev/null +++ b/model/utility/meta.ts @@ -0,0 +1,58 @@ +/** + * @file model/utility/meta.ts + * @description System-level metadata for versioning, tracking modifications, and ensuring database integrity. + */ + +import type { Expand } from 'devtypes/types/util'; +import type { Collection, Distinct } from '../base/modifier'; +import type { IsoDate, RepoBase } from '../base/primitive'; + +/** + * Structural wrapper that enriches a data collection with administrative tracking information. + * + * @template T The collection structure being enriched with metadata. + */ +export type Metadata< T extends Collection< unknown > > = Expand< T & { + /** Internal administrative tracking data. */ + '@metadata': Distinct< { + /** The version of the database schema used to define the entity. */ + readonly schemaVersion: 1; + /** Timestamp of the most recent modification to the entity's source file. */ + lastModified: IsoDate; + /** A stable URI pointing to the specific version of the entity in the source repository. */ + permalink: `${ RepoBase }/blob/${ string }/data/${ string }.ts` + /** The unique identifier of the version control commit that last modified the file. */ + commit: string; + /** Cryptographic fingerprint of the file's content to ensure data integrity. */ + hash: string; + } >; +} >; + +/** + * High-level descriptive and administrative metadata for the entire database instance. + */ +export type DBMeta = Distinct< { + /** The version of the database schema used for the overall structure. */ + readonly schemaVersion: 1; + /** The general license governing the use of the database. */ + readonly license: 'MIT'; + /** Concise name of the database instance. */ + title: Distinct< string >; + /** Detailed summary of the database's scientific scope and purpose. */ + description: Distinct< string >; + /** Semantic version of the database release. */ + version: string; + /** Internal tracking identifier for the current database state. */ + revision: string; + /** Timestamp of the last database-wide update. */ + lastModified: IsoDate; + /** List of individuals who have provided data or technical maintenance. */ + contributors: Array< { + /** GitHub username of the contributor. */ + name: string; + /** Public email address or website URL of the contributor. */ + contact?: string; + } >; + /** Stable URI pointing to the specific release version of the database. */ + permalink: `${ RepoBase }/releases/tag/v${ string }` +} >; diff --git a/model/utility/weblinks.ts b/model/utility/weblinks.ts new file mode 100644 index 00000000..edff5b23 --- /dev/null +++ b/model/utility/weblinks.ts @@ -0,0 +1,28 @@ +/** + * @file model/utility/weblinks.ts + * @description External digital resources and encyclopedia references associated with an entity. + */ + +import type { LangCode } from '../../enum/system/locale'; +import type { IsoDate, LangGroup, UrlString } from '../base/primitive'; + +/** Collection of URLs and structured links to external scientific information. */ +export type Weblinks = { + /** List of supplementary web resources providing additional context or data. */ + links?: Array< { + /** Direct address of the external web resource. */ + url: UrlString; + /** Descriptive name of the linked resource. */ + title?: string; + /** Summary of the information available at the linked location. */ + description?: string; + /** Link to a persistent web archive to prevent link rot (e.g. https://web.archive.org/). */ + archiveUrl?: UrlString; + /** Timestamp of the last successful verification of the external link. */ + accessed?: IsoDate; + /** The primary language used in the linked resource. */ + language?: LangCode; + } >; + /** Grouping of Wikipedia references across different language editions. */ + wiki?: LangGroup; +}; diff --git a/package-lock.json b/package-lock.json index 43607abb..36558988 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,20 +1,17 @@ { "name": "@pseinfo/database-schema", - "version": "0.6.6", + "version": "0.7.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pseinfo/database-schema", - "version": "0.6.6", + "version": "0.7.0", "license": "MIT", "dependencies": { "devtypes": "^2.1.0" }, "devDependencies": { - "ajv": "^8.18.0", - "json-stable-stringify": "^1.3.0", - "ts-json-schema-generator": "^2.9.0", "typedoc": "^0.28.19", "typedoc-github-theme": "^0.4.0", "typedoc-plugin-missing-exports": "^4.1.3", @@ -94,13 +91,6 @@ "@types/unist": "*" } }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", @@ -108,23 +98,6 @@ "dev": true, "license": "MIT" }, - "node_modules/ajv": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", - "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -155,84 +128,6 @@ "node": "18 || 20 || >=22" } }, - "node_modules/call-bind": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", - "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "get-intrinsic": "^1.3.0", - "set-function-length": "^1.2.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/commander": { - "version": "14.0.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", - "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=20" - } - }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/devtypes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/devtypes/-/devtypes-2.1.0.tgz", @@ -242,21 +137,6 @@ "node": ">=18.0.0" } }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -270,239 +150,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-errors": "^1.3.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", - "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", - "dev": true, - "license": "MIT", - "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/glob": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", - "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "minimatch": "^10.2.2", - "minipass": "^7.1.3", - "path-scurry": "^2.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dev": true, - "license": "MIT", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz", - "integrity": "sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "isarray": "^2.0.5", - "jsonify": "^0.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", - "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", - "dev": true, - "license": "Public Domain", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/linkify-it": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", @@ -513,16 +160,6 @@ "uc.micro": "^2.0.0" } }, - "node_modules/lru-cache": { - "version": "11.3.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.3.5.tgz", - "integrity": "sha512-NxVFwLAnrd9i7KUBxC4DrUhmgjzOs+1Qm50D3oF1/oL+r1NpZ4gA7xvG0/zJ8evR7zIKn4vLf7qTNduWFtCrRw==", - "dev": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": "20 || >=22" - } - }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -548,16 +185,6 @@ "markdown-it": "bin/markdown-it.mjs" } }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", @@ -581,53 +208,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/minipass": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", - "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", - "dev": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/path-scurry": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", - "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/punycode.js": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", @@ -638,88 +218,6 @@ "node": ">=6" } }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/safe-stable-stringify": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", - "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dev": true, - "license": "MIT", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/ts-json-schema-generator": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-2.9.0.tgz", - "integrity": "sha512-NR5ZE108uiPtBHBJNGnhwoUaUx5vWTDJzDFG9YlRoqxPU76n+5FClRh92dcGgysbe1smRmYalM9Saj97GW1J4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.15", - "commander": "^14.0.3", - "glob": "^13.0.6", - "json5": "^2.2.3", - "normalize-path": "^3.0.0", - "safe-stable-stringify": "^2.5.0", - "tslib": "^2.8.1", - "typescript": "^5.9.3" - }, - "bin": { - "ts-json-schema-generator": "bin/ts-json-schema-generator.js" - }, - "engines": { - "node": ">=22.0.0" - } - }, - "node_modules/ts-json-schema-generator/node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, - "license": "0BSD" - }, "node_modules/typedoc": { "version": "0.28.19", "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.19.tgz", diff --git a/package.json b/package.json index b2971973..2a81b53a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@pseinfo/database-schema", "description": "TypeScript type declarations for the @pseinfo database", - "version": "0.6.6", + "version": "0.7.0", "license": "MIT", "author": { "name": "Paul Köhler", @@ -24,6 +24,7 @@ "elements", "compounds", "minerals", + "mixtures", "nuclides", "types", "typescript", @@ -31,59 +32,58 @@ "pseinfo" ], "files": [ + "config", "enum", - "types", - "src", + "model", "README.md", "LICENSE" ], "type": "module", "exports": { ".": { - "types": "./types/index.ts", - "default": "./types/index.ts", - "import": "./types/index.ts" - }, - "./abstract/*": { - "types": "./types/abstract/*.ts", - "default": "./types/abstract/*.ts", - "import": "./types/abstract/*.ts" - }, - "./collection/*": { - "types": "./types/collection/*.ts", - "default": "./types/collection/*.ts", - "import": "./types/collection/*.ts" - }, - "./entity/*": { - "types": "./types/entity/*.ts", - "default": "./types/entity/*.ts", - "import": "./types/entity/*.ts" + "types": "./model/index.ts", + "default": "./model/index.ts", + "import": "./model/index.ts" }, "./enum/*": { "types": "./enum/*.ts", "default": "./enum/*.ts", "import": "./enum/*.ts" }, - "./schema.json": { - "default": "./src/schema.json", - "import": "./src/schema.json" + "./base/*": { + "types": "./model/base/*.ts", + "default": "./model/base/*.ts", + "import": "./model/base/*.ts" + }, + "./collection/*": { + "types": "./model/collection/*.ts", + "default": "./model/collection/*.ts", + "import": "./model/collection/*.ts" + }, + "./domain/*": { + "types": "./model/domain/*.ts", + "default": "./model/domain/*.ts", + "import": "./model/domain/*.ts" + }, + "./registry/*": { + "types": "./model/registry/*.ts", + "default": "./model/registry/*.ts", + "import": "./model/registry/*.ts" + }, + "./utility/*": { + "types": "./model/utility/*.ts", + "default": "./model/utility/*.ts", + "import": "./model/utility/*.ts" } }, "scripts": { "lint": "tsc", - "docs": "typedoc --logLevel Verbose --options typedoc.json", - "schema": "node scripts/schema.mjs", - "schema:generate": "node scripts/schema.mjs generate", - "schema:optimize": "node scripts/schema.mjs optimize", - "schema:validate": "node scripts/schema.mjs validate" + "docs": "typedoc --logLevel Verbose --options typedoc.json" }, "dependencies": { "devtypes": "^2.1.0" }, "devDependencies": { - "ajv": "^8.18.0", - "json-stable-stringify": "^1.3.0", - "ts-json-schema-generator": "^2.9.0", "typedoc": "^0.28.19", "typedoc-github-theme": "^0.4.0", "typedoc-plugin-missing-exports": "^4.1.3", diff --git a/scripts/schema.mjs b/scripts/schema.mjs deleted file mode 100644 index 1ae005e9..00000000 --- a/scripts/schema.mjs +++ /dev/null @@ -1,353 +0,0 @@ -#!/usr/bin/env node - -import { execSync } from 'node:child_process'; -import { createHash } from 'node:crypto'; -import { mkdir, readFile, writeFile } from 'node:fs/promises'; -import { createRequire } from 'node:module'; -import { resolve } from 'node:path'; -import Ajv from 'ajv'; -import stableStringify from 'json-stable-stringify'; -import { createGenerator } from 'ts-json-schema-generator'; - -const require = createRequire( import.meta.url ); -const draft7MetaSchema = require( 'ajv/dist/refs/json-schema-draft-07.json' ); - -class SchemaGenerator { - - FILES = { - FINAL: 'src/schema.json', - TSCONFIG: 'tsconfig.json', - PACKAGE: 'package.json', - TYPES_ENTRY: 'types/index.ts' - }; - - CONFIG = { - HASH_PREFIX: 'pseinfo@', - HASH_LENGTH: 8, - FORBIDDEN_KEYS: new Set( [ 'definitions', '$defs', 'properties', 'patternProperties', 'dependencies' ] ), - MIN_SAVINGS_TH: 40, - MIN_OCCURRENCES: 3, - MIN_NODE_SIZE: 30 - }; - - constructor () { - this.init(); - } - - init () { - this.schema = null; - this.originalStats = null; - this.replacedRefs = 0; - - this.hashMemo = new WeakMap(); - this.nodesByHash = new Map(); - this.hashByOriginalName = new Map(); - this.sharedMap = new Map(); - } - - async run ( mode ) { - const start = process.hrtime(); - - switch ( mode ) { - case 'generate': - await this.generate(); - await this.save(); - break; - - case 'optimize': - await this.load(); - await this.optimize(); - await this.save(); - break; - - case 'validate': - await this.load(); - await this.validate(); - break; - - default: - await this.generate(); - await this.optimize(); - await this.validate(); - await this.save(); - break; - } - - const end = process.hrtime( start ); - const seconds = ( end[ 0 ] + end[ 1 ] / 1e9 ).toFixed( 2 ); - this.log( `Finished in ${ seconds } seconds.` ); - } - - // ---- Generate ---- - - async generate () { - this.log( `Generating schema from TypeScript types ...` ); - - const generator = createGenerator( { - path: resolve( this.FILES.TYPES_ENTRY ), - tsconfig: resolve( this.FILES.TSCONFIG ), - type: 'Database', - expose: 'all', - jsDoc: 'extended', - skipTypeCheck: false, - sortProps: true, - strictTuples: false, - encodeRefs: true - } ); - - try { - this.schema = generator.createSchema( 'Database' ); - this.log( `Generation successful.` ); - } catch ( err ) { - this.error( `Generation failed: ${ err.message }` ); - throw err; - } - } - - // ---- Optimize ---- - - async optimize () { - if ( ! this.schema ) throw new Error( `No schema loaded to optimize.` ); - this.log( `Optimizing schema structure ...` ); - - // 0. Capture baseline stats before optimization - this.captureStats(); - - // 1. Normalize definitions - this.log( `Normalizing definitions ...` ); - const definitions = this.schema.definitions || this.schema.$defs || {}; - this.schema.definitions = definitions; - delete this.schema.$defs; - - // 2. Perform Merkle-Tree analysis - this.log( `Analyzing schema structures ...` ); - this.analyzeNode( this.schema, null ); - - for ( const [ name, def ] of Object.entries( definitions ) ) - this.hashByOriginalName.set( name, this.analyzeNode( def, 'definitions' ).hash ); - - this.log( `Found ${ this.nodesByHash.size } unique structures across the schema.` ); - - // 3. Rebuild with shared definitions - this.log( `Identifying shared structures for optimization ...` ); - this.sharedMap = this.buildSharedMap(); - const nextDefinitions = {}; - - for ( const [ hash, name ] of this.sharedMap.entries() ) { - const entry = this.nodesByHash.get( hash ); - if ( entry ) nextDefinitions[ name ] = this.performReplacement( entry.node, name, true ); - } - - this.log( `Replacing ${ this.replacedRefs } occurrences with $ref pointers to shared definitions ...` ); - - this.schema = { - ...this.performReplacement( this.schema, null, false ), - definitions: nextDefinitions - }; - - // 4. Enhance metadata - this.log( `Enhancing metadata ...` ); - await this.enhanceMetadata(); - } - - analyzeNode ( node, parentKey = null ) { - if ( node === null || typeof node !== 'object' ) { - const str = JSON.stringify( node ); - return { hash: str, size: str.length }; - } - - if ( this.hashMemo.has( node ) ) return this.hashMemo.get( node ); - - let hash, size; - if ( Array.isArray( node ) ) { - const children = node.map( item => this.analyzeNode( item, parentKey ) ); - hash = createHash( 'sha1' ).update( `[${ children.map( c => c.hash ).join( ',' ) }]` ).digest( 'hex' ); - size = 2 + ( children.length > 1 ? children.length - 1 : 0 ) + children.reduce( ( s, c ) => s + c.size, 0 ); - } else { - const keys = Object.keys( node ).sort(); - const children = keys.map( key => ( { key, res: this.analyzeNode( node[ key ], key ) } ) ); - hash = createHash( 'sha1' ).update( `{${ children.map( c => `"${ c.key }":${ c.res.hash }` ).join( ',' ) }}` ).digest( 'hex' ); - size = 2 + ( keys.length > 1 ? keys.length - 1 : 0 ) + children.reduce( ( s, c ) => s + c.key.length + 3 + c.res.size, 0 ); - } - - const result = { hash, size }; - this.hashMemo.set( node, result ); - - if ( ! Array.isArray( node ) ) { - const entry = this.nodesByHash.get( hash ) || { count: 0, size, node, allowed: false }; - entry.count++; - - if ( ! this.CONFIG.FORBIDDEN_KEYS.has( parentKey ) ) entry.allowed = true; - this.nodesByHash.set( hash, entry ); - } - - return result; - } - - buildSharedMap () { - const map = new Map(); - for ( const hash of this.hashByOriginalName.values() ) - if ( ! map.has( hash ) ) map.set( hash, this.getSharedName( hash ) ); - - const refTextLen = 22 + this.CONFIG.HASH_PREFIX.length + this.CONFIG.HASH_LENGTH; - for ( const [ hash, e ] of this.nodesByHash.entries() ) { - if ( map.has( hash ) || e.count < this.CONFIG.MIN_OCCURRENCES || e.size < this.CONFIG.MIN_NODE_SIZE || ! e.allowed ) continue; - if ( e.node.$ref && Object.keys( e.node ).length === 1 ) continue; - - const name = this.getSharedName( hash ); - if ( ( e.count * e.size - e.count * refTextLen - ( name.length + 5 + e.size ) ) > this.CONFIG.MIN_SAVINGS_TH ) map.set( hash, name ); - } - - return map; - } - - getSharedName ( hash ) { - return `${ this.CONFIG.HASH_PREFIX }${ hash.slice( 0, this.CONFIG.HASH_LENGTH ) }`; - } - - performReplacement ( node, parentKey, isDefValue = false ) { - if ( node === null || typeof node !== 'object' ) return node; - - if ( node.$ref && typeof node.$ref === 'string' ) { - const normalized = this.normalizeRef( node.$ref ); - if ( Object.keys( node ).length === 1 ) return { $ref: normalized }; - node = { ...node, $ref: normalized }; - } - - if ( Array.isArray( node ) ) return node.map( i => this.performReplacement( i, parentKey, false ) ); - - const memo = this.hashMemo.get( node ); - if ( memo && this.sharedMap.has( memo.hash ) ) { - const sharedName = this.sharedMap.get( memo.hash ); - - if ( ! this.CONFIG.FORBIDDEN_KEYS.has( parentKey ) && ( ! isDefValue || sharedName !== parentKey ) ) { - this.replacedRefs++; - return { $ref: `#/definitions/${ sharedName }` }; - } - } - - const out = {}; - const isChildOfDefs = parentKey === 'definitions' || parentKey === '$defs'; - for ( const [ key, value ] of Object.entries( node ) ) - out[ key ] = this.performReplacement( value, key, isChildOfDefs ); - - return out; - } - - normalizeRef ( ref ) { - if ( ! ref.startsWith( '#/' ) ) return ref; - - const parts = ref.split( '/' ); - if ( parts[ 1 ] === 'definitions' || parts[ 1 ] === '$defs' ) { - const oldName = decodeURIComponent( parts[ 2 ].replace( /~1/g, '/' ).replace( /~0/g, '~' ) ); - const hash = this.hashByOriginalName.get( oldName ); - - if ( hash && this.sharedMap.has( hash ) ) return `#/definitions/${ this.sharedMap.get( hash ) }`; - } - - return ref.replace( '#/$defs/', '#/definitions/' ); - } - - // ---- Validate ---- - - async validate () { - if ( ! this.schema ) throw new Error( `No schema loaded to validate.` ); - this.log( `Validating schema against JSON Schema Draft-07 ...` ); - - const ajv = new Ajv( { allErrors: true, strict: false, logger: false } ); - if ( ! ajv.getSchema( 'http://json-schema.org/draft-07/schema#' ) ) ajv.addMetaSchema( draft7MetaSchema ); - - if ( ! ajv.validateSchema( this.schema ) ) { - this.error( `Validation failed: ${ ajv.errorsText( ajv.errors ) }` ); - throw new Error( `Schema is invalid.` ); - } - - this.log( `Validation successful.` ); - } - - // ---- Metadata ---- - - async enhanceMetadata () { - const pkg = JSON.parse( await readFile( this.FILES.PACKAGE, 'utf8' ) ); - const meta = { - $schema: 'http://json-schema.org/draft-07/schema#', - $id: `https://unpkg.com/@pseinfo/database-schema@${ pkg.version }/src/schema.json`, - title: pkg.description || 'PSEInfo Database Schema', - description: 'Comprehensive schema for elements, compounds, minerals, and nuclides.', - version: pkg.version, - license: pkg.license || '', - author: pkg.author?.name || pkg.author || '', - build: { date: new Date().toISOString(), commit: this.getGitCommit() } - }; - - this.schema = { ...meta, ...this.schema }; - } - - getGitCommit () { - try { return execSync( 'git rev-parse --short HEAD', { stdio: 'pipe' } ).toString().trim() } - catch { return 'unknown' } - } - - // ---- Analysis ---- - - captureStats () { - const content = stableStringify( this.schema, { space: 2 } ); - this.originalStats = { - bytes: Buffer.byteLength( content, 'utf8' ), - lines: content.split( '\n' ).length - }; - } - - logAnalysis ( finalContent ) { - if ( ! this.originalStats ) return; - - const finalBytes = Buffer.byteLength( finalContent, 'utf8' ); - const byteSaving = ( this.originalStats.bytes - finalBytes ) / this.originalStats.bytes * 100; - const finalLines = finalContent.split( '\n' ).length; - const lineSaving = ( this.originalStats.lines - finalLines ) / this.originalStats.lines * 100; - - this.log( `Final Analysis:` ); - this.log( `- Version: ${ this.schema.version }` ); - this.log( `- Build: ${ this.schema.build.date } (${ this.schema.build.commit })` ); - this.log( `- Lines: ${ this.originalStats.lines } -> ${ finalLines } (${ lineSaving.toFixed( 1 ) }% saved)` ); - this.log( `- Size: ${ ( this.originalStats.bytes / 1024 ).toFixed( 1 ) } KB -> ${ ( finalBytes / 1024 ).toFixed( 1 ) } KB (${ byteSaving.toFixed( 1 ) }% saved)` ); - this.log( `- Nodes: ${ this.nodesByHash.size } unique structures, ${ this.replacedRefs } replaced with $ref pointers` ); - } - - // ---- IO ---- - - log ( msg ) { - console.log( `[schema] ${ msg }` ); - } - - error ( msg ) { - console.error( `[schema] ERROR: ${ msg }` ); - } - - async save () { - this.log( `Writing results to ${ this.FILES.FINAL } ...` ); - - const topOrder = [ '$schema', '$id', 'title', 'description', 'version', 'license', 'author', 'build', 'definitions' ]; - const content = stableStringify( this.schema, { space: 2, cmp: ( a, b ) => - topOrder.indexOf( a.key ) - topOrder.indexOf( b.key ) || a.key.localeCompare( b.key ) - } ); - - await mkdir( resolve( this.FILES.FINAL, '..' ), { recursive: true } ); - await writeFile( resolve( this.FILES.FINAL ), content, 'utf8' ); - - this.log( `Done.` ); - this.logAnalysis( content ); - } - - async load () { - this.log( `Reading ${ this.FILES.FINAL } ...` ); - this.schema = JSON.parse( await readFile( resolve( this.FILES.FINAL ), 'utf8' ) ); - this.log( `Done.` ); - } - -} - -( new SchemaGenerator() ).run( process.argv[ 2 ] ).catch( ( err ) => { - console.error( `[schema] Failed: ${ err.message }` ); - process.exit( 1 ); -} ); diff --git a/typedoc.json b/typedoc.json index 48a73d8d..65fa1618 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,6 +1,6 @@ { "$schema": "https://typedoc.org/schema.json", - "entryPoints": [ "./types/*", "./enum/*" ], + "entryPoints": [ "./config/*", "./enum/*", "./model/*" ], "entryPointStrategy": "expand", "out": "docs", "githubPages": true, @@ -13,7 +13,7 @@ "excludeInternal": false, "excludeExternals": true, "name": "Periodic Table Database Schema", - "customFooterHtml": "Copyright © 2026 Periodic Table
Distributed under the MIT license.", + "customFooterHtml": "Copyright © 2026 Periodic Table by Paul Köhler
Distributed under the MIT license.", "hideGenerator": true, "favicon": "favicon.ico", "headings": { @@ -22,7 +22,6 @@ }, "navigationLinks": { "Periodic Table": "https://pse-info.de", - "Schema": "https://unpkg.com/@pseinfo/database-schema/src/schema.json", "Database": "https://github.com/pseinfo/database", "npm": "https://npmjs.com/@pseinfo/database-schema", "Code": "https://github.com/pseinfo/database-schema" diff --git a/types/abstract/blob.ts b/types/abstract/blob.ts deleted file mode 100644 index c34aeafe..00000000 --- a/types/abstract/blob.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file blob.ts - * @description Defines the core scientific blob representations for binary assets. - * This module handles multi-media assets, 3D structural models, and complex datasets - * stored as binary data within the database. - */ - -import type { Brand, Expand } from 'devtypes/types/util'; -import type { BlobType, D3Format, ImageFormat } from '../../enum/util'; -import type { RefId } from './reference'; -import type { Attribution, Factory } from './util'; - -/** - * Branded base attributes for all binary large objects. - * @template T The classification of the blob (Image, 3D Model, etc.). - */ -type BaseBlob< T extends BlobType > = Brand< { - /** The cryptographic hash (e.g., SHA-256) for data integrity. */ - hash?: string; - /** The total size of the binary data in bytes. */ - size?: number; - /** Legal and creative attribution for the binary asset. */ - attribution?: Attribution; - /** Internal remarks or scientific context regarding the asset. */ - note?: string; - /** Citations and verifiable sources for the binary content. */ - references?: RefId[]; -}, T, 'type', true >; - -/** - * Represents a photographic or diagrammatic image asset. - */ -export type ImageBlob = Expand< BaseBlob< BlobType.IMAGE > & { - /** The raster or vector format of the image. */ - format: ImageFormat; - /** The raw base64 encoded payload of the image. */ - data: string; - /** Physical width of the asset in pixels. */ - width?: number; - /** Physical height of the asset in pixels. */ - height?: number; -} >; - -/** - * Represents a three-dimensional structural or molecular model. - */ -export type Model3DBlob = Expand< BaseBlob< BlobType.MODEL_3D > & { - /** The chemical or spatial data format (e.g., CIF, PDB). */ - format: D3Format; - /** The structural data payload encoded as base64. */ - data: string; -} >; - -/** - * Represents a general-purpose scientific data blob. - */ -export type DataBlob = Expand< BaseBlob< BlobType.DATA > & { - /** The formal IANA media type (Mime-Type). */ - mimeType: `${string}/${string}`; - /** The binary payload encoded as base64. */ - data: string; -} >; - -/** - * Union of all supported binary asset representations. - */ -export type Blob = ImageBlob | Model3DBlob | DataBlob; - -/** - * Branded identifier for a specific binary asset. - */ -export type BlobId = Brand< string, 'blobId' >; - -/** - * A registry collecting multiple binary scientific assets indexed by their unique IDs. - */ -export type BlobCollection = Record< BlobId, Blob >; - -/** - * Factory type for defining binary assets in the database repository. - * - * @example - * ```typescript - * import type { BlobFactory } from '@pseinfo/database-schema/abstract/blob'; - * - * export default ( { - * type: 'blob', - * blobId: 'XXXXXXX', - * data: { - * // ... - * } - * } ) as const satisfies BlobFactory; - * ``` - */ -export type BlobFactory = Factory< 'blob', Blob, { - /** The unique, branded identifier for this binary asset. */ - blobId: BlobId; -} >; diff --git a/types/abstract/collection.ts b/types/abstract/collection.ts deleted file mode 100644 index 3e9d3322..00000000 --- a/types/abstract/collection.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file collection.ts - * @description Provides the structural logic for grouping scientific properties into collections. - * This file handles the recursive mapping of properties and nested groups, ensuring that - * the database schema remains modular and highly structured. - */ - -import type { Expand } from 'devtypes/types/util'; -import type { Property } from './property'; - -/** - * Identity type wrapper to mark a value as a distinct entity in the collection tree. - * @template T The underlying type. - */ -export type Distinct< T = unknown > = T; - -/** - * Represents either a single property or an array of properties of the same type. - * @template T The property definition. - */ -export type Single< T extends Property > = T | T[]; - -/** - * A group of properties or distinct metadata entries organized in a record. - * @template T The record structure. - */ -export type Group< T extends Record< string, Single< Property > | Distinct< unknown > > > = T; - -/** - * Helper type that recursively resolves a value within a collection. - * It differentiates between nested properties, groups, distinct values, and general objects. - * @template T The type to be processed into a collection value. - */ -type CollectionValue< T > = - /** If it's a single property or array of properties, return the base property type. */ - [ T ] extends [ Single< infer P > ] ? P : - /** If it's a group, recurse into the group members. */ - [ T ] extends [ Group< infer G > ] ? { [ GK in keyof G ]: Collection< G[ GK ] > } : - /** Direct property match. */ - [ T ] extends [ Property ] ? T : - /** Distinct metadata/utility match. */ - [ T ] extends [ Distinct< infer D > ] ? Distinct< D > : - /** Expand any other object structures. */ - [ T ] extends [ object ] ? Expand< T > : - /** Fallback for primitives. */ - T; - -/** - * Transforms a definition object into a concrete collection of resolved scientific properties. - * @template T The definition structure of the collection. - */ -export type Collection< T > = { - /** Map each key of the definition to its resolved collection value. */ - [ K in keyof T ]: CollectionValue< T[ K ] >; -}; diff --git a/types/abstract/condition.ts b/types/abstract/condition.ts deleted file mode 100644 index c38d334e..00000000 --- a/types/abstract/condition.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file condition.ts - * @description Defines the environmental and experimental conditions under which measurements are performed. - * This ensures that scientific data (like boiling points or solubility) is correctly attributed - * to specific temperatures, pressures, or other states. - */ - -import type { Primitive } from 'devtypes/types/primitive'; -import type { StandardCondition } from '../../enum/util'; -import type { PhysicalQuantity } from './unit'; -import type { Value } from './value'; - -/** - * A map of experimental conditions defining the state of a measurement. - * It can either be a predefined set (like STP) or a flexible mapping of physical quantities. - * @template Q The physical quantities defining the conditions (e.g., Temperature, Pressure). - * @template T The primitive types allowed for specialized conditions. - */ -export type Conditions< - Q extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = - /** Predefined environmental standards (e.g., StandardCondition.STP). */ - | StandardCondition - /** A dictionary mapping specific physical quantities to their measured values during the experiment. */ - | { [ K in Q ]?: Value< K, T > }; diff --git a/types/abstract/form.ts b/types/abstract/form.ts deleted file mode 100644 index b139030d..00000000 --- a/types/abstract/form.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file form.ts - * @description Defines the physical and structural forms of chemical entities. - * This file allows for the representation of allotropes, polymorphs, and phase-specific - * data, capturing the complexity of matter beyond simple elemental composition. - */ - -import type { RequireFrom } from 'devtypes/types/constraint'; -import type { DeepPartial } from 'devtypes/types/transform'; -import type { Brand, Expand } from 'devtypes/types/util'; -import type { Phase } from '../../enum/physics'; -import type { FormType } from '../../enum/util'; -import type { Collection, Distinct } from './collection'; - -/** - * Base infrastructure for a specific physical form of a substance. - * @template T The classification of the form (Allotrope, Polymorph, etc.). - * @template C The collection of scientific properties applicable to this form. - */ -type BaseForm< T extends FormType, C extends Collection< any > > = Brand< { - /** Partial override of properties specific to this physical form. */ - properties?: DeepPartial< C >; - /** Descriptive note clarifying the nature or source of this specific form. */ - note?: Distinct< string >; -}, T, 'type', true >; - -/** - * Common descriptive fields for chemical forms. - */ -interface FormFields { - /** Specific chemical or structural formula for the form. */ - formula?: Distinct< string >; - /** The primary physical state (solid, liquid, gas, plasma) of this form. */ - phase?: Distinct< Phase >; -} - -/** - * Represents an allotropic variation (e.g., O2 vs O3) or other distinct modification. - * Includes standard formula and phase fields. - */ -export type AllotropeForm< C extends Collection< any > > = Expand< - BaseForm< FormType.ALLOTROPE | FormType.OTHER, C > & - FormFields ->; - -/** - * Represents a molecular species with a strictly defined formula. - * Requires a chemical formula. - */ -export type MolecularForm< C extends Collection< any > > = Expand< - BaseForm< FormType.MOLECULAR, C > & - RequireFrom< FormFields, 'formula' > ->; - -/** - * Represents data specific to a certain physical state or phase transition. - * Requires the definition of the physical state. - */ -export type PhaseForm< C extends Collection< any > > = Expand< - BaseForm< FormType.PHASE, C > & - RequireFrom< FormFields, 'phase' > ->; - -/** - * Represents crystalline modifications (e.g., alpha-iron vs gamma-iron) or amorphous states. - */ -export type PolymorphForm< C extends Collection< any > > = Expand< - BaseForm< FormType.POLYMORPH | FormType.AMORPHOUS, C > ->; - -/** - * Branded identifier for a specific physical form within a collection. - */ -export type FormId = Brand< string, 'formId' >; - -/** - * A registry of multiple physical forms associated with a master chemical collection. - * @template C The base property collection for the substance. - */ -export type FormCollection< C extends Collection< any > > = Record< FormId, Collection< - /** Mapping to one of the supported physical form representations. */ - | AllotropeForm< C > - | MolecularForm< C > - | PhaseForm< C > - | PolymorphForm< C > -> >; diff --git a/types/abstract/meta.ts b/types/abstract/meta.ts deleted file mode 100644 index a828b61d..00000000 --- a/types/abstract/meta.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @file meta.ts - * @description Provides the structural definitions for the database root metadata - * and administrative statistics. This module enables tracking of repository-wide - * metrics, contributor impact, and schema versioning. - */ - -import type { Expand } from 'devtypes/types/util'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct } from './collection'; -import type { ISO8601Date } from './util'; - -/** - * Basic biographical and contact information for an individual or organization - * contributing to the scientific database. - * - * Will have GitHub username and public email or website if available. - */ -export interface Contributor { - /** The primary name or alias of the contributor. */ - name: string; - /** The primary communication channel or professional URI for the contributor. */ - contact?: string; -} - -/** - * Root metadata structure for the entire scientific repository. - * Contains legal, versioning, and administrative information necessary for - * distribution and academic citation. - */ -export type DBMeta = Collection< { - /** The constant version of the database schema for structural compatibility. */ - readonly schemaVersion: 1; - /** The MIT license for the database. */ - readonly license: 'MIT'; - /** The current semantic version of the data collection. */ - version: Distinct< string >; - /** The unique repository revision or commit hash representing the data state. */ - revision: Distinct< string >; - /** The official title of the data repository. */ - title: Distinct< string >; - /** A concise abstract describing the scope and purpose of the database. */ - description?: Distinct< string >; - /** ISO 8601 timestamp of the global database build or last verified modification. */ - lastModified: Distinct< ISO8601Date >; - /** The collective list of all individuals who have contributed to the current database state. */ - contributors: Distinct< Contributor[] >; - /** The permalink to the current version of the database. */ - permalink: `https://github.com/pseinfo/database/releases/tag/v${string}`; -} >; - -/** - * Detailed metrics regarding the distribution of scientific data, repository scale, - * and contributor activity. Designed for automated generation via repository scripts. - */ -export type DBStats = Collection< { - /** Total cumulative size in bytes. */ - size: Distinct< number >; - /** Total number of data points in the database. */ - count: Distinct< number >; - /** Total number of edits. */ - edits: Distinct< number >; - /** Distribution metrics for each scientific entity type. */ - entities: Distinct< { - [ E in EntityType ]: { - /** Count of discrete entities of this type. */ - count: number; - /** Binary size of all entities of this type. */ - bytes: number; - } - } >; - /** Analysis of contributor impact on the database content. */ - contributors: Distinct< Expand< Contributor & { - /** ISO 8601 timestamp of the contributor's most recent valid commit. */ - lastModified: ISO8601Date; - /** The count of edits made by the individual. */ - edits: number; - /** The total volume of data (in bytes) introduced by this contributor. */ - bytes: number; - } > [] >; -} >; diff --git a/types/abstract/property.ts b/types/abstract/property.ts deleted file mode 100644 index b37040bf..00000000 --- a/types/abstract/property.ts +++ /dev/null @@ -1,180 +0,0 @@ -/** - * @file property.ts - * @description Defines the abstract scientific property model. - * A property in this context is more than just a value; it encapsulates the measured data - * along with the experimental conditions and the verifiable sources (references). - */ - -import type { Primitive } from 'devtypes/types/primitive'; -import type { Expand } from 'devtypes/types/util'; -import type { Conditions } from './condition'; -import type { RefId } from './reference'; -import type { PhysicalQuantity } from './unit'; -import type * as value from './value'; - -/** - * Base infrastructure for scientific properties, including environmental context and citations. - * @template C Physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -interface BaseProperty< - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> { - /** The state of environment (Temp, Press, etc.) during measurement. */ - conditions?: Conditions< C, T >; - /** Array of reference IDs pointing to the data source. */ - references?: RefId[]; -} - -/** - * Property carrying a primitive value (string, boolean, etc.). - * Incorporates primitive value structure. - * @template P The primitive type. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type PrimitiveProperty< - P extends Primitive = Primitive, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.PrimitiveValue< P > ->; - -/** - * Property carrying a complex structured object. - * Incorporates structured value definition. - * @template S The structure definition. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type StructProperty< - S extends value.StructType = value.StructType, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.StructValue< S > ->; - -/** - * Property carrying a single physical measurement (Value + Unit). - * Incorporates single quantity value struct. - * @template Q The physical quantity. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type SingleProperty< - Q extends PhysicalQuantity = PhysicalQuantity, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.SingleValue< Q > ->; - -/** - * Property carrying multiple measurement points for a single quantity. - * Incorporates array of quantity values. - * @template Q The physical quantity. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type ArrayProperty< - Q extends PhysicalQuantity = PhysicalQuantity, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.ArrayValue< Q > ->; - -/** - * Property carrying a numeric range (interval) for a physical quantity. - * Incorporates range value definition. - * @template Q The physical quantity. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type RangeProperty< - Q extends PhysicalQuantity = PhysicalQuantity, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.RangeValue< Q > ->; - -/** - * Property carrying multiple coupled numeric physical quantities. - * Incorporates coupled numeric values. - * @template Q The physical quantity. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type CoupledNumberProperty< - Q extends PhysicalQuantity = PhysicalQuantity, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.CoupledNumberValue< Q > ->; - -/** - * Property carrying a heterogeneous coupling of various value types. - * Incorporates heterogeneous coupled values. - * @template Q The physical quantity. - * @template P The primitive type. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - * @template S The structure definition. - */ -export type CoupledProperty< - Q extends PhysicalQuantity = PhysicalQuantity, - P extends Primitive = Primitive, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive, - S extends value.StructType = value.StructType -> = Expand< - BaseProperty< C, T > & - value.CoupledValue< Q, P, S > ->; - -/** - * General numeric physical property. - * Union of all numeric value representations. - * @template Q The physical quantity. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - */ -export type NumberProperty< - Q extends PhysicalQuantity = PhysicalQuantity, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive -> = Expand< - BaseProperty< C, T > & - value.NumberValue< Q > ->; - -/** - * The most abstract representation of a scientific property in the database. - * Union of all supported value types. - * @template Q The physical quantity. - * @template P The primitive type. - * @template C The physical quantities defining measurement conditions. - * @template T Primitive types for condition values. - * @template S The structure definition. - */ -export type Property< - Q extends PhysicalQuantity = PhysicalQuantity, - P extends Primitive = Primitive, - C extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive, - S extends value.StructType = value.StructType -> = Expand< - BaseProperty< C, T > & - value.Value< Q, P, S > ->; diff --git a/types/abstract/reference.ts b/types/abstract/reference.ts deleted file mode 100644 index 7f593f61..00000000 --- a/types/abstract/reference.ts +++ /dev/null @@ -1,361 +0,0 @@ -/** - * @file reference.ts - * @description Provides the bibliographic data models for scientific references. - * The structures are strictly aligned with BibTeX standards to ensure compatibility - * with academic citation workflows and publication metadata. - */ - -import type { ExtractFrom, RequireAtLeastOne, RequireExactlyOneFrom, StrictSubset } from 'devtypes/types/constraint'; -import type { Brand, Expand } from 'devtypes/types/util'; -import type { LangCode, ReferenceType } from '../../enum/util'; -import type { Factory, ISO8601Date } from './util'; - -/** - * Base branded metadata shared by all bibliographic reference types. - * @template T The classification of the reference (Article, Book, etc.). - */ -type BaseReference< T extends ReferenceType > = Brand< { - /** ISO 8601 date when the source was last accessed (crucial for web resources). */ - accessed?: ISO8601Date; - /** Direct link to the source material. */ - url?: string; - /** Digital Object Identifier - the unique permanent identifier for scholarly work. */ - doi?: string; - /** Language of the reference. */ - language?: LangCode; -}, T, 'type', true >; - -/** - * Collection of standard BibTeX fields for academic citations. - */ -interface BibTeXFields { - /** Physical or electronic address of the publisher or institution. */ - address?: string; - /** Primary creator(s) of the work. */ - author?: string | string[]; - /** Title of the book when the reference is a chapter or paper within it. */ - booktitle?: string; - /** Specific chapter number within a larger work. */ - chapter?: string; - /** Version or edition of the publication (e.g., "3rd ed."). */ - edition?: string; - /** Person(s) responsible for assembling the collection or volume. */ - editor?: string | string[]; - /** Alternative publication method for non-traditional sources. */ - howpublished?: string; - /** Official entity sponsoring a technical report or thesis. */ - institution?: string; - /** International Standard Book Number. */ - isbn?: string; - /** Name of the periodical in which the article was published. */ - journal?: string; - /** Month of publication. */ - month?: string; - /** Unstructured supplemental information or remarks. */ - note?: string; - /** Issue number within a volume. */ - number?: number | string; - /** Sponsoring organization for proceedings or manuals. */ - organization?: string; - /** Page numbers or physical extent (e.g., "123--145"). */ - pages?: number | string; - /** Entity responsible for the distribution of the work. */ - publisher?: string; - /** Categorization of technical documents (e.g., "Research Memo"). */ - reportType?: string; - /** The larger collection or series a book belongs to. */ - series?: string; - /** Academic institution where a thesis was defended. */ - school?: string; - /** The full title of the cited work. */ - title?: string; - /** Numerical volume of a journal or multi-volume book. */ - volume?: number | string; - /** Year of publication. */ - year?: number | string; -} - -/** - * Internal helper for thesis types (Master's, PhD, or general Thesis). - * - Mandatory: author, school, title, year - * - Optional: address, month, note, reportType - * @template T The specific thesis reference type. - */ -type Thesis< T extends ReferenceType.MASTERSTHESIS | ReferenceType.THESIS | ReferenceType.PHDTHESIS > = Expand< - /** Base reference metadata. */ - BaseReference< T > & - /** Specific BibTeX fields for theses. */ - StrictSubset< - BibTeXFields, - 'author' | 'school' | 'title' | 'year', - 'address' | 'month' | 'note' | 'reportType' - > ->; - -/** - * Internal helper for conference-related types (Inproceedings or Conference). - * - Mandatory: author, booktitle, title, year - * - Optional: address, editor, month, note, number, organization, pages, publisher, series, volume - * @template T The specific conference reference type. - */ -type Conference< T extends ReferenceType.CONFERENCE | ReferenceType.INPROCEEDINGS > = Expand< - /** Base reference metadata. */ - BaseReference< T > & - /** Specific BibTeX fields for conferences. */ - StrictSubset< - BibTeXFields, - 'author' | 'booktitle' | 'title' | 'year', - 'address' | 'editor' | 'month' | 'note' | 'number' | 'organization' | 'pages' | 'publisher' | 'series' | 'volume' - > ->; - -/** - * Represents a standard academic journal article. - * - Mandatory: author, journal, title, year - * - Optional: month, note, number, pages, volume - */ -export type ArticleReference = Expand< - /** Extends base reference with Article type branding. */ - BaseReference< ReferenceType.ARTICLE > & - /** Specific BibTeX fields for articles. */ - StrictSubset< - BibTeXFields, - 'author' | 'journal' | 'title' | 'year', - 'month' | 'note' | 'number' | 'pages' | 'volume' - > ->; - -/** - * Represents a published book or monograph. - * - Constraint: Must have either an author or an editor, but not both. - * - Mandatory: publisher, title, year - * - Optional: address, edition, isbn, month, note, number, series, volume - */ -export type BookReference = Expand< - /** Extends base reference with Book type branding. */ - BaseReference< ReferenceType.BOOK > & - /** Specific BibTeX fields for books. */ - RequireExactlyOneFrom< BibTeXFields, 'author' | 'editor' > & - StrictSubset< - BibTeXFields, - 'publisher' | 'title' | 'year', - 'address' | 'edition' | 'isbn' | 'month' | 'note' | 'number' | 'series' | 'volume' - > ->; - -/** - * Represents a bound work without a formal publisher (e.g., self-published research). - * - Mandatory: title - * - Optional: address, author, howpublished, month, note, year - */ -export type BookletReference = Expand< - /** Extends base reference with Booklet type branding. */ - BaseReference< ReferenceType.BOOKLET > & - /** Specific BibTeX fields for booklets. */ - StrictSubset< - BibTeXFields, - 'title', - 'address' | 'author' | 'howpublished' | 'month' | 'note' | 'year' - > ->; - -/** - * Represents a paper presented at a scientific conference. - * - Mandatory: author, booktitle, title, year - * - Optional: address, editor, month, note, number, organization, pages, publisher, series, volume - */ -export type ConferenceReference = Conference< ReferenceType.CONFERENCE >; - -/** - * Represents a specific part or chapter within a book. - * - Constraint: Choice between primary author or book editor. - * - Constraint: Requires at least a chapter number or page range. - * - Mandatory: booktitle, publisher, title, year - * - Optional: address, edition, month, note, number, reportType, series, volume - */ -export type InbookReference = Expand< - /** Extends base reference with Inbook type branding. */ - BaseReference< ReferenceType.INBOOK > & - /** Specific BibTeX fields for inbooks. */ - RequireExactlyOneFrom< BibTeXFields, 'author' | 'editor' > & - RequireAtLeastOne< - StrictSubset< - BibTeXFields, - 'booktitle' | 'chapter' | 'pages' | 'publisher' | 'title' | 'year', - 'address' | 'edition' | 'month' | 'note' | 'number' | 'reportType' | 'series' | 'volume' - >, - 'chapter' | 'pages' - > ->; - -/** - * Represents a standalone work published within a larger collection. - * - Mandatory: author, booktitle, publisher, title, year - * - Optional: address, chapter, edition, editor, month, note, number, pages, reportType, series, volume - */ -export type IncollectionReference = Expand< - /** Extends base reference with Incollection type branding. */ - BaseReference< ReferenceType.INCOLLECTION > & - /** Specific BibTeX fields for incollections. */ - StrictSubset< - BibTeXFields, - 'author' | 'booktitle' | 'publisher' | 'title' | 'year', - 'address' | 'chapter' | 'edition' | 'editor' | 'month' | 'note' | 'number' | 'pages' | 'reportType' | 'series' | 'volume' - > ->; - -/** - * Represents a paper in conference proceedings (aliased to Proceeding paper). - */ -export type InproceedingsReference = Conference< ReferenceType.INPROCEEDINGS >; - -/** - * Represents technical documentation or instruction manuals. - * - Mandatory: title - * - Optional: address, author, edition, month, note, organization, year - */ -export type ManualReference = Expand< - /** Extends base reference with Manual type branding. */ - BaseReference< ReferenceType.MANUAL > & - /** Specific BibTeX fields for manuals. */ - StrictSubset< - BibTeXFields, - 'title', - 'address' | 'author' | 'edition' | 'month' | 'note' | 'organization' | 'year' - > ->; - -/** - * Represents a Master's thesis. - * - Mandatory: author, school, title, year - * - Optional: address, month, note, reportType - */ -export type MastersthesisReference = Thesis< ReferenceType.MASTERSTHESIS >; - -/** - * Represents a general academic thesis. - * - Mandatory: author, school, title, year - * - Optional: address, month, note, reportType - */ -export type ThesisReference = Thesis< ReferenceType.THESIS >; - -/** - * Represents miscellaneous sources not fitting standard types (e.g., data sets). - * - Mandatory: title - * - Optional: author, howpublished, month, note, year - */ -export type MiscReference = Expand< - /** Extends base reference with Misc type branding. */ - BaseReference< ReferenceType.MISC > & - /** Specific BibTeX fields for misc. */ - ExtractFrom< - BibTeXFields, - 'author' | 'howpublished' | 'month' | 'note' | 'title' | 'year' - > ->; - -/** - * Represents a Doctoral dissertation. - * - Mandatory: author, school, title, year - * - Optional: address, month, note, reportType - */ -export type PhdthesisReference = Thesis< ReferenceType.PHDTHESIS >; - -/** - * Represents the full volume of conference proceedings. - * - Mandatory: title, year - * - Optional: address, editor, month, note, number, organization, publisher, series, volume - */ -export type ProceedingsReference = Expand< - /** Extends base reference with Proceedings type branding. */ - BaseReference< ReferenceType.PROCEEDINGS > & - /** Specific BibTeX fields for proceedings. */ - StrictSubset< - BibTeXFields, - 'title' | 'year', - 'address' | 'editor' | 'month' | 'note' | 'number' | 'organization' | 'publisher' | 'series' | 'volume' - > ->; - -/** - * Represents a formal report from an institution or organization. - * - Mandatory: author, institution, title, year - * - Optional: address, month, note, number, reportType - */ -export type TechreportReference = Expand< - /** Extends base reference with Techreport type branding. */ - BaseReference< ReferenceType.TECHREPORT > & - /** Specific BibTeX fields for techreports. */ - StrictSubset< - BibTeXFields, - 'author' | 'institution' | 'title' | 'year', - 'address' | 'month' | 'note' | 'number' | 'reportType' - > ->; - -/** - * Represents scholarly work not yet formally published (e.g., pre-prints). - * - Mandatory: author, note, title - * - Optional: month, year - */ -export type UnpublishedReference = Expand< - /** Extends base reference with Unpublished type branding. */ - BaseReference< ReferenceType.UNPUBLISHED > & - /** Specific BibTeX fields for unpublished. */ - StrictSubset< - BibTeXFields, - 'author' | 'note' | 'title', - 'month' | 'year' - > ->; - -/** - * Union type containing all supported scientific reference models. - */ -export type Reference = - | ArticleReference - | BookReference - | BookletReference - | ConferenceReference - | InbookReference - | IncollectionReference - | InproceedingsReference - | ManualReference - | MastersthesisReference - | ThesisReference - | MiscReference - | PhdthesisReference - | ProceedingsReference - | TechreportReference - | UnpublishedReference; - -/** - * A unique, branded string identifier for a reference within a registry. - */ -export type RefId = Brand< string, 'refId' >; - -/** - * A registry collecting multiple scientific references indexed by their unique IDs. - */ -export type ReferenceCollection = Record< RefId, Reference >; - -/** - * Factory type for defining scientific references in the bibliography. - * - * @example - * ```typescript - * import type { ReferenceFactory } from '@pseinfo/database-schema/abstract/reference'; - * - * export default ( { - * type: 'ref', - * refId: 'dewiki:XXXXXXX', - * data: { - * // ... - * } - * } ) as const satisfies ReferenceFactory; - * ``` - */ -export type ReferenceFactory = Factory< 'ref', Reference, { - /** The unique reference identifier. */ - refId: RefId; -} >; diff --git a/types/abstract/uncertainty.ts b/types/abstract/uncertainty.ts deleted file mode 100644 index 731cb700..00000000 --- a/types/abstract/uncertainty.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file uncertainty.ts - * @description Provides the data models for representing experimental uncertainty. - * This is crucial for scientific data where measurements are never absolute and require - * a standardized way to communicate precision and error margins. - */ - -import type { RequireFrom } from 'devtypes/types/constraint'; -import type { Brand, Expand } from 'devtypes/types/util'; -import type { UncertaintyType } from '../../enum/util'; - -/** - * Base structure for all scientific uncertainty types. - * @template T The specific type of uncertainty (absolute, relative, or asymmetrical). - */ -type BaseUncertainty< T extends UncertaintyType > = Brand< { - /** The statistical confidence level (e.g., 0.95 for a 95% confidence interval). */ - confidence?: number; - /** Additional scientific notes regarding the measurement error or calculation method. */ - note?: string; -}, T, 'type', true >; - -/** - * Common fields used across different uncertainty models. - */ -interface UncertaintyFields { - /** The constant value of the error in the same unit as the measurement. */ - absolute?: number; - /** The fractional error relative to the measurement value (e.g., 0.01 for 1%). */ - relative?: number; - /** The positive deviation in asymmetrical error models. */ - plus?: number; - /** The negative deviation in asymmetrical error models. */ - minus?: number; -} - -/** - * Represents an absolute error margin (e.g., ±0.05). - * Requires the presence of the 'absolute' field. - */ -export type AbsoluteUncertainty = Expand< - BaseUncertainty< UncertaintyType.ABSOLUTE > & - RequireFrom< UncertaintyFields, 'absolute' > ->; - -/** - * Represents a relative error margin (e.g., ±2%). - * Requires the presence of the 'relative' field. - */ -export type RelativeUncertainty = Expand< - BaseUncertainty< UncertaintyType.RELATIVE > & - RequireFrom< UncertaintyFields, 'relative' > ->; - -/** - * Represents asymmetrical errors where the upper and lower bounds differ (e.g., +0.1/-0.05). - * Requires both 'plus' and 'minus' fields to define the range. - */ -export type AsymmetricalUncertainty = Expand< - BaseUncertainty< UncertaintyType.ASYMMETRICAL > & - RequireFrom< UncertaintyFields, 'plus' | 'minus' > ->; - -/** - * Union type facilitating any supported scientific uncertainty model. - */ -export type Uncertainty = - | AbsoluteUncertainty - | RelativeUncertainty - | AsymmetricalUncertainty; diff --git a/types/abstract/unit.ts b/types/abstract/unit.ts deleted file mode 100644 index 58ef4b21..00000000 --- a/types/abstract/unit.ts +++ /dev/null @@ -1,319 +0,0 @@ -/** - * @file unit.ts - * @description Defines the scientific unit registry and physical dimensions. - * This file serves as the core module for physical quantities, their base units, - * prefixing rules, and dimensional analysis within the database. - */ - -import type { Brand, Expand } from 'devtypes/types/util'; -import type { MetricSystem } from '../../enum/util'; -import type { Factory } from './util'; - -/** - * Fundamental dimensions of the International System of Units (SI). - * These dimensions form the basis for all derived physical quantities and their units. - */ -export type SIDimension = ( typeof SIDimension )[ number ]; -export const SIDimension = [ - /** Physical dimension of temporal duration. */ - 'time', - /** Physical dimension of distance or spatial extent. */ - 'length', - /** Physical dimension of inertia and gravitational attraction. */ - 'mass', - /** Rate of flow of electric charge. */ - 'electricCurrent', - /** Degree of thermal energy in a system. */ - 'temperature', - /** Number of elementary entities in a sample. */ - 'amountOfSubstance', - /** Power emitted by a light source in a particular direction. */ - 'luminousIntensity' -] as const; - -/** - * Valid SI prefixes and their corresponding numerical factors. - */ -export type SIPrefix = keyof typeof SIPrefix; -export const SIPrefix = { - /** Yotta (10^24) */ Y: 1e24, /** Zetta (10^21) */ Z: 1e21, /** Exa (10^18) */ E: 1e18, - /** Peta (10^15) */ P: 1e15, /** Tera (10^12) */ T: 1e12, /** Giga (10^9) */ G: 1e9, - /** Mega (10^6) */ M: 1e6, /** Kilo (10^3) */ k: 1e3, /** Hecto (10^2) */ h: 1e2, - /** Deca (10^1) */ da: 1e1, /** Deci (10^-1) */ d: 1e-1, /** Centi (10^-2) */ c: 1e-2, - /** Milli (10^-3) */ m: 1e-3, /** Micro (10^-6) */ µ: 1e-6, /** Nano (10^-9) */ n: 1e-9, - /** Pico (10^-12) */ p: 1e-12, /** Femto (10^-15)*/ f: 1e-15, /** Atto (10^-18) */ a: 1e-18, - /** Zepto (10^-21)*/ z: 1e-21, /** Yocto (10^-24)*/ y: 1e-24 -} as const; - -/** - * The main registry of all supported physical quantities and their valid unit symbols. - */ -export type ValidUnits = typeof ValidUnits; - -/** - * Union of all supported physical quantity identifiers. - */ -export type PhysicalQuantity = keyof typeof ValidUnits; - -/** - * Detailed specification of units for each physical quantity. - */ -export const ValidUnits = { - /** Base SI Dimension: Time */ - time: { base: [ 's', 'min', 'h', 'd', 'a', 't{P}' ], prefixable: [ 's' ] }, - /** Base SI Dimension: Length */ - length: { base: [ 'm', 'in', 'ft', 'yd', 'mi', 'Å', 'Ø', 'l{P}' ], prefixable: [ 'm' ] }, - /** Base SI Dimension: Mass */ - mass: { base: [ 'g', 't', 'oz', 'lb', 'u', 'Da', 'm{P}' ], prefixable: [ 'g' ] }, - /** Base SI Dimension: Electric Current */ - electricCurrent: { base: [ 'A' ], prefixable: [ 'A' ] }, - /** Base SI Dimension: Thermodynamic Temperature */ - temperature: { base: [ 'K', '°C', '°F', 'T{P}' ], prefixable: [] }, - /** Base SI Dimension: Amount of Substance */ - amountOfSubstance: { base: [ 'mol' ], prefixable: [ 'mol' ] }, - /** Base SI Dimension: Luminous Intensity */ - luminousIntensity: { base: [ 'cd' ], prefixable: [] }, - - /** Derived Quantity: Velocity */ - velocity: { base: [ 'm/s', 'km/h', 'mph', 'ft/s', 'knot', 'Mach' ], prefixable: [ 'm/s' ] }, - /** Derived Quantity: Acceleration */ - acceleration: { base: [ 'm/s[2]', 'g', 'Gal' ], prefixable: [ 'm/s[2]' ] }, - /** Derived Quantity: Force */ - force: { base: [ 'N', 'dyn', 'kgf', 'lbf' ], prefixable: [ 'N' ] }, - /** Derived Quantity: Surface Tension */ - surfaceTension: { base: [ 'N/m', 'dyn/cm' ], prefixable: [ 'N/m' ] }, - /** Derived Quantity: Pressure */ - pressure: { base: [ 'Pa', 'bar', 'atm', 'psi', 'torr', 'mmHg', 'inHg', 'cmH{2}O' ], prefixable: [ 'Pa', 'bar' ] }, - /** Derived Quantity: Energy */ - energy: { base: [ 'J', 'eV', 'kcal', 'Wh', 'Btu', 'erg' ], prefixable: [ 'J', 'eV', 'Wh' ] }, - /** Derived Quantity: Power */ - power: { base: [ 'W', 'hp', 'erg/s', 'kcal/s' ], prefixable: [ 'W' ] }, - /** Derived Quantity: Density */ - density: { base: [ 'kg/m[3]', 'g/cm[3]', 'g/ml', 'kg/l', 'lb/ft[3]' ], prefixable: [] }, - /** Derived Quantity: Absorption Coefficient (Optical) */ - absorptionCoefficient: { base: [ 'm[-1]', 'L/(mol·cm)' ], prefixable: [ 'm[-1]' ] }, - /** Derived Quantity: Attenuation Coefficient (Signal) */ - attenuationCoefficient: { base: [ 'm[-1]', 'dB/cm', 'dB/km' ], prefixable: [ 'm[-1]' ] }, - /** Derived Quantity: Material Compressibility */ - compressibility: { base: [ 'Pa[-1]', 'bar[-1]' ], prefixable: [ 'Pa[-1]', 'bar[-1]' ] }, - - /** Thermodynamics: Enthalpy (Molar/Mass) */ - enthalpy: { base: [ 'J/mol', 'J/g', 'kcal/mol', 'eV', 'Btu/lb' ], prefixable: [ 'J/mol', 'eV' ] }, - /** Thermodynamics: Entropy */ - entropy: { base: [ 'J/(mol·K)', 'J/(g·K)', 'cal/(mol·K)', 'Btu/(lb·°F)' ], prefixable: [] }, - /** Thermodynamics: Total Heat Capacity */ - heatCapacity: { base: [ 'J/(mol·K)', 'J/(g·K)', 'J/(kg·K)', 'cal/(mol·K)', 'Btu/(lb·°F)' ], prefixable: [] }, - /** Thermodynamics: Specific Heat Capacity */ - specificHeatCapacity: { base: [ 'J/(g·K)', 'J/(kg·K)', 'cal/(g·K)', 'Btu/(lb·°F)' ], prefixable: [] }, - /** Thermodynamics: Temperature Coefficient */ - tempCoefficient: { base: [ 'K[-1]', 'ppm/K' ], prefixable: [] }, - /** Thermodynamics: Thermal Conductivity */ - thermalConductivity: { base: [ 'W/(m·K)', 'W/(cm·K)', 'cal/(s·cm·K)' ], prefixable: [] }, - /** Thermodynamics: Thermal Expansion Coefficient */ - thermalExpansion: { base: [ 'K[-1]', 'ppm/K' ], prefixable: [] }, - /** Thermodynamics: Thermal Diffusivity */ - thermalDiffusivity: { base: [ 'm[2]/s', 'cm[2]/s' ], prefixable: [] }, - - /** Electromagnetism: Electric Charge */ - electricCharge: { base: [ 'C', 'e', 'Ah' ], prefixable: [ 'C' ] }, - /** Electromagnetism: Electric Potential / Voltage */ - electricPotential: { base: [ 'V' ], prefixable: [ 'V' ] }, - /** Electromagnetism: Electric Resistance */ - electricResistance: { base: [ 'Ω' ], prefixable: [ 'Ω' ] }, - /** Electromagnetism: Electric Conductance */ - electricConductance: { base: [ 'S' ], prefixable: [ 'S' ] }, - /** Electromagnetism: Electric Conductivity (Specific) */ - electricConductivity: { base: [ 'S/m', 'S/cm' ], prefixable: [ 'S/m' ] }, - /** Electromagnetism: Electric Resistivity (Specific) */ - electricResistivity: { base: [ 'Ω·m', 'Ω·cm' ], prefixable: [ 'Ω·m' ] }, - /** Electromagnetism: Electric Capacitance */ - capacitance: { base: [ 'F' ], prefixable: [ 'F' ] }, - /** Electromagnetism: Electric Inductance */ - inductance: { base: [ 'H' ], prefixable: [ 'H' ] }, - /** Electromagnetism: Electric Dipole Moment */ - dipoleMoment: { base: [ 'C·m', 'statC·cm', 'abC·cm' ], prefixable: [ 'C·m' ] }, - - /** Magnetism: Magnetic Flux */ - magneticFlux: { base: [ 'Wb', 'V·s' ], prefixable: [ 'Wb' ] }, - /** Magnetism: Magnetic Flux Density / Induction */ - magneticFluxDensity: { base: [ 'T', 'G' ], prefixable: [ 'T', 'G' ] }, - /** Magnetism: Dimensionless or Specific Magnetic Susceptibility */ - magneticSusceptibility: { base: [ '*', 'cm[3]/mol', 'm[3]/mol' ], prefixable: [] }, - /** Magnetism: Magnetic Moment */ - magneticMoment: { base: [ 'J/T', 'A·m[2]', 'µ{B}', 'µ{N}' ], prefixable: [ 'J/T' ] }, - /** Magnetism: Magnetic Field Strength */ - magneticFieldStrength: { base: [ 'A/m', 'Oe' ], prefixable: [ 'A/m' ] }, - /** Magnetism: Magnetic Permeability */ - magneticPermeability: { base: [ 'H/m' ], prefixable: [ 'H/m' ] }, - /** Magnetism: Molar Magnetic Susceptibility */ - molarMagneticSusceptibility: { base: [ 'cm[3]/mol', 'm[3]/mol' ], prefixable: [] }, - /** Magnetism: Mass (Gram) Magnetic Susceptibility */ - massMagneticSusceptibility: { base: [ 'cm[3]/g', 'm[3]/kg' ], prefixable: [] }, - - /** Photometry: Luminous Flux */ - luminousFlux: { base: [ 'lm' ], prefixable: [ 'lm' ] }, - /** Photometry: Illuminance */ - illuminance: { base: [ 'lx', 'fc' ], prefixable: [ 'lx' ] }, - - /** Acoustics: Speed of Sound */ - soundSpeed: { base: [ 'm/s', 'km/h', 'ft/s' ], prefixable: [ 'm/s' ] }, - /** Acoustics: Acoustic Impedance */ - acousticImpedance: { base: [ 'Pa·s/m', 'kg/(m[2]·s)', 'Rayl' ], prefixable: [] }, - - /** Chemistry: Molar Mass */ - molarMass: { base: [ 'g/mol' ], prefixable: [ 'g/mol' ] }, - /** Chemistry: Molar Volume */ - molarVolume: { base: [ 'L/mol', 'm[3]/mol' ], prefixable: [ 'L/mol', 'm[3]/mol' ] }, - /** Chemistry: Substance Concentration */ - concentration: { base: [ 'mol/L', 'mol/m[3]', 'g/L', 'ppm', 'ppb' ], prefixable: [ 'mol/L', 'mol/m[3]', 'g/L' ] }, - /** Chemistry: Molarity (mol/L) */ - molarity: { base: [ 'M', 'mol/L' ], prefixable: [ 'mol/L' ] }, - /** Chemistry: Molality (mol/kg) */ - molality: { base: [ 'm', 'mol/kg' ], prefixable: [ 'mol/kg' ] }, - /** Chemistry: Molar Heat Capacity */ - molarHeatCapacity: { base: [ 'J/(mol·K)', 'cal/(mol·K)' ], prefixable: [] }, - /** Chemistry: Catalytic Activity */ - catalyticActivity: { base: [ 'kat' ], prefixable: [ 'kat' ] }, - - /** Fluid Dynamics: Dynamic Viscosity */ - dynamicViscosity: { base: [ 'Pa·s', 'cP', 'poise', 'mPa·s' ], prefixable: [] }, - /** Fluid Dynamics: Kinematic Viscosity */ - kinematicViscosity: { base: [ 'm[2]/s', 'cSt', 'stoke' ], prefixable: [] }, - - /** Nuclear: Radioactive Activity */ - activity: { base: [ 'Bq', 'Ci' ], prefixable: [ 'Bq', 'Ci' ] }, - /** Nuclear: Absorbed Radiation Dose */ - absorbedDose: { base: [ 'Gy', 'rad' ], prefixable: [ 'Gy' ] }, - /** Nuclear: Equivalent Dose */ - equivalentDose: { base: [ 'Sv', 'rem' ], prefixable: [ 'Sv' ] }, - - /** Magnetic Resonance: Gyromagnetic Ratio */ - gyromagneticRatio: { base: [ 'rad/(s·T)' ] , prefixable: [] }, - - /** General Physics: Frequency */ - frequency: { base: [ 'Hz', 'rpm', 'rps' ], prefixable: [ 'Hz' ] }, - /** General Physics: Angular Measurement */ - angle: { base: [ '°', 'rad', 'ʹ', 'ʺ', 'grad', 'turn' ], prefixable: [] }, - /** General Physics: Dimensionless Mass Fraction */ - massFraction: { base: [ '%', '‰', '*', 'ppm', 'ppb', 'ppt' ], prefixable: [] }, - /** General Physics: Geometric Area */ - area: { base: [ 'm[2]', 'b' ], prefixable: [ 'm[2]' ] }, - /** General Physics: Dimensionless Quantity */ - quantity: { base: [ '*', '%', '‰' ], prefixable: [] }, - - /** Economics: Monetary Currency */ - currency: { base: [ 'USD', 'EUR', 'CHF' ], prefixable: [] } -} as const; - -/** - * Extracts base unit symbols for a specific physical quantity. - * @template Q The physical quantity to extract symbols for. - */ -type BaseUnitSymbols< Q extends PhysicalQuantity > = ValidUnits[ Q ][ 'base' ][ number ]; - -/** - * Extracts prefixable unit symbols for a specific physical quantity. - * @template Q The physical quantity to extract prefixable symbols for. - */ -type PrefixableUnitSymbols< Q extends PhysicalQuantity > = ValidUnits[ Q ][ 'prefixable' ][ number ]; - -/** - * Generates all possible symbols (including SI prefixes) for a quantity. - * @template Q The physical quantity to generate symbols for. - */ -type PrefixedSymbols< Q extends PhysicalQuantity > = - /** Base unit symbols. */ - | BaseUnitSymbols< Q > - /** SI prefixed unit symbols. */ - | `${ SIPrefix }${ PrefixableUnitSymbols< Q > }`; - -/** - * Representation of the base SI dimensions: - * [ length, mass, time, current, temperature, amount, intensity ]. - */ -export type DimensionVector = [ number, number, number, number, number, number, number ]; - -/** - * Branded structure for a single scientific unit. - * @template Q The physical quantity this unit belongs to. - * @template U The specific symbol of this unit. - */ -export type Unit< Q extends PhysicalQuantity, U extends BaseUnitSymbols< Q > > = Expand< Brand< { - /** The full human-readable name of the unit (e.g., "meters per second"). */ - name?: string; - /** The metric or imperial system this unit originates from. */ - system?: MetricSystem; - /** Indicates if this is the fundamental base unit for the system. */ - isBase?: boolean; - /** Whether this unit can be combined with SI prefixes. */ - prefixable?: U extends PrefixableUnitSymbols< Q > ? true : false; - /** Factors for converting this unit to the system base unit. */ - conversion?: { - /** The multiplication factor. */ - factor: number; - /** The additive offset (primarily for temperature scales). */ - offset?: number; - }; -}, U, 'symbol', true > >; - -/** - * Defines the properties and available units for a physical quantity. - * @template Q The physical quantity being defined. - */ -export type Quantity< Q extends PhysicalQuantity > = { - /** The physical dimension of the quantity. */ - dimension?: { - /** The shorthand symbol for the dimension (e.g., "L" for length). */ - symbol: string; - /** The full name of the dimension (e.g., "length"). */ - name: string; - /** Whether this is a fundamental SI base dimension. */ - si: Q extends SIDimension ? true : false; - /** The exponents of the base SI dimensions. */ - vector: DimensionVector; - }; - /** The reference unit symbol for this quantity. */ - baseUnit: BaseUnitSymbols< Q >; - /** A collection of all valid units for this quantity. */ - units: { - [ U in BaseUnitSymbols< Q > ]: Unit< Q, U >; - }; -}; - -/** - * A branded unique identifier for a unit, coupling the quantity with it's specific symbol. - * @template Q The physical quantity of the unit. - */ -export type UnitId< Q extends PhysicalQuantity = PhysicalQuantity > = Brand< - [ Q, PrefixedSymbols< Q > ], - 'unitId' ->; - -/** - * The unit registry collecting all physical quantities and their unit definitions. - */ -export type UnitCollection = { - [ Q in PhysicalQuantity ]?: Quantity< Q >; -}; - -/** - * Factory type for defining units of measurement in the registry. - * @template Q The physical quantity being defined. - * - * @example - * ```typescript - * import type { UnitFactory } from '@pseinfo/database-schema/abstract/unit'; - * - * export default ( { - * type: 'unit', - * quantity: 'length', - * data: { - * // ... - * } - * } ) as const satisfies UnitFactory< 'length' >; - * ``` - */ -export type UnitFactory< Q extends PhysicalQuantity > = Factory< 'unit', Quantity< Q >, { - /** The physical quantity being defined. */ - quantity: Q -} >; diff --git a/types/abstract/util.ts b/types/abstract/util.ts deleted file mode 100644 index 18aef4b2..00000000 --- a/types/abstract/util.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file util.ts - * @description General utility types for the scientific database schema, including metadata structures - * and specialized groups for localized strings to ensure multi-language data integrity. - */ - -import type { Brand, Expand } from 'devtypes/types/util'; -import type { EntityType, LangCode } from '../../enum/util'; -import type { Collection, Distinct, Group } from '../abstract/collection'; - -/** Helper type for ISO 8601 date format. */ -export type ISO8601Date = `${number}-${number}-${number}T${number}:${number}:${number}Z`; - -/** - * Data model for legal and creative attribution of assets. - * Provides a standardized structure for handling authorship, licensing, and credits. - */ -export type Attribution = Group< { - /** The individual or organization primarily responsible for the creation of the asset. */ - author?: Distinct< string >; - /** The legal license identifier or descriptive license name. */ - license: Distinct< string >; - /** The mandatory attribution string required by the license or creator. */ - credits: Distinct< string >; - /** The originating website, digital archive, or publication where the asset was sourced. */ - source?: Distinct< string >; - /** The ISO 8601 date the asset was last accessed or verified. */ - accessed?: Distinct< ISO8601Date >; -} >; - -/** - * Defines the root metadata structure for the schema, supporting automated enrichment. - * This generic wrapper ensures that every high-level entity or collection can be tracked for - * versioning, integrity, and source information. - * @template T The underlying data structure to be enriched with metadata. - */ -export type MetaData< T extends Collection< unknown > = Collection< unknown > > = Expand< T & { - /** Internal metadata object for administrative and scientific tracking. */ - '@metadata': Distinct< { - /** The version of the schema used for this data object. */ - readonly schemaVersion: 1; - /** ISO 8601 timestamp of the last modification. */ - lastModified: ISO8601Date; - /** Unique commit hash or version identifier representing the data source state. */ - commit: string; - /** Cryptographic hash for data integrity verification of the entire object. */ - hash: string; - /** Permalink to the source file in the repository, allowing traceability and version control. */ - permalink: `https://github.com/pseinfo/database/blob/${string}/data/${string}.ts`; - } >; -} >; - -/** - * A specialized group for localized strings or values. - * It enforces at least one primary language (usually English) and allows optional translations. - * @template L The primary language code(s) required for this group. - * @template T The type of the value being localized (defaults to string). - */ -export type LangGroup< L extends LangCode = LangCode.ENGLISH, T = string > = Group< Expand< - /** Mandatory entries for the primary language(s). */ - Required< { [ K in L ]: Distinct< T > } > & - /** Optional entries for all other supported languages. */ - Partial< { [ K in Exclude< LangCode, L > ]: Distinct< T > } > -> >; - -/** - * A robust factory utility type designed to facilitate the construction of the database repository. - * These types are used as build-time "contracts" for individual data files, ensuring that the file - * structure, identifiers, and underlying data collections are perfectly aligned. - * - * This enables strict template validation within the IDE and CI/CD pipelines when creating new - * entities (Elements, Nuclides, etc.) or registries (Units, References, Blobs). - * - * @template E The entity type or specialized registry category. - * @template C The raw scientific data collection associated with the entity. - * @template K A set of primary keys or identifiers that define the specific record (e.g., symbol, id). - */ -export type Factory< - E extends EntityType | 'unit' | 'ref' | 'blob', - C extends Collection< unknown >, - K extends Record< string, string | number > -> = Expand< Brand< K & { data: C }, E, 'type', true > >; diff --git a/types/abstract/value.ts b/types/abstract/value.ts deleted file mode 100644 index b61476cb..00000000 --- a/types/abstract/value.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** - * @file value.ts - * @description Core value representations for scientific data. - * This file provides the abstraction layer for primitive, structured, and physical values, - * supporting complex formats like uncertainty-aware ranges and coupled physical quantities. - */ - -import type { RequireAtLeastOne, RequireExactlyOneFrom, RequireFrom, StrictSubset } from 'devtypes/types/constraint'; -import type { Primitive } from 'devtypes/types/primitive'; -import type { Brand, Expand } from 'devtypes/types/util'; -import type { ValueConfidence, ValueType } from '../../enum/util'; -import type { Uncertainty } from './uncertainty'; -import type { PhysicalQuantity, UnitId } from './unit'; - -/** - * Generic structural type for complex property values. - */ -export type StructType = Record< string | number, unknown >; - -/** - * Branded base attributes for all scientific value types. - * @template T The classification of the value (Primitive, Struct, Single, etc.). - */ -type BaseValue< T extends ValueType > = Brand< { - /** The degree of scientific certainty or validation status of the data. */ - confidence?: ValueConfidence; - /** Experimental or statistical uncertainty associated with the value. */ - uncertainty?: Uncertainty; - /** Scientific context of the value. */ - context?: string; - /** Notes or remarks regarding the value. */ - note?: string; -}, T, 'type', true >; - -/** - * Interface defining the possible fields for various value representations. - * @template Q The physical quantity (e.g., 'temperature', 'mass'). - * @template T The primitive data type (e.g., string, boolean). - * @template S The structure of complex objects. - */ -interface ValueFields< - Q extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive, - S extends StructType = StructType -> { - /** A single data point. */ - value?: T; - /** A collection of discrete data points. */ - values?: T[]; - /** A continuous range between two boundary conditions. */ - range?: RequireAtLeastOne< Record< 'lower' | 'upper', { - /** The boundary value. */ - value: number; - /** Uncertainty specific to this boundary. */ - uncertainty?: Uncertainty; - /** Whether the boundary value is part of the set. */ - inclusive?: boolean; - } > >; - /** The unit identification for physical quantities. */ - unit?: UnitId< Q >; - /** Structured object for complex data sets. */ - struct?: S; -} - -/** - * Enrich value types with a physical quantity unit field when applicable. - * This conditional type ensures that only value types representing physical quantities can include a unit. - * @template Q The physical quantity. - */ -type UnitField< Q > = Q extends PhysicalQuantity ? 'unit' : never; - -/** - * Represents a standard primitive value (string, number, boolean). - * Requires either a single value or an array of values. - * @template T The specific primitive type. - */ -export type PrimitiveValue< T extends Primitive = Primitive > = Expand< - BaseValue< ValueType.PRIMITIVE > & - RequireExactlyOneFrom< ValueFields< never, T >, 'value' | 'values' > ->; - -/** - * Represents a complex structured object. - * Requires the presence of the 'struct' field. - * @template T The structure definition. - */ -export type StructValue< T extends StructType = StructType > = Expand< - BaseValue< ValueType.STRUCT > & - RequireFrom< ValueFields< never, never, T >, 'struct' > ->; - -/** - * Represents a single measurement of a physical quantity with a unit. - * Requires a single value. Optionally includes a physical quantity unit. - * @template Q The physical quantity. - */ -export type SingleValue< Q extends PhysicalQuantity = PhysicalQuantity > = Expand< - BaseValue< ValueType.SINGLE > & - StrictSubset< ValueFields< Q, number >, 'value', UnitField< Q > > ->; - -/** - * Represents an array of measurements for a physical quantity with a common unit. - * Requires an array of values. Optionally includes a physical quantity unit. - * @template Q The physical quantity. - */ -export type ArrayValue< Q extends PhysicalQuantity = PhysicalQuantity > = Expand< - BaseValue< ValueType.ARRAY > & - StrictSubset< ValueFields< Q, number >, 'values', UnitField< Q > > ->; - -/** - * Represents a numeric interval for a physical quantity. - * Requires a range of values. Optionally includes a physical quantity unit and single value. - * @template Q The physical quantity. - */ -export type RangeValue< Q extends PhysicalQuantity = PhysicalQuantity > = Expand< - BaseValue< ValueType.RANGE > & - StrictSubset< ValueFields< Q, number >, 'range', 'value' | UnitField< Q > > ->; - -/** - * Represents multiple numeric physical quantities that are measured or defined together. - * @template Q The union of physical quantities involved. - */ -export type CoupledNumberValue< Q extends PhysicalQuantity = PhysicalQuantity > = Expand< - BaseValue< ValueType.COUPLED > & { - /** A mapping of quantities to their respective single, array, or range values. */ - properties: RequireAtLeastOne< { - [ K in Q ]?: - | SingleValue< K > - | ArrayValue< K > - | RangeValue< K >; - } >; - } ->; - -/** - * Represents a heterogeneous coupling of physical, primitive, and structured values. - * @template Q The physical quantities. - * @template T The primitives. - * @template S The structures. - */ -export type CoupledValue< - Q extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive, - S extends StructType = StructType -> = Expand< - BaseValue< ValueType.COUPLED > & { - /** A registry of various value types grouped under a single coupled entity. */ - properties: RequireAtLeastOne< { - [ K in Q ]?: - | PrimitiveValue< T > - | StructValue< S > - | SingleValue< K > - | ArrayValue< K > - | RangeValue< K >; - } >; - } ->; - -/** - * Generic numeric value for any physical quantity. - * @template Q The physical quantity. - */ -export type NumberValue< Q extends PhysicalQuantity = PhysicalQuantity > = - | SingleValue< Q > - | ArrayValue< Q > - | RangeValue< Q > - | CoupledNumberValue< Q >; - -/** - * The most abstract representation of a data value in the system. - * @template Q The physical quantities. - * @template T The primitives. - * @template S The structures. - */ -export type Value< - Q extends PhysicalQuantity = PhysicalQuantity, - T extends Primitive = Primitive, - S extends StructType = StructType -> = - | NumberValue< Q > - | PrimitiveValue< T > - | StructValue< S > - | CoupledValue< Q, T, S >; diff --git a/types/collection/abundance.ts b/types/collection/abundance.ts deleted file mode 100644 index 218195f2..00000000 --- a/types/collection/abundance.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file abundance.ts - * @description Defines the abundance of chemical elements and substances across various environments. - * This collection captures the relative presence of matter in the universe, solar system, - * Earth's layers, and biological systems. - */ - -import type { NaturalOccurrence } from '../../enum/element'; -import type { Collection, Single } from '../abstract/collection'; -import type { NumberProperty, PrimitiveProperty } from '../abstract/property'; - -/** - * Registry of environmental and geological occurrences. - */ -export type AbundanceCollection = Collection< { - /** The primary classification of how a substance exists or is formed on Earth. */ - naturalOccurrence?: Single< PrimitiveProperty< NaturalOccurrence > >; - - /** The estimated mass or molar fraction of the substance in the observable universe. */ - universeAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The estimated concentration of the substance within the entirety of the solar system. */ - solarSystemAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The concentration of the substance found in the Sun's photosphere or corona. */ - sunAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The characteristic concentration of the substance found in CI chondrite meteorites. */ - meteoriteAbundance?: Single< NumberProperty< 'massFraction' > >; - - /** The average mass fraction of the substance found in the Earth's continental crust. */ - crustalAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The average concentration of the substance within the global oceanic volume. */ - oceanAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The typical concentration of the substance found specifically in seawater. */ - seaAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The concentration of the substance found in terrestrial freshwater streams. */ - streamAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The volume or mass fraction of the substance within the planetary atmosphere. */ - atmosphereAbundance?: Single< NumberProperty< 'massFraction' > >; - - /** The average mass percentage of the substance found within the human body. */ - humanAbundance?: Single< NumberProperty< 'massFraction' > >; - - /** The relative typical concentration of the substance found in the Earth's mineralogy. */ - mineralAbundance?: Single< NumberProperty< 'massFraction' > >; - /** The concentration of the substance in economically exploitable geological formations. */ - oreAbundance?: Single< NumberProperty< 'massFraction' > >; -} >; diff --git a/types/collection/atomics.ts b/types/collection/atomics.ts deleted file mode 100644 index 3cccdcd1..00000000 --- a/types/collection/atomics.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file atomics.ts - * @description Defines atomic-level properties including nuclear structure, electron configuration, and elemental radii. - * This collection serves as the foundation for elemental classification and atomic behavior. - */ - -import type { ShellModel } from '../../enum/element'; -import type { Collection, Group, Single } from '../abstract/collection'; -import type { ArrayProperty, NumberProperty, PrimitiveProperty, StructProperty } from '../abstract/property'; - -/** - * Registry of properties defining the internal structure and behavior of an atom. - */ -export type AtomicsCollection = Collection< { - /** The total number of protons found in the nucleus of an atom. */ - atomicNumber?: Single< PrimitiveProperty< number > >; - /** The total count of protons and neutrons within the atomic nucleus. */ - massNumber?: Single< PrimitiveProperty< number > >; - - /** The specific distribution of electrons among the various atomic orbitals (e.g., "[Xe] 4f14 5d10 6s1"). */ - electronConfig?: Single< PrimitiveProperty< string > >; - /** The number of electrons in the outermost shell that participate in chemical bonding. */ - valenceElectrons?: Single< PrimitiveProperty< number > >; - /** The count of electrons residing within each principal energy level (K, L, M, etc.). */ - shellModel?: Single< StructProperty< { [ K in ShellModel ]?: number } > >; - - /** The cumulative energy required to remove successive electrons from a neutral atom in the gas phase. */ - ionizationEnergies?: Single< ArrayProperty< 'energy' > >; - - /** Grouping of properties related to the physical mass of the atom or nuclide. */ - mass?: Group< { - /** The actual mass of a single atom, typically expressed in unified atomic mass units (u). */ - atomicMass?: Single< NumberProperty< 'mass' > >; - /** The weighted average mass of an element's isotopes relative to 1/12th the mass of carbon-12. */ - standardAtomicWeight?: Single< NumberProperty< never > >; - /** The ratio of the average atomic mass of a sample to the atomic mass constant. */ - relativeAtomicMass?: Single< NumberProperty< never > >; - /** The difference between the actual atomic mass and the mass number, expressed in energy units. */ - massExcess?: Single< NumberProperty< 'energy' > >; - } >; - - /** Grouping of properties defining the spatial extent and radii of the atom. */ - radius?: Group< { - /** The observed or experimental distance from the nucleus to the outermost electron shell. */ - empiricalRadius?: Single< NumberProperty< 'length' > >; - /** The theoretically derived size of an atom based on quantum mechanical wave functions. */ - calculatedRadius?: Single< NumberProperty< 'length' > >; - /** Half the distance between the nuclei of two identical atoms joined by a single covalent bond. */ - covalentRadius?: Single< NumberProperty< 'length' > >; - /** The Van der Waals radius of an atom (the distance between the nuclei of two non-bonded atoms). */ - vdwRadius?: Single< NumberProperty< 'length' > >; - } >; - - /** Grouping of properties defining the electrical state and shielding of the nucleus. */ - charge?: Group< { - /** The net positive charge of the nucleus, determined by the number of protons. */ - nuclearCharge: Single< NumberProperty< never > >; - /** The net positive charge experienced by a valence electron after accounting for shielding by inner electrons. */ - effectiveCharge: Single< NumberProperty< never > >; - } >; - - /** Grouping of various scales for measuring an atom's tendency to attract bonding electrons. */ - electronegativity?: Group< { - /** The original dimensionless scale based on bond-dissociation energies. */ - pauling?: Single< NumberProperty< never > >; - /** A scale based on the relative stability of atomic volumes. */ - sanderson?: Single< NumberProperty< never > >; - /** A scale based on the electrostatic force exerted by the nucleus on valence electrons. */ - allredRochow?: Single< NumberProperty< never > >; - /** The arithmetic mean of the first ionization energy and electron affinity. */ - mulliken?: Single< NumberProperty< never > >; - /** A scale based on the average one-electron energy of valence shell electrons. */ - allen?: Single< NumberProperty< never > >; - /** A modern scale incorporating shell-wise screening and orbital energy. */ - ghoshGupta?: Single< NumberProperty< 'energy' > >; - /** A scale related to the polarizability and valence state of the atom. */ - nagle?: Single< NumberProperty< never > >; - /** A measure of chemical hardness and absolute electronegativity. */ - pearson?: Single< NumberProperty< 'energy' > >; - /** A scale based on effective nuclear charge and atomic radii. */ - martynov?: Single< NumberProperty< never > >; - /** A scale derived from the spectroscopic properties of atoms. */ - gordy?: Single< NumberProperty< never > >; - /** A scale based on the average binding energy of valence electrons. */ - rahm?: Single< NumberProperty< 'energy' > >; - } >; -} >; diff --git a/types/collection/chemistry.ts b/types/collection/chemistry.ts deleted file mode 100644 index d15d9a2a..00000000 --- a/types/collection/chemistry.ts +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @file chemistry.ts - * @description Defines macroscopic and molecular chemical properties, including thermodynamics, - * electrochemistry, solubility, and molecular geometry. - */ - -import type { - AcidBaseCharacter, BasicityType, BondType, Goldschmidt, HSAB, Hybridization, LewisModel, - MolecularShape, OxideCharacter, SolubilityQualifier -} from '../../enum/chemistry'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct, Group, Single } from '../abstract/collection'; -import type { NumberProperty, PrimitiveProperty, StructProperty } from '../abstract/property'; - -/** - * Registry of chemical properties describing the reactivity, structure, and energetics of substances. - */ -export type ChemistryCollection = Collection< { - /** The mass of one mole of the substance, typically in g/mol. */ - molarMass?: Single< NumberProperty< 'molarMass' > >; - /** The volume occupied by one mole of the substance under specific conditions. */ - molarVolume?: Single< NumberProperty< 'molarVolume' > >; - /** The entropy of one mole of a pure substance at a standard state of 1 bar. */ - standardMolarEntropy?: Single< NumberProperty< 'entropy' > >; - /** The sum of the atomic weights of all atoms in a molecule's formula (also named formula mass). */ - molecularMass?: Single< NumberProperty< 'mass' > >; - /** The ratio of the average mass of molecules of a substance to one-twelfth the mass of an atom of carbon-12. */ - relativeMolecularMass?: Single< NumberProperty< never > >; - - /** Grouping of properties related to the proton-donor or acceptor behavior. */ - basicity?: Group< { - /** The classification of a substance's ability to accept protons. */ - basicityType?: Single< PrimitiveProperty< BasicityType > >; - /** The overall nature of a substance in acid-base reactions (acidic, basic, amphoteric). */ - acidBaseCharacter?: Single< PrimitiveProperty< AcidBaseCharacter > >; - /** The negative logarithm of the acid dissociation constant. */ - pKa?: Single< NumberProperty< never > >; - /** The negative logarithm of the base dissociation constant. */ - pKb?: Single< NumberProperty< never > >; - /** The measure of acidity or basicity of an aqueous solution. */ - pH?: Single< NumberProperty< never > >; - /** The pH at which a particular molecule carries no net electrical charge. */ - isoelectricPoint?: Single< NumberProperty< never > >; - /** The classification based on the ability to accept or donate electron pairs. */ - lewisAcidity?: Single< PrimitiveProperty< LewisModel > >; - /** The classification based on the ability to donate electron pairs. */ - lewisBasicity?: Single< PrimitiveProperty< LewisModel > >; - /** The classification of elements based on their preferred natural host phases. */ - goldschmidt?: Single< PrimitiveProperty< Goldschmidt > >; - /** The Hard and Soft Acids and Bases classification of chemical species. */ - hsab?: Single< PrimitiveProperty< HSAB > >; - } >; - - /** Grouping of properties related to the loss or gain of electrons. */ - oxidation?: Group< { - /** The acidic or basic behavior of an element's oxide. */ - oxideCharacter?: Single< PrimitiveProperty< OxideCharacter > >; - /** The formal charge an atom would have if all bonds were ionic. */ - oxidationStates?: Single< StructProperty< { - /** The numeric value of the formal charge. */ - value: number; - /** Indicates if this is a primary or most common oxidation state. */ - main?: boolean; - /** Indicates if the state is unstable, rare or only occurs in specific complexes. */ - unstable?: boolean; - /** Specific chemical context or remarks regarding this oxidation state. */ - context?: string; - } > >; - } >; - - /** Grouping of properties related to the relationship between electricity and chemical change. */ - electrochemistry?: Group< { - /** The electromotive force of a cell under standard conditions. */ - standardPotential?: Single< NumberProperty< 'electricPotential' > >; - /** The potential of a reduction half-reaction under standard conditions. */ - standardReductionPotential?: Single< NumberProperty< 'electricPotential' > >; - /** The potential of an oxidation half-reaction under standard conditions. */ - standardOxidationPotential?: Single< NumberProperty< 'electricPotential' > >; - /** The potential difference between a redox event's equilibrium potential and the actual applied potential. */ - overpotential?: Single< NumberProperty< 'electricPotential' > >; - /** The mass of a substance altered by one ampere-second of electric current. */ - electrochemicalEquivalent?: Single< NumberProperty< 'mass' > >; - } >; - - /** Grouping of thermodynamic energy state functions. */ - thermochemistry?: Group< { - /** The maximum amount of non-expansion work that can be extracted from a closed system. */ - standardGibbsEnergy?: Single< NumberProperty< 'energy' > >; - /** The energy required to break a molecule into its constituent atoms. */ - bindingEnergy?: Single< NumberProperty< 'energy' > >; - } >; - - /** Grouping of properties describing the ability of a substance to dissolve in various solvents. */ - solubility?: Group< { - /** The ratio of the concentration of a gas in a solution to its partial pressure in the gas phase. */ - henryConstant?: Single< NumberProperty< never > >; - /** Detailed solubility data for specific solvents. */ - solubilities?: Single< StructProperty< { - /** - * The identifier of the solvent used. - * Can be a common name ('water') or a compound/mixture id. - */ - solvent: Distinct< string | { - type: EntityType.COMPOUND | EntityType.MIXTURE; - id: string; - } >; - /** The quantitative measurement of solubility. */ - value?: Single< NumberProperty< 'concentration' > >; - /** - * The equilibrium constant for the dissolution of an ionic compound in a solvent. - * Only applicable for ionic compounds. - */ - ksp?: Single< NumberProperty< never > >; - /** A qualitative descriptor of the substance's capacity to dissolve. */ - qualifier?: Single< PrimitiveProperty< SolubilityQualifier > >; - } > >; - } >; - - /** Grouping of properties describing the three-dimensional arrangement of atoms in a molecule. */ - molecularStructure?: Group< { - /** The spatial arrangement of atoms in a molecule and the chemical bonds that hold them together. */ - shape?: Single< PrimitiveProperty< MolecularShape > >; - /** The concept of mixing atomic orbitals to form new hybrid orbitals suitable for bonding. */ - hybridization?: Single< PrimitiveProperty< Hybridization > >; - /** The number of atoms, groups, or lone pairs surrounding a central atom. */ - stericNumber?: Single< PrimitiveProperty< number > >; - /** A pair of valence electrons that are not shared with another atom in a covalent bond. */ - lonePairs?: Single< PrimitiveProperty< number > >; - /** The number of atoms or ions immediately surrounding a central atom in a complex or crystal. */ - coordinationNumber?: Single< PrimitiveProperty< number > >; - /** The average distance between the nuclei of two bonded atoms. */ - bondLength?: Single< NumberProperty< 'length' > >; - /** The angle formed between two adjacent bonds on the same atom. */ - bondAngle?: Single< NumberProperty< 'angle' > >; - /** The angle between two planes defined by two sets of three atoms. */ - torsionalAngle?: Single< NumberProperty< 'angle' > >; - /** The classification of the chemical connection between atoms (e.g., ionic, covalent). */ - bondType?: Single< PrimitiveProperty< BondType > >; - /** A measure of the number of chemical bonds between a pair of atoms. */ - bondOrder?: Single< PrimitiveProperty< number > >; - } >; -} >; diff --git a/types/collection/composition.ts b/types/collection/composition.ts deleted file mode 100644 index bd681a61..00000000 --- a/types/collection/composition.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file composition.ts - * @description Defines the chemical makeup of substances, including elemental components, - * stoichiometry, and various formula representations. - */ - -import type { ComponentRole } from '../../enum/chemistry'; -import type { ElementSymbol } from '../../enum/element'; -import type { Collection, Single } from '../abstract/collection'; -import type { PrimitiveProperty, StructProperty } from '../abstract/property'; - -/** - * Representation of a single chemical constituent within a substance. - */ -export type Component = { - /** The chemical symbol of the element (e.g., 'H', 'Fe'). */ - element: ElementSymbol; - /** The stoichiometric quantity or relative amount of the element. */ - quantity: number; - /** The functional role of the component within the structure (e.g., cation, ligand). */ - type?: ComponentRole; - /** The formal oxidation state or ionic charge of the component. */ - charge?: number; -}; - -/** - * Registry of properties describing the chemical identity and stoichiometric ratios. - */ -export type CompositionCollection = Collection< { - /** The list of individual elements and their quantities that make up the substance. */ - components: Single< StructProperty< Component > >; - /** The standard chemical representation showing the type and number of atoms (e.g., "H{2}O"). */ - formula: Single< PrimitiveProperty< string > >; - /** The simplest whole-number ratio of atoms in a compound. */ - empiricalFormula?: Single< PrimitiveProperty< string > >; - /** A formula showing the types and nodes of atoms without full structural detail. */ - condensedFormula?: Single< PrimitiveProperty< string > >; - /** The net electrical charge of the entire chemical entity. */ - charge?: Single< PrimitiveProperty< number > >; -} >; diff --git a/types/collection/crystallography.ts b/types/collection/crystallography.ts deleted file mode 100644 index a4efb371..00000000 --- a/types/collection/crystallography.ts +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @file crystallography.ts - * @description Defines properties related to the internal structural arrangement of crystals, - * their symmetry groups, and physical diagnostic features like cleavage and habit. - */ - -import type { - CleavageQuality, CleavageType, CrystalFamily, CrystalHabit, CrystalSystem, - FractureType, Tenacity, TwinningMode, TwinningType -} from '../../enum/crystallography'; -import type { ElementSymbol } from '../../enum/element'; -import type { Collection, Single } from '../abstract/collection'; -import type { PrimitiveProperty, StructProperty } from '../abstract/property'; -import type { NumberValue } from '../abstract/value'; - -/** - * Representation of a crystallographic point group (crystal class). - */ -export type PointGroup = { - /** The international number of the point group (1-32). */ - number: number; - /** The standard name of the point group. */ - name: string; - /** The Hermann-Mauguin notation (International notation) for the group. */ - hermannMauguin?: string; - /** The Schönflies notation for the point group symmetry. */ - schoenflies?: string; -}; - -/** - * Representation of a crystallographic space group. - */ -export type SpaceGroup = { - /** The sequential number of the space group in the International Tables for Crystallography (1-230). */ - number: number; - /** The full international symbol representing the symmetry operations and lattice type. */ - symbol: string; -}; - -/** - * Parameters defining the geometry and size of a crystal's unit cell. - */ -export type UnitCell = { - /** Lattice parameter representing the length of the 'a' axis. */ - a?: NumberValue< 'length' >; - /** Lattice parameter representing the length of the 'b' axis. */ - b?: NumberValue< 'length' >; - /** Lattice parameter representing the length of the 'c' axis. */ - c?: NumberValue< 'length' >; - /** Interaxial angle between the 'b' and 'c' axes. */ - alpha?: NumberValue< 'angle' >; - /** Interaxial angle between the 'a' and 'c' axes. */ - beta?: NumberValue< 'angle' >; - /** Interaxial angle between the 'a' and 'b' axes. */ - gamma?: NumberValue< 'angle' >; - /** The number of formula units contained within the volume of the unit cell. */ - Z?: number; -}; - -/** - * Registry of coordination numbers grouped by element. - */ -export type Ligancy = { - /** The number of neighboring atoms of a specific element surrounding a central atom. */ - [ K in ElementSymbol ]?: number; -}; - -/** - * Descriptive fields for twinning phenomena in crystals. - */ -export type Twinning = { - /** The categorization of the twinning mechanism (e.g., contact, penetration). */ - type?: TwinningType; - /** The specific mode of formation for the twin (e.g., growth, mechanical). */ - mode?: TwinningMode; - /** The specific Twin Law (e.g., "Albite Law") defining the orientation. */ - law?: string; - /** The symmetry operation (reflection, rotation) that relates the twin individuals. */ - operation?: string; -}; - -/** - * Descriptive fields for the cleavage properties of a crystalline substance. - */ -export type Cleavage = { - /** The structural nature of the cleavage (e.g., octahedral, prismatic). */ - type?: CleavageType; - /** The degree of ease and smoothness with which the crystal splits. */ - quality?: CleavageQuality; - /** The orientation of the cleavage plane expressed as Miller indices {hkl}. */ - millerIndex?: string; -}; - -/** - * Descriptive fields for the fracture and mechanical tenacity of a material. - */ -export type Fracture = { - /** The characteristic appearance of the broken surface (e.g., conchoidal). */ - type?: FractureType; - /** The resistance of the material to the propagation of cracks. */ - toughness?: NumberValue< 'energy' >; - /** The behavior of the material under stress (e.g., brittle, malleable). */ - tenacity?: Tenacity; -}; - -/** - * Registry of crystallographic and structural properties. - */ -export type CrystallographyCollection = Collection< { - /** The high-level grouping of crystal systems based on shared cell dimensions. */ - family?: Single< PrimitiveProperty< CrystalFamily > >; - /** The categorization of crystal symmetry into one of the seven systems (e.g., Cubic). */ - system?: Single< PrimitiveProperty< CrystalSystem > >; - /** A notation used to describe crystal structures in terms of lattice type and number of atoms. */ - pearsonSymbol?: Single< PrimitiveProperty< string > >; - /** The specific set of symmetry operations that leave at least one point unmoved. */ - pointGroup?: Single< StructProperty< PointGroup > >; - /** The symmetry of the diffraction pattern produced by the crystal. */ - laueGroup?: Single< PrimitiveProperty< string > >; - /** The full symmetry group of the crystal lattice, including translational symmetry. */ - spaceGroup?: Single< StructProperty< SpaceGroup > >; - /** The geometric dimensions and angles that define the repeating lattice unit. */ - unitCell?: Single< StructProperty< UnitCell > >; - /** The coordination environment of the constituent atoms. */ - ligancy?: Single< StructProperty< Ligancy > >; - /** The typical outward appearance and growth form of the individual crystals. */ - crystalHabit?: Single< PrimitiveProperty< CrystalHabit > >; - /** The phenomenon where two or more crystals share some lattice points in a symmetrical way. */ - twinning?: Single< StructProperty< Twinning > >; - /** The tendency of the material to split along specific crystallographic planes. */ - cleavage?: Single< StructProperty< Cleavage > >; - /** The pattern of breakage that occurs when a crystal is broken across non-cleavage planes. */ - fracture?: Single< StructProperty< Fracture > >; -} >; diff --git a/types/collection/descriptive.ts b/types/collection/descriptive.ts deleted file mode 100644 index 3a086462..00000000 --- a/types/collection/descriptive.ts +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file descriptive.ts - * @description Defines qualitative, historical, and multi-media properties that provide a human-readable - * and historical context for chemical substances. - */ - -import type { ImageFormat, LangCode } from '../../enum/util'; -import type { BlobId } from '../abstract/blob'; -import type { Collection, Distinct, Group } from '../abstract/collection'; -import type { RefId } from '../abstract/reference'; -import type { Attribution, ISO8601Date, LangGroup } from '../abstract/util'; -import type { RegistryGroup, StructureGroup } from './registry'; - -/** - * Historical metadata concerning the first identification of a substance. - */ -export type DiscoveryGroup = Group< { - /** The year or period when the substance was discovered or first identified. */ - year?: Distinct< string >; - /** The name of the individuals primarily credited with the discovery. */ - discoverer?: Distinct< string | string[] >; - /** The country or region where the discovery took place (ISO 3166-1 alpha-2). */ - country?: Distinct< string | string[] >; - /** The university or organization where the research was conducted. */ - institute?: Distinct< string | string[] >; - /** Additional scientific or regulatory remarks concerning the discovery. */ - notes?: Distinct< string >; - /** References to the original discovery papers or announcements. */ - references?: RefId[]; -} >; - -/** - * Visual and spectral data representing the physical appearance of the substance. - */ -export type MediaGroup = Group< { - /** Photographic or diagrammatic images of the substance. */ - images?: Distinct< { - /** The absolute URL or path to the image file. */ - url: string; - /** The file encoding format of the image. */ - format?: ImageFormat; - /** Legal and creative attribution for the binary asset. */ - attribution?: Attribution; - /** Physical width of the original image in pixels. */ - width?: number; - /** Physical height of the original image in pixels. */ - height?: number; - }[] >; - - /** Characteristic fingerprint data from various spectroscopic techniques. */ - spectrum?: Group< { - /** Base64 encoded data for the absorption spectrum. */ - absorption?: BlobId; - /** Base64 encoded data for the emission spectrum. */ - emission?: BlobId; - /** Base64 encoded data for ultraviolet-visible spectroscopy data. */ - uv?: BlobId; - /** Base64 encoded data for X-ray diffraction or spectroscopy. */ - xray?: BlobId; - } >; - - /** Data files for rendering three-dimensional molecular or crystal structures. */ - structure3D?: BlobId[]; -} >; - -/** - * External links and digital pointers for further research. - */ -export type WeblinksGroup = Group< { - /** A collection of relevant scientific or educational web resources. */ - links?: Distinct< { - /** The destination URL of the link. */ - url: string; - /** The display text for the hyperlink. */ - text?: string; - /** A short summary of the content found at the link. */ - description?: string; - /** Link to a permanent archive version (e.g., Wayback Machine). */ - archiveUrl?: string; - /** The ISO 8601 date the link was last verified for content. */ - accessed?: ISO8601Date; - /** The language of the linked page. */ - language?: LangCode; - }[] >; - /** Localized links to corresponding Wikipedia articles. */ - wiki?: LangGroup; -} >; - -/** - * Registry of properties providing descriptive, historical, and multi-media metadata. - */ -export type DescriptiveCollection = Collection< { - /** External database identifiers and regulatory registry numbers. */ - registry: RegistryGroup; - /** Encoded structural strings for computational chemistry (SMILES, InChI). */ - structure: StructureGroup; - /** The standardized scientific and common name(s) of the substance. */ - names: LangGroup< LangCode.ENGLISH | LangCode.LATIN, string[] >; - /** A concise scientific overview of the substance's nature and significance. */ - description?: LangGroup; - /** Qualitative description of the substance's physical form and color. */ - appearance?: LangGroup; - /** The characteristic odor profile of the substance. */ - odor?: LangGroup; - /** The historical context of the substance's discovery. */ - discovery?: DiscoveryGroup; - /** Visual and spectral representations of the substance. */ - media?: MediaGroup; - /** External digital resources and citations. */ - weblinks?: WeblinksGroup; -} >; diff --git a/types/collection/generic.ts b/types/collection/generic.ts deleted file mode 100644 index db2fc893..00000000 --- a/types/collection/generic.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file generic.ts - * @description Defines general-purpose properties that do not fit into specific scientific domains, - * such as economic data or cross-domain metadata. - */ - -import type { Collection, Single } from '../abstract/collection'; -import type { StructProperty } from '../abstract/property'; -import type { ISO8601Date } from '../abstract/util'; -import type { NumberValue } from '../abstract/value'; - -/** - * Registry of non-scientific or general properties associated with a substance. - */ -export type GenericCollection = Collection< { - /** The commercial market value of the substance at a specific point in time. */ - price: Single< StructProperty< { - /** The numerical amount and currency of the price. */ - value: NumberValue< 'currency' >; - /** The ISO 8601 date when this specific price was recorded. */ - date?: ISO8601Date; - /** The specific stock exchange or commercial market where the price was observed. */ - market?: string; - /** External URL for the price source or market documentation. */ - url?: string; - } > >; -} >; diff --git a/types/collection/nuclear.ts b/types/collection/nuclear.ts deleted file mode 100644 index 7c82c587..00000000 --- a/types/collection/nuclear.ts +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @file nuclear.ts - * @description Defines the nuclear structure and properties of radionuclides, including - * energy levels, decay modes, and nuclear magnetic resonance properties. - */ - -import type { DecayMode, RadiationType, SpinParity } from '../../enum/nuclear'; -import type { Collection, Single } from '../abstract/collection'; -import type { StructProperty } from '../abstract/property'; -import type { NumberValue, PrimitiveValue } from '../abstract/value'; - -/** - * Representation of the nuclear spin state. - */ -export type Spin = { - /** The symmetry of the wave function under spatial inversion. */ - parity: SpinParity; - /** The spectroscopic notation/label for the spin state (e.g., "1/2-"). */ - value: string; - /** The numerical value of the total angular momentum quantum number J. */ - calculatedValue: number; -}; - -/** - * Properties related to Nuclear Magnetic Resonance (NMR) spectroscopy. - */ -export type NMR = { - /** The intrinsic angular momentum of the nucleus. */ - spin?: Spin; - /** The ratio of a nucleus's magnetic moment to its angular momentum. */ - gyromagneticRatio?: NumberValue< 'gyromagneticRatio' >; - /** The frequency at which the magnetic moment of a nucleus precesses around an external field. */ - larmorPrecession?: NumberValue< 'frequency' >; - /** - * The relative sensitivity of the nucleus to magnetic fields compared to a reference nucleus. - * An inherent problem with NMR spectroscopy is its comparatively low sensitivity (poor signal-to-noise ratio). - */ - relativeSensitivity?: PrimitiveValue< number >; -}; - -/** - * Parameters for a specific radioactive decay path. - */ -export type DecayChannel = { - /** The primary mechanism of the nuclear transformation (e.g., alpha, beta-minus). */ - mode: DecayMode; - /** The probability fraction of the parent nucleus decaying via this specific mode. */ - branchingRatio?: NumberValue< 'quantity' >; - /** The total energy released during the nuclear decay process (Q-value). */ - energy?: NumberValue< 'energy' >; - /** The types of ionizing radiation emitted during the decay. */ - radiation?: RadiationType[]; -}; - -/** - * The state of the nucleus with the lowest possible energy. - */ -export type GroundState = { - /** The fundamental energy state (defined as zero for the ground state). */ - energy?: NumberValue< 'energy' >; - /** The nuclear angular momentum (spin) of the ground state. */ - angularMomentum?: Spin; - /** The time required for half of a sample of the radionuclide to decay. */ - halfLife?: NumberValue< 'time' >; - /** The relative abundance of this isotope found in a natural sample of the element. */ - isotopeAbundance?: NumberValue< 'massFraction' >; - - /** The physical mass of the neutral atom in its ground state. */ - isotopeMass?: NumberValue< 'mass' >; - /** The root-mean-square radius of the nuclear charge distribution. */ - chargeRadius?: NumberValue< 'length' >; - /** The difference between the actual atomic mass and the mass number. */ - massExcess?: NumberValue< 'energy' >; - /** The magnetic dipole moment of the nucleus in its ground state. */ - dipoleMoment?: NumberValue< 'magneticMoment' >; - /** The measure of the non-sphericity of the nuclear charge distribution. */ - quadrupoleMoment?: NumberValue< 'area' >; - /** The quantum number related to the symmetry between protons and neutrons. */ - isoSpin?: Spin; - - /** The set of observed radioactive decay pathways from the ground state. */ - decayChannel?: DecayChannel[]; - - /** The energy required to disassemble the nucleus into its constituent nucleons. */ - bindingEnergy?: NumberValue< 'energy' >; - /** The energy released during alpha particle emission. */ - alphaDecayEnergy?: NumberValue< 'energy' >; - /** The energy released during beta decay. */ - betaDecayEnergy?: NumberValue< 'energy' >; - /** The energy released when an atomic electron is absorbed by a proton in the nucleus. */ - electronCaptureEnergy?: NumberValue< 'energy' >; - /** The energy required to remove a neutron from the nucleus. */ - neutronEmissionEnergy?: NumberValue< 'energy' >; - /** The minimum energy to separate a single neutron from the nucleus. */ - neutronSeparationEnergy?: NumberValue< 'energy' >; - /** The minimum energy to separate a single proton from the nucleus. */ - protonSeparationEnergy?: NumberValue< 'energy' >; - /** The energy difference between the ground state and an excited nuclear level. */ - excitationEnergy?: NumberValue< 'energy' >; -}; - -/** - * A discrete excited energy state of the atomic nucleus. - */ -export type Level = { - /** The energy of the excited state relative to the ground state. */ - energy?: NumberValue< 'energy' >; - /** The spin-parity of the excited nuclear level. */ - angularMomentum?: Spin; - /** The rotational or vibrational band to which the level belongs. */ - band?: number; - /** The mean lifetime or half-life of the excited state. */ - halfLife?: NumberValue< 'time' >; - /** The relative population probability found in specific environments. */ - isotopeAbundance?: NumberValue< 'massFraction' >; - /** The magnetic dipole moment of the excited state. */ - dipoleMoment?: NumberValue< 'magneticMoment' >; - /** The electric quadrupole moment of the excited state. */ - quadrupoleMoment?: NumberValue< 'area' >; - /** The isospin quantum number of the excited level. */ - isoSpin?: Spin; - /** The possible decay modes from this excited state. */ - decayChannel?: DecayChannel[]; -}; - -/** - * A discrete energy state of the atomic nucleus. - */ -export type NuclearState = { - /** The energy of the excited state relative to the ground state. */ - energy?: NumberValue< 'energy' >; - /** The spin-parity of the excited nuclear level. */ - angularMomentum?: Spin; -} - -/** - * Properties of a gamma-ray transition between nuclear energy levels. - */ -export type GammaTransition = { - /** The properties of the nuclear state before the photon emission. */ - initial?: NuclearState; - /** The properties of the nuclear state after the photon emission. */ - final?: NuclearState; - /** The lifetime of the excited state before gamma emission. */ - halfLife?: NumberValue< 'time' >; - /** The energy of the emitted gamma-ray photon. */ - transitionEnergy?: NumberValue< 'energy' >; - /** The observed intensity of the gamma line relative to other transitions. */ - relativeIntensity?: NumberValue< 'quantity' >; - /** The ratio of the different multipole components (e.g., E2/M1) in the transition. */ - gRayMixingRatio?: PrimitiveValue< number >; - /** The ratio of internal conversion electrons to gamma-ray photons emitted. */ - conversionCoefficient?: PrimitiveValue< number >; - /** The reduced probability for the electric part of the transition. */ - reducedElectricProbability?: PrimitiveValue< number >; - /** The transition probability for the magnetic part of the electromagnetic decay. */ - magneticTransitionProbability?: PrimitiveValue< number >; - /** The electromagnetic character of the transition (e.g., E1, M1, E2). */ - multipolarity?: string; -}; - -/** - * Registry of properties defining the nuclear and isotopic characteristics of matter. - */ -export type NuclearCollection = Collection< { - /** The nuclear magnetic resonance characteristics used in spectroscopy and imaging. */ - nmr?: Single< StructProperty< NMR > >; - /** The fundamental properties of the nucleus in its absolute minimum energy state. */ - ground?: Single< StructProperty< GroundState > >; - /** The collection of discrete excited energy states and their properties. */ - level?: Single< StructProperty< Level > >; - /** The electromagnetic transitions between different nuclear states. */ - gamma?: Single< StructProperty< GammaTransition > >; -} >; diff --git a/types/collection/physics.ts b/types/collection/physics.ts deleted file mode 100644 index 7cdc0d28..00000000 --- a/types/collection/physics.ts +++ /dev/null @@ -1,216 +0,0 @@ -/** - * @file physics.ts - * @description Defines macroscopic physical properties of substances, covering thermodynamics, mechanics, - * electromagnetism, and optical characteristics. - */ - -import type { Diaphaneity, Gloss, Lustre, MagneticOrdering, Phase, Superconductivity } from '../../enum/physics'; -import type { Collection, Group, Single } from '../abstract/collection'; -import type { CoupledNumberProperty, NumberProperty, PrimitiveProperty } from '../abstract/property'; -import type { LangGroup } from '../abstract/util'; - -/** - * Registry of physical properties describing the macroscopic behavior and state of matter. - */ -export type PhysicsCollection = Collection< { - /** The mass per unit volume of the substance under specific conditions. */ - density?: Single< NumberProperty< 'density' > >; - /** The ratio of the density of the substance to the density of a reference material (usually water). */ - relativeDensity?: Single< NumberProperty< never > >; - /** The primary physical state (solid, liquid, gas, plasma) of the substance. */ - phase?: Single< PrimitiveProperty< Phase > >; - - /** Grouping of temperature-dependent phase transitions and thermal limits. */ - temperature?: Group< { - /** The temperature at which a solid substance changes state to a liquid. */ - meltingPoint?: Single< NumberProperty< 'temperature' > >; - /** The temperature at which the vapor pressure of a liquid equals the external pressure. */ - boilingPoint?: Single< NumberProperty< 'temperature' > >; - /** The temperature range over which a substance remains in the liquid phase. */ - liquidRange?: Single< NumberProperty< 'temperature' > >; - /** The temperature at which a structural or electronic phase transition occurs. */ - transitionTemp?: Single< NumberProperty< 'temperature' > >; - /** The temperature at which a solid changes directly into a gas without passing through the liquid phase. */ - sublimationPoint?: Single< NumberProperty< 'temperature' > >; - /** The lowest temperature at which vapors of a fluid will ignite when given an ignition source. */ - flashPoint?: Single< NumberProperty< 'temperature' > >; - /** The temperature at which a substance spontaneously ignites in a normal atmosphere. */ - autoignitionTemp?: Single< NumberProperty< 'temperature' > >; - /** The state (temperature and pressure) above which distinct liquid and gas phases do not exist. */ - criticalPoint?: Single< CoupledNumberProperty< 'temperature' | 'pressure' > >; - /** The state (temperature and pressure) at which solid, liquid, and gas phases coexist in equilibrium. */ - triplePoint?: Single< CoupledNumberProperty< 'temperature' | 'pressure' > >; - /** A measure of the maximum frequency of lattice vibrations in a solid. */ - debyeTemp?: Single< NumberProperty< 'temperature' > >; - } >; - - /** Grouping of thermodynamic energy changes associated with phase or chemical transitions. */ - enthalpy?: Group< { - /** The energy required to change a substance from solid to liquid without changing its temperature. */ - fusionEnthalpy?: Single< NumberProperty< 'energy' > | NumberProperty< 'enthalpy' > >; - /** The energy required to change a substance from liquid to gas at its boiling point. */ - vaporisationEnthalpy?: Single< NumberProperty< 'energy' > | NumberProperty< 'enthalpy' > >; - /** The energy required for the direct transition of a solid to a gaseous state. */ - sublimationEnthalpy?: Single< NumberProperty< 'energy' > | NumberProperty< 'enthalpy' > >; - /** The energy change required to separate a molecule into its constituent atoms. */ - atomizationEnthalpy?: Single< NumberProperty< 'energy' > | NumberProperty< 'enthalpy' > >; - /** The change in enthalpy during the formation of one mole of a substance from its constituent elements. */ - formationEnthalpy?: Single< NumberProperty< 'energy' > | NumberProperty< 'enthalpy' > >; - /** The energy released as heat when a substance undergoes complete combustion with oxygen. */ - combustionEnthalpy?: Single< NumberProperty< 'energy' > | NumberProperty< 'enthalpy' > >; - } >; - - /** Grouping of thermal transport and storage properties. */ - heat?: Group< { - /** The amount of heat required to raise the temperature of a given amount of substance by one degree. */ - heatCapacity?: Single< NumberProperty< 'heatCapacity' > >; - /** The heat capacity of one mole of the substance. */ - molarHeatCapacity?: Single< NumberProperty< 'molarHeatCapacity' > >; - /** The heat capacity per unit mass of the substance. */ - specificHeatCapacity?: Single< NumberProperty< 'specificHeatCapacity' > >; - /** The rate at which heat passes through a specific thickness of the material. */ - thermalConductivity?: Single< NumberProperty< 'thermalConductivity' > >; - /** The tendency of matter to change its shape, area, and volume in response to a change in temperature. */ - thermalExpansion?: Single< NumberProperty< 'thermalExpansion' > >; - /** The rate of temperature spread through a material. */ - thermalDiffusivity?: Single< NumberProperty< 'thermalDiffusivity' > >; - /** The minimum energy needed to remove an electron from a solid to a point in the vacuum. */ - workFunction?: Single< NumberProperty< 'energy' > >; - /** The ratio of the heat capacity at constant pressure to heat capacity at constant volume. */ - adiabaticIndex?: Single< NumberProperty< never > >; - } >; - - /** Grouping of mechanical resistance scales for surface deformation. */ - hardness?: Group< { - /** Hardness measured by the indentation depth of a hard steel or carbide ball. */ - brinellHardness?: Single< NumberProperty< never > >; - /** A qualitative scale of mineral hardness based on scratch resistance. */ - mohsHardness?: Single< NumberProperty< never > >; - /** Hardness measured using a square-based diamond pyramid indenter. */ - vickersHardness?: Single< NumberProperty< never > >; - /** Hardness based on the depth of penetration of a diamond or ball indenter. */ - rockwellHardness?: Single< NumberProperty< never > >; - /** Microhardness test for thin or brittle materials using a rhombic diamond indenter. */ - knoopHardness?: Single< NumberProperty< never > >; - } >; - - /** Grouping of properties describing the deformation of a material under stress. */ - elasticity?: Group< { - /** Resistance of a substance to uniform compression. */ - bulkModulus?: Single< NumberProperty< 'pressure' > >; - /** Resistance of a material to shearing deformation. */ - shearModulus?: Single< NumberProperty< 'pressure' > >; - /** A measure of the stiffness of a solid material (tensile elasticity). */ - youngModulus?: Single< NumberProperty< 'pressure' > >; - /** The ratio of transverse strain to axial strain. */ - poissonRatio?: Single< NumberProperty< never > >; - /** The fractional volume change per unit change in pressure. */ - compressibility?: Single< NumberProperty< 'compressibility' > >; - /** The maximum stress that a material can withstand while being stretched. */ - tensileStrength?: Single< NumberProperty< 'pressure' > >; - /** The stress level at which a material begins to deform plastically. */ - yieldStrength?: Single< NumberProperty< 'pressure' > >; - /** The maximum stress a material can withstand before failing. */ - ultimateStrength?: Single< NumberProperty< 'pressure' > >; - } >; - - /** Grouping of properties related to the movement of charge carriers. */ - electricity?: Group< { - /** A measure of a material's ability to conduct an electric current. */ - conductivity?: Single< NumberProperty< 'electricConductivity' > >; - /** A measure of how strongly a material opposes the flow of electric current. */ - resistivity?: Single< NumberProperty< 'electricResistivity' > >; - /** The relative change of a physical property per degree of temperature change. */ - tempCoefficient?: Single< NumberProperty< 'tempCoefficient' > >; - /** The type or mechanism of zero electrical resistance behavior. */ - superconductivity?: Single< PrimitiveProperty< Superconductivity > >; - /** The critical temperature below which a material becomes superconducting. */ - superconductingPoint?: Single< NumberProperty< 'temperature' > >; - /** The energy range in a solid where no electron states can exist. */ - bandGap?: Single< NumberProperty< 'energy' > >; - /** A measure of a material's ability to store electrical energy in an electric field. */ - dielectricConstant?: Single< NumberProperty< never > >; - /** The product of magnitude of charges and distance between them in a molecule. */ - dipoleMoment?: Single< NumberProperty< 'dipoleMoment' > >; - } >; - - /** Grouping of properties describing a material's response to magnetic fields. */ - magnetism?: Group< { - /** The fundamental magnetic state of the material (e.g., ferromagnetism). */ - magneticOrdering?: Single< PrimitiveProperty< MagneticOrdering > >; - /** A measure of the degree to which a substance becomes magnetized in an external field. */ - magneticSusceptibility?: Single< NumberProperty< 'magneticSusceptibility' > >; - /** The magnetic susceptibility per mole of the substance. */ - molarMagneticSusceptibility?: Single< NumberProperty< 'molarMagneticSusceptibility' > >; - /** The magnetic susceptibility per unit mass of the substance. */ - massMagneticSusceptibility?: Single< NumberProperty< 'massMagneticSusceptibility' > >; - /** The temperature above which a ferromagnetic material becomes paramagnetic. */ - curiePoint?: Single< NumberProperty< 'temperature' > >; - /** The temperature above which an antiferromagnetic material becomes paramagnetic. */ - neelPoint?: Single< NumberProperty< 'temperature' > >; - /** The magnetic strength and orientation of a magnet or other object that produces a magnetic field. */ - magneticMoment?: Single< NumberProperty< 'magneticMoment' > >; - /** The resistance of a ferromagnetic material to changes in magnetization. */ - coercivity?: Single< NumberProperty< 'magneticFieldStrength' > >; - /** The magnetization left behind after an external magnetic field is removed. */ - remanence?: Single< NumberProperty< 'magneticFluxDensity' > >; - /** The ability of a material to support the formation of a magnetic field within itself. */ - permeability?: Single< NumberProperty< 'magneticPermeability' > >; - } >; - - /** Grouping of properties describing the behavior of light within and on the surface of the material. */ - optics?: Group< { - /** The ratio of the speed of light in vacuum to the speed of light in the medium. */ - refractiveIndex?: Single< NumberProperty< never > >; - /** The fraction of incident electromagnetic power that is reflected at an interface. */ - reflectance?: Single< NumberProperty< never > >; - /** The difference between the refractive indices for light with different polarizations. */ - birefringence?: Single< NumberProperty< never > >; - /** The angle between the optical axes in biaxial crystals. */ - v2Angle?: Single< NumberProperty< 'angle' > >; - /** A measure of the rate of decrease in the intensity of electromagnetic radiation as it passes through a given substance. */ - absorptionCoefficient?: Single< NumberProperty< 'absorptionCoefficient' > >; - /** The ratio of the energy radiated from a material's surface to that radiated from a blackbody. */ - emissivity?: Single< NumberProperty< never > >; - /** The fraction of incident light that passes through the sample. */ - transmittance?: Single< NumberProperty< never > >; - /** The measure of impenetrability to electromagnetic or other kinds of radiation. */ - opacity?: Single< NumberProperty< never > >; - /** The attribute of visual perception by which a body appears to reflect light specularly. */ - gloss?: Single< PrimitiveProperty< Gloss > >; - /** The appearance of a material surface in terms of its light-reflective qualities. */ - lustre?: Single< PrimitiveProperty< Lustre > >; - /** The degree to which a substance allows light to pass through it. */ - diaphaneity?: Single< PrimitiveProperty< Diaphaneity > >; - /** The perceived color of the substance in its bulk form. */ - color?: LangGroup; - /** The color of the powder produced when the material is dragged across an unweathered surface. */ - streak?: LangGroup; - } >; - - /** Grouping of properties related to the transmission of mechanical waves. */ - acoustics?: Group< { - /** The distance traveled per unit time by a sound wave as it propagates through a medium. */ - soundSpeed?: Single< NumberProperty< 'velocity' > >; - /** The product of the density of the medium and the speed of sound in it. */ - acousticImpedance?: Single< NumberProperty< 'acousticImpedance' > >; - /** The rate at which sound energy is lost as it propagates through a material. */ - attenuationCoefficient?: Single< NumberProperty< 'attenuationCoefficient' > >; - } >; - - /** Grouping of properties describing the interface between different phases. */ - surface?: Group< { - /** The elastic-like force that exists in the surface of a liquid, tending to minimize surface area. */ - surfaceTension?: Single< NumberProperty< 'surfaceTension' > >; - /** The angle at which a liquid-vapor interface meets a solid surface. */ - contactAngle?: Single< NumberProperty< 'angle' > >; - } >; - - /** Grouping of properties describing the internal friction of a fluid. */ - viscosity?: Group< { - /** A measure of the resistance of a fluid to deformation under shear stress. */ - dynamicViscosity?: Single< NumberProperty< 'dynamicViscosity' > >; - /** The ratio of dynamic viscosity to the density of the fluid. */ - kinematicViscosity?: Single< NumberProperty< 'kinematicViscosity' > >; - } >; -} >; diff --git a/types/collection/registry.ts b/types/collection/registry.ts deleted file mode 100644 index 8da5f569..00000000 --- a/types/collection/registry.ts +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @file registry.ts - * @description Defines cross-references to international chemical databases and structural - * representations used in cheminformatics. - */ - -import type { Distinct, Group } from '../abstract/collection'; - -/** Chemical Abstracts Service (CAS) Registry Number. */ -export type CASNumber = `${number}-${number}-${number}`; -/** PubChem Compound Identification (CID). */ -export type PubChemCID = `${number}`; -/** ChemSpider Database Identifier. */ -export type ChemSpiderID = `${number}`; -/** Chemical Entities of Biological Interest (ChEBI) ID. */ -export type ChEBIID = `CHEBI:${number}`; -/** ChEMBL bioactivity database identifier. */ -export type ChEMBLID = `CHEMBL${number}`; -/** Kyoto Encyclopedia of Genes and Genomes (KEGG) identifier. */ -export type KEGGID = `C${string}` | `D${string}`; -/** European Chemicals Agency (ECHA) InfoCard identifier. */ -export type ECHAInfoCard = `100.${number}.${number}`; -/** European Community (EC) Number for substances in the EU. */ -export type ECNumber = `${number}-${number}-${number}`; -/** Registry of Toxic Effects of Chemical Substances (RTECS) identifier. */ -export type RTECSNumber = `RTECS${string}`; -/** FDA/USP Unique Ingredient Identifier. */ -export type UNII = string; -/** National Cancer Institute (NCI) NSC Number. */ -export type NSCNumber = `NSC${number}`; -/** DrugBank database identifier. */ -export type DrugBankID = `DB${string}`; -/** Anatomical Therapeutic Chemical (ATC) classification code. */ -export type ATCCode = string; -/** Beilstein database internal number for organic compounds. */ -export type BeilsteinNumber = `${number}`; -/** Gmelin database internal number for inorganic and organometallic compounds. */ -export type GmelinNumber = `${number}`; -/** Protein Data Bank (PDB) structure identifier. */ -export type PDBID = string; -/** Wikidata unique item identifier. */ -export type WikidataID = `Q${number}`; - -/** - * Registry of identifiers for cross-referencing external scientific databases. - */ -export type RegistryGroup = Group< { - /** The unique numerical identifier assigned by the Chemical Abstracts Service. */ - cas?: Distinct< CASNumber >; - /** The compound identifier within the PubChem database. */ - cid?: Distinct< PubChemCID >; - - /** The unique numerical identifier for the ChemSpider repository. */ - chemspider?: Distinct< ChemSpiderID >; - /** The identifier for the Chemical Entities of Biological Interest database. */ - chebi?: Distinct< ChEBIID >; - /** The identifier for the ChEMBL database of bioactive molecules. */ - chembl?: Distinct< ChEMBLID >; - /** The compound or drug entry identifier in the KEGG database. */ - kegg?: Distinct< KEGGID >; - - /** The identifier used to access the ECHA InfoCard summary page. */ - echa?: Distinct< ECHAInfoCard >; - /** The official number for substances in the European Union (EINECS, ELINCS, NLP). */ - ec?: Distinct< ECNumber >; - /** Specifically the European Inventory of Existing Commercial Chemical Substances number. */ - einecs?: Distinct< ECNumber >; - /** Specifically the European List of Notified Chemical Substances number. */ - elincs?: Distinct< ECNumber >; - - /** The identifier for the Registry of Toxic Effects of Chemical Substances. */ - rtecs?: Distinct< RTECSNumber >; - /** The FDA's permanent and unambiguous unique ingredient identifier. */ - unii?: Distinct< UNII >; - /** The Cancer Chemotherapy National Service Center (NSC) Number. */ - nsc?: Distinct< NSCNumber >; - - /** The unique identifier for the DrugBank database. */ - drugbank?: Distinct< DrugBankID >; - /** The system of classification for medical drugs according to the organ or system on which they act. */ - atc?: Distinct< ATCCode[] >; - - /** The internal registry number for the Beilstein database. */ - beilstein?: Distinct< BeilsteinNumber >; - /** The internal registry number for the Gmelin database. */ - gmelin?: Distinct< GmelinNumber >; - - /** The unique identifier for molecular structures in the Protein Data Bank. */ - pdb?: Distinct< PDBID[] >; - - /** The permanent identifier for the corresponding Wikidata item. */ - wikidata?: Distinct< WikidataID >; -} >; - -/** IUPAC International Chemical Identifier string. */ -export type InChI = `InChI=${string}`; -/** Hashed version of the InChI string for efficient database searching. */ -export type InChIKey = `${string}-${string}-${string}`; -/** Simplified Molecular Input Line Entry System string for chemical topology. */ -export type SMILES = string; -/** The canonicalized version of a SMILES string to ensure uniqueness. */ -export type CanonicalSMILES = string; -/** A SMILES string that includes stereochemical information. */ -export type IsomericSMILES = string; -/** SMarts ARbitrary Target Specification string for substructure searching. */ -export type SMARTS = string; -/** Wiswesser Line Notation; a predecessor to SMILES. */ -export type WLN = string; -/** The systematic chemical name according to IUPAC nomenclature rules. */ -export type IUPACName = string; - -/** - * Registry of machine-readable structural representations. - */ -export type StructureGroup = Group< { - /** The full IUPAC International Chemical Identifier. */ - inChI?: Distinct< InChI >; - /** The fixed-length condensed digital signature of the InChI identifier. */ - inChIkey?: Distinct< InChIKey >; - /** The basic SMILES representation of the molecule's connectivity. */ - smiles?: Distinct< SMILES >; - /** The uniquely defined canonical SMILES string for the molecule. */ - canonicalSmiles?: Distinct< CanonicalSMILES >; - /** The SMILES string capturing chiral and geometric isomerism. */ - isomericSmiles?: Distinct< IsomericSMILES >; - /** The SMARTS string for substructure pattern matching. */ - smarts?: Distinct< SMARTS >; - /** The vintage Wiswesser Line Notation for the substance. */ - wln?: Distinct< WLN >; - /** The official recognized systematic name of the substance. */ - iupacName?: Distinct< IUPACName >; -} >; diff --git a/types/collection/safety.ts b/types/collection/safety.ts deleted file mode 100644 index 46c922bb..00000000 --- a/types/collection/safety.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @file safety.ts - * @description Defines properties and classifications for chemical safety, hazard identification, - * and toxicological risks based on international regulatory standards. - */ - -import type { - ADRClass, DOTClass, GHSClass, GHSPictogram, NFPACode, NFPANotice, SignalWord, - ToxicityApplication, ToxicityType, WHMISClass -} from '../../enum/safety'; -import type { Collection, Distinct, Group, Single } from '../abstract/collection'; -import type { StructProperty } from '../abstract/property'; -import type { RefId } from '../abstract/reference'; -import type { RangeValue, SingleValue } from '../abstract/value'; - -/** Hazard statements (H-phrases) defined by the GHS. */ -export type HStatement = `H${ '2' | '3' | '4' | '5' }${ string }`; -/** Precautionary statements (P-phrases) defined by the GHS. */ -export type PStatement = `P${ '1' | '2' | '3' | '4' | '5' }${ string }`; -/** Supplemental hazard information specific to the European Union (EUH-phrases). */ -export type EUHStatement = `EUH${ '0' | '2' | '3' | '4' }${ string }`; - -/** Kemler Code or Hazard Identification Number for dangerous goods transport. */ -export type HazardIdentification = `${ 'X' | '' }${ number }`; -/** Four-digit United Nations number used to identify hazardous substances in commerce. */ -export type UNNumber = `${ '0' | '1' | '2' | '3' | '8' | '9' }${ number }`; - -/** - * Standard ratings for the NFPA 704 "hazard diamond" used by emergency responders. - */ -export type NFPA = { - /** Health hazard rating (0-4). */ - health: NFPACode; - /** Flammability rating (0-4). */ - fire: NFPACode; - /** Instability/reactivity rating (0-4). */ - reactivity: NFPACode; - /** Special hazards like water reactivity or oxidizing properties. */ - specific?: NFPANotice; -}; - -/** - * Grouping of properties related to the immediate physical and health risks of a substance. - */ -export type HazardGroup = Group< { - /** Collection of standardized phrases describing the nature and prevention of hazards. */ - statements?: Group< { - /** Phrases describing the nature of physical, health, and environmental hazards. */ - hazard?: Distinct< HStatement[] >; - /** Phrases describing mandatory measures to minimize or prevent adverse effects. */ - precautionary?: Distinct< PStatement[] >; - /** Supplemental hazard statements specific to EU regulatory frameworks. */ - eu?: Distinct< EUHStatement[] >; - } >; - /** A word used to indicate the relative level of severity of a hazard (e.g., "danger"). */ - signalWord?: Distinct< SignalWord >; - /** Graphic elements intended to convey specific information on the hazard concerned. */ - pictograms?: Distinct< GHSPictogram[] >; - /** Classification of substances into categories defined by various safety frameworks. */ - classes?: Group< { - /** Categories defined by the Globally Harmonized System of Classification and Labelling of Chemicals. */ - ghs?: Distinct< GHSClass[] >; - /** Categories defined by the Workplace Hazardous Materials Information System. */ - whmis?: Distinct< WHMISClass[] >; - /** Categories defined by the Agreement concerning the International Carriage of Dangerous Goods by Road. */ - adr?: Distinct< ADRClass[] >; - /** Categories defined by the U.S. Department of Transportation. */ - dot?: Distinct< DOTClass[] >; - } >; - /** Transportation labels and identification numbers. */ - label?: Distinct< { - /** The Hazard Identification Number. */ - hazNo: HazardIdentification; - /** The UN identification number. */ - unNo: UNNumber; - }[] >; - /** The NFPA 704 fire diamond rating for the substance. */ - nfpa?: Distinct< NFPA >; - /** Additional scientific or regulatory remarks concerning the safety profile. */ - note?: Distinct< string >; - /** References to safety data sheets (SDS). */ - references?: RefId[]; -} >; - -/** - * Quantitative toxicological metrics for exposure to a substance. - */ -export type Toxicity = { - /** The specific toxicological metric being reported (e.g., LD50). */ - type: Distinct< ToxicityType >; - /** The biological species upon which the toxicological effect was observed. */ - organism: Distinct< string >; - /** The numerical value of the dose or concentration causing the effect. */ - value: SingleValue< 'massFraction' > | RangeValue< 'massFraction' >; - /** The route by which the substance entered the body (e.g., oral, dermal). */ - application?: Distinct< ToxicityApplication >; - /** The time period over which the exposure or observation occurred. */ - duration?: SingleValue< 'time' > | RangeValue< 'time' >; - /** Additional scientific or regulatory remarks concerning the toxicological effect. */ - notes?: Distinct< string >; - /** References to toxicological reports. */ - references?: RefId[]; -}; - -/** - * Registry of properties defining the safety, transport, and toxicological profile of a substance. - */ -export type SafetyCollection = Collection< { - /** Information regarding physical, health, and environmental hazards. */ - hazard?: HazardGroup; - /** Detailed metrics describing the harmful effects on living organisms. */ - toxicity?: Single< StructProperty< Toxicity > >; -} >; diff --git a/types/entity/composite.ts b/types/entity/composite.ts deleted file mode 100644 index af63f1a3..00000000 --- a/types/entity/composite.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @file composite.ts - * @description Defines the base structure for substances composed of multiple chemical elements. - * Extends the basic substance model with detailed stoichiometric information. - */ - -import type { Expand } from 'devtypes/types/util'; -import type { Collection } from '../abstract/collection'; -import type { CompositionCollection } from '../collection/composition'; -import type { Substance } from './substance'; - -/** - * A substance entity that inherently includes a multi-element composition. - * @template C The classification type specific to the composite entity. - */ -export type Composite< C extends Collection< unknown > > = Expand< Substance< C > & { - /** Detailed record of the constituent elements and their stoichiometric ratios. */ - composition: CompositionCollection; -} >; diff --git a/types/entity/compound.ts b/types/entity/compound.ts deleted file mode 100644 index 56c4ee41..00000000 --- a/types/entity/compound.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file compound.ts - * @description Defines the schema for chemical compounds, covering their structural - * classification, bonding characteristics, and various chemical forms. - */ - -import type { Brand, Expand } from 'devtypes/types/util'; -import type { CompoundCategory, CompoundProperty, CompoundUnion } from '../../enum/compound'; -import type { Phase } from '../../enum/physics'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct } from '../abstract/collection'; -import type { FormCollection } from '../abstract/form'; -import type { Factory, MetaData } from '../abstract/util'; -import type { Composite } from './composite'; - -/** Opaque identifier for a chemical compound entry. */ -export type CompoundId = Brand< string, 'compoundID' >; - -/** - * High-level categorization of a chemical compound based on its bonding and origin. - */ -export type CompoundClassification = Collection< { - /** The structural or thematic category (e.g., Oxide, Polymer). */ - category: Distinct< CompoundCategory >; - /** The type of chemical connection (e.g., Covalent, Ionic). */ - union: Distinct< CompoundUnion >; - /** Indicates if the compound is based on carbon chains (with specific exceptions). */ - organic: Distinct< boolean >; - /** The physical state of the compound under standard conditions. */ - phase: Distinct< Phase >; - /** Indicates if the compound contains radioactive radionuclides. */ - radioactive: Distinct< boolean >; - /** Indicates if the compound is produced through industrial synthesis. */ - synthetic: Distinct< boolean >; - /** List of characteristic properties associated with this compound. */ - properties: Distinct< CompoundProperty[] >; -} >; - -/** - * Representation of a single chemical compound as a multi-element substance. - */ -export type SingleCompound = Composite< CompoundClassification >; - -/** - * The core data structure for a chemical compound, excluding metadata. - * Designed for file-based database construction where metadata is enriched automatically. - */ -export type CompoundData = Expand< SingleCompound & { - /** Variations of the compound (e.g., different crystal structures or hydration levels). */ - forms?: FormCollection< SingleCompound >; -} >; - -/** - * The complete chemical compound entity, including automatically enriched metadata. - */ -export type Compound = MetaData< CompoundData >; - -/** - * Global registry of all chemical compounds indexed by a unique identifier. - */ -export type CompoundEntity = Collection< { - [ key: CompoundId ]: Compound; -} >; - -/** - * Factory type for defining chemical compounds in the database repository. - * Ensures that the compound identifier and underlying scientific data are correctly typed. - * - * @example - * ```typescript - * import type { CompoundFactory } from '@pseinfo/database-schema/entity/compound'; - * import { EntityType } from '@pseinfo/database-schema/enum/util'; - * - * export default ( { - * type: EntityType.COMPOUND, - * compoundId: 'water', - * data: { - * // ... - * } - * } ) as const satisfies CompoundFactory; - * ``` - */ -export type CompoundFactory = Factory< EntityType.COMPOUND, CompoundData, { - /** The compound identifier as primary entity key. */ - compoundId: CompoundId; -} >; diff --git a/types/entity/element.ts b/types/entity/element.ts deleted file mode 100644 index 628ab17f..00000000 --- a/types/entity/element.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @file element.ts - * @description Defines the schema for chemical elements, including their classification, - * atomic properties, and allotropic forms. - */ - -import type { Expand } from 'devtypes/types/util'; -import type { ElementBlock, ElementGroup, ElementProperty, ElementSet, ElementSymbol, PTColumn, PTPeriod } from '../../enum/element'; -import type { Phase } from '../../enum/physics'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct } from '../abstract/collection'; -import type { FormCollection } from '../abstract/form'; -import type { Factory, MetaData } from '../abstract/util'; -import type { AtomicsCollection } from '../collection/atomics'; -import type { Substance } from './substance'; - -/** - * High-level taxonomic classification for a chemical element in the periodic table. - */ -export type ElementClassification = Collection< { - /** The standard IUPAC symbol (e.g., 'H', 'Fe'). */ - symbol: Distinct< string >; - /** The count of protons in the nucleus defining the element. */ - atomicNumber: Distinct< number >; - /** The orbital block (s, p, d, f) where the valence electrons reside. */ - block: Distinct< ElementBlock >; - /** The categorical group name (e.g., Noble Gas, Alkali Metal). */ - group: Distinct< ElementGroup >; - /** The vertical column number (1-18) in the standard periodic table. */ - column: Distinct< PTColumn >; - /** The horizontal period number (1-7) in the periodic table. */ - period: Distinct< PTPeriod >; - /** The standard physical phase at 298.15 K and 100 kPa. */ - phase: Distinct< Phase >; - /** The specific geochemical or structural set (e.g., Lanthanides). */ - set: Distinct< ElementSet >; - /** Indicates if all isotopes of the element are unstable. */ - radioactive: Distinct< boolean >; - /** Indicates if the element occurs naturally on Earth or is only produced artificially. */ - synthetic: Distinct< boolean >; - /** List of characteristic properties associated with this element. */ - properties: Distinct< ElementProperty[] >; -} >; - -/** - * Representation of a single chemical element as a substance. - */ -export type SingleElement = Expand< Substance< ElementClassification > & { - /** Fundamental atomic properties including nuclear and electronic structure. */ - atomics?: AtomicsCollection; -} >; - -/** - * The core data structure for a chemical element, excluding metadata. - * Designed for file-based database construction where metadata is enriched automatically. - */ -export type ElementData = Expand< SingleElement & { - /** Variations of the element in the same physical state (e.g., Graphite vs. Diamond). */ - forms?: FormCollection< SingleElement >; -} >; - -/** - * The complete elemental entity, including automatically enriched metadata and potential allotropes. - */ -export type Element = MetaData< ElementData >; - -/** - * Global registry of all chemical elements indexed by their IUPAC symbol. - */ -export type ElementEntity = Collection< { - [ K in ElementSymbol ]: Element; -} >; - -/** - * Factory type for defining chemical elements in the database repository. - * Ensures that the element symbol and underlying scientific data are correctly typed. - * - * @example - * ```typescript - * import type { ElementFactory } from '@pseinfo/database-schema/entity/element'; - * import { ElementSymbol } from '@pseinfo/database-schema/enum/element'; - * import { EntityType } from '@pseinfo/database-schema/enum/util'; - * - * export default ( { - * type: EntityType.ELEMENT, - * element: ElementSymbol.H, - * data: { - * // ... - * } - * } ) as const satisfies ElementFactory; - * ``` - */ -export type ElementFactory = Factory< EntityType.ELEMENT, ElementData, { - /** The element symbol as primary entity identifier. */ - element: ElementSymbol; -} >; diff --git a/types/entity/mineral.ts b/types/entity/mineral.ts deleted file mode 100644 index 90dcc50c..00000000 --- a/types/entity/mineral.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file mineral.ts - * @description Defines the schema for minerals, integrating geological classification - * systems such as IMA, Strunz, and Dana. - */ - -import type { Brand, Expand } from 'devtypes/types/util'; -import type { MineralCategory, MineralClass, MineralProperty } from '../../enum/mineral'; -import type { Phase } from '../../enum/physics'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct } from '../abstract/collection'; -import type { FormCollection } from '../abstract/form'; -import type { Factory, MetaData } from '../abstract/util'; -import type { Composite } from './composite'; - -/** Opaque identifier for a mineral entry. */ -export type MineralId = Brand< string, 'mineralID' >; - -/** - * High-level mineral classification data. - */ -export type MineralClassification = Collection< { - /** The natural origin classification (e.g., Silicates, Carbonates). */ - category: Distinct< MineralCategory >; - /** The specific mineral class within the classification hierarchy. */ - class: Distinct< MineralClass >; - /** The official symbol assigned by the International Mineralogical Association. */ - imaSymbol: Distinct< string >; - /** The identification number in the 8th edition of the Strunz classification. */ - strunz8: Distinct< string >; - /** The identification number in the 9th edition of the Strunz classification. */ - strunz9: Distinct< string >; - /** The identification number in the Dana system of mineralogy. */ - dana: Distinct< string >; - /** The identifier in the Lapis system of mineral classification. */ - lapis: Distinct< string >; - /** The physical state (always solid for minerals by definition). */ - phase: Distinct< Phase.SOLID >; - /** Indicates if the mineral contains naturally occurring radionuclides. */ - radioactive: Distinct< boolean >; - /** Indicates if the specimen is a synthetic lab-grown counterpart of a natural mineral. */ - synthetic: Distinct< boolean >; - /** List of characteristic properties associated with this mineral. */ - properties: Distinct< MineralProperty[] >; -} >; - -/** - * Representation of a single mineral species as a multi-element substance. - */ -export type SingleMineral = Composite< MineralClassification >; - -/** - * The core data structure for a mineral species, excluding metadata. - * Designed for file-based database construction where metadata is enriched automatically. - */ -export type MineralData = Expand< SingleMineral & { - /** Variations or varieties of the mineral (e.g., Quartz vs. Amethyst). */ - forms?: FormCollection< SingleMineral >; -} >; - -/** - * The complete mineral entity, including automatically enriched metadata and potential variety forms. - */ -export type Mineral = MetaData< MineralData >; - -/** - * Global registry of all mineral species indexed by a unique identifier. - */ -export type MineralEntity = Collection< { - [ key: MineralId ]: Mineral; -} >; - -/** - * Factory type for defining minerals in the database repository. - * Ensures that the mineral identifier and geological data are correctly typed. - * - * @example - * ```typescript - * import type { MineralFactory } from '@pseinfo/database-schema/entity/mineral'; - * import { EntityType } from '@pseinfo/database-schema/enum/util'; - * - * export default ( { - * type: EntityType.MINERAL, - * mineralId: 'quartz', - * data: { - * // ... - * } - * } ) as const satisfies MineralFactory; - * ``` - */ -export type MineralFactory = Factory< EntityType.MINERAL, MineralData, { - /** The mineral identifier as primary entity key. */ - mineralId: MineralId; -} >; diff --git a/types/entity/mixture.ts b/types/entity/mixture.ts deleted file mode 100644 index acc62610..00000000 --- a/types/entity/mixture.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file mixture.ts - * @description Defines the schema for chemical mixtures, focusing on their physical - * homogeneity, state of dispersion, and categorical types. - */ - -import type { Brand } from 'devtypes/types/util'; -import type { MixtureCategory, MixtureHomogeneity, MixtureProperty, MixtureType } from '../../enum/mixture'; -import type { Phase } from '../../enum/physics'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct } from '../abstract/collection'; -import type { Factory, MetaData } from '../abstract/util'; -import type { Composite } from './composite'; - -/** Opaque identifier for a chemical mixture. */ -export type MixtureId = Brand< string, 'mixtureID' >; - -/** - * Physical and architectural classification of multi-component substance systems. - */ -export type MixtureClassification = Collection< { - /** The specific physical nature of the mixture (e.g., Solution, Colloid, Suspension). */ - type: Distinct< MixtureType >; - /** The degree of uniform distribution of the components (Homogeneous or Heterogeneous). */ - homogeneity: Distinct< MixtureHomogeneity >; - /** The structural or thematic category (e.g., Alloy, Aerosol). */ - category: Distinct< MixtureCategory >; - /** The overall bulk physical phase of the mixture. */ - phase: Distinct< Phase >; - /** The phase of the continuous substance in which the other components are dispersed. */ - mediumPhase: Distinct< Phase >; - /** The phase of the particles or droplets that are distributed within the medium. */ - dispersedPhase: Distinct< Phase >; - /** Indicates if any constituent of the mixture is radioactive. */ - radioactive: Distinct< boolean >; - /** Indicates if the mixture is manufactured or synthetic. */ - synthetic: Distinct< boolean >; - /** List of characteristic properties associated with this mixture. */ - properties: Distinct< MixtureProperty[] >; -} >; - -/** - * Representation of a single chemical mixture as a multi-element substance. - */ -export type SingleMixture = Composite< MixtureClassification >; - -/** - * The core data structure for a chemical mixture, excluding metadata. - * Designed for file-based database construction where metadata is enriched automatically. - */ -export type MixtureData = SingleMixture; - -/** - * The complete mixture entity, including automatically enriched metadata. - */ -export type Mixture = MetaData< MixtureData >; - -/** - * Global registry of all multi-component mixtures indexed by a unique identifier. - */ -export type MixtureEntity = Collection< { - [ key: MixtureId ]: Mixture; -} >; - -/** - * Factory type for defining chemical mixtures in the database repository. - * Ensures that the mixture identifier and constituent data are correctly typed. - * - * @example - * ```typescript - * import type { MixtureFactory } from '@pseinfo/database-schema/entity/mixture'; - * import { EntityType } from '@pseinfo/database-schema/enum/util'; - * - * export default ( { - * type: EntityType.MIXTURE, - * mixtureId: 'air', - * data: { - * // ... - * } - * } ) as const satisfies MixtureFactory; - * ``` - */ -export type MixtureFactory = Factory< EntityType.MIXTURE, MixtureData, { - /** The mixture identifier as primary entity key. */ - mixtureId: MixtureId; -} >; diff --git a/types/entity/nuclide.ts b/types/entity/nuclide.ts deleted file mode 100644 index 20f36bcc..00000000 --- a/types/entity/nuclide.ts +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file nuclide.ts - * @description Defines the schema for nuclides (isotopes), including their classification, - * stability, and complex decay network structures. - */ - -import type { Brand } from 'devtypes/types/util'; -import type { ElementSymbol } from '../../enum/element'; -import type { DecayMode, NuclideProperty, NuclideStability, NuclideState, SpinParity } from '../../enum/nuclear'; -import type { EntityType } from '../../enum/util'; -import type { Collection, Distinct, Group } from '../abstract/collection'; -import type { Factory, MetaData } from '../abstract/util'; -import type { DescriptiveCollection } from '../collection/descriptive'; -import type { GenericCollection } from '../collection/generic'; -import type { NuclearCollection } from '../collection/nuclear'; - -/** - * Formal identifier for a specific isotope or nuclear isomer. - * Format: A or Am or Amm where A is the mass number and m denotes a metastable state. - */ -export type NuclideId = Brand< `${number}` | `${number}m` | `${number}m${number}`, 'nuclideID' >; - -/** - * Fundamental nuclear classification and identification metrics. - * @template K - The specific chemical element symbol associated with this nuclide. - */ -export type NuclideClassification< K extends ElementSymbol > = Collection< { - /** The chemical element to which this isotope belongs. */ - element: Distinct< K >; - /** The number of protons (Z) in the nucleus. */ - atomicNumber: Distinct< number >; - /** The number of neutrons (N) in the nucleus. */ - neutronNumber: Distinct< number >; - /** The total number of nucleons (A = Z + N) in the nucleus. */ - massNumber: Distinct< number >; - /** The energy state of the nucleus (e.g., ground state or meta-stable isomer). */ - state: Distinct< NuclideState >; - /** The level of radioactive persistence (Stable vs. Unstable). */ - stability: Distinct< NuclideStability >; - /** The symmetry properties and parity of the nuclear spin state. */ - parity: Distinct< SpinParity >; - /** List of characteristic properties associated with this specific nuclide. */ - properties: Distinct< NuclideProperty[] >; -} >; - -/** - * Representation of a single nuclide including its nuclear structure data. - * @template K - The specific chemical element symbol associated with this nuclide. - */ -export type SingleNuclide< K extends ElementSymbol > = Collection< { - /** Human-readable names and historical discovery context. */ - descriptive: DescriptiveCollection; - /** Primary nuclear identification and taxonomic data. */ - classification: NuclideClassification< K >; - /** Generic, non-scientific data associated with the isotope. */ - generic?: GenericCollection; - /** Detailed spectral and energy-level properties of the nucleus. */ - nuclear?: NuclearCollection; -} >; - -/** - * The core data structure for a nuclide, excluding metadata. - * Designed for file-based database construction where metadata is enriched automatically. - * @template K - The specific chemical element symbol associated with this nuclide. - */ -export type NuclideData< K extends ElementSymbol > = SingleNuclide< K >; - -/** - * The complete nuclide entity, including automatically enriched metadata. - * @template K - The specific chemical element symbol associated with this nuclide. - */ -export type Nuclide< K extends ElementSymbol > = MetaData< NuclideData< K > >; - -/** - * Global registry of nuclides grouped by element and identified by their mass number. - */ -export type NuclideCollection = Collection< { - /** The set of all isotopes associated with a specific chemical element. */ - [ K in ElementSymbol ]?: Collection< { - [ N in NuclideId ]?: Nuclide< K >; - } >; -} >; - -/** - * Factory type for defining nuclides (isotopes) in the database repository. - * Ensures that the elemental association and nuclear identifiers are correctly typed. - * @template K - The chemical element symbol this isotope belongs to. - * - * @example - * ```typescript - * import type { NuclideFactory } from '@pseinfo/database-schema/entity/nuclide'; - * import { ElementSymbol } from '@pseinfo/database-schema/enum/element'; - * import { EntityType } from '@pseinfo/database-schema/enum/util'; - * - * export default ( { - * type: EntityType.NUCLIDE, - * element: ElementSymbol.U, - * nuclide: 'U-235', - * z: 92, - * n: 143, - * data: { - * // ... - * } - * } ) as const satisfies NuclideFactory< ElementSymbol.U >; - * ``` - */ -export type NuclideFactory< K extends ElementSymbol > = Factory< EntityType.NUCLIDE, NuclideData< K >, { - /** The element symbol the nuclide belongs to. */ - element: K; - /** The nuclide identifier as primary entity key. */ - nuclide: NuclideId; - /** The nuclear charge (Proton count). */ - z: number; - /** The neutron count. */ - n: number; -} >; - -/** - * A dense summary record for a specific nuclide used in the auto-generated nuclide index. - * @template Z - The nuclear charge (proton count) for this nuclide. - * @template N - The neutron count for this nuclide. - */ -export type NuclideIndexEntry< Z extends number, N extends number > = Collection< { - /** The unique mass-number based identifier for the isotope. */ - nuclide: Distinct< NuclideId >; - /** The nuclear charge (Proton count). */ - z: Distinct< Z >; - /** The neutron count. */ - n: Distinct< N >; - /** The mass number. */ - a: Distinct< number >; - /** The associated chemical element symbol. */ - element: Distinct< ElementSymbol >; - /** Nuclear data for performance optimization and visualization. */ - layer: Group< { - /** The characteristic time for half of a sample to decay. */ - halfLife?: Distinct< number >; - /** The primary mechanism by which the unstable nucleus transforms. */ - mainDecayMode?: Distinct< DecayMode >; - /** The effective root-mean-square radius of the nucleus. */ - nuclearRadius?: Distinct< number >; - /** The difference between the actual isotope mass and its mass number. */ - massExcess?: Distinct< number >; - /** The physical mass of the neutral atom. */ - atomicMass?: Distinct< number >; - /** The energy equivalent of the nuclear mass deficit. */ - bindingEnergy?: Distinct< number >; - } >; -} >; - -/** - * A multi-dimensional grid of all isotopes indexed by proton (Z) and neutron (N) count. - * This will be auto-generated from the nuclide collection. - * @template Z - The nuclear charge (proton count) used as the first key for indexing. - * @template N - The neutron count used as the second key for indexing. - */ -export type NuclideIndex = Collection< { - [ Z in number ]?: { - [ N in number ]?: NuclideIndexEntry< Z, N >; - }; -} >; - -/** - * A directed edge in a nuclear decay network representing a single transformation step. - */ -export type NuclideDecayChainLink = Group< { - /** The child nuclide (daughter) resulting from the decay. */ - nuclide: Distinct< NuclideId >; - /** The mode of the radioactive transformation. */ - mode: Distinct< DecayMode >; - /** The probability fraction of the parent decaying into this specific daughter. */ - probability: Distinct< number | null >; -} >; - -/** - * Detailed node in a radioactive decay chain, capturing parents and daughters. - * @template N - The specific nuclide identifier type used as the key for the decay chain entries. - */ -export type NuclideDecayChainEntry< N extends NuclideId > = Collection< { - /** The current nuclide in the decay network. */ - nuclide: Distinct< N >; - /** The nuclear charge (Proton count). */ - z: Distinct< number >; - /** The neutron count. */ - n: Distinct< number >; - /** The mass number. */ - a: Distinct< number >; - /** The associated chemical element symbol. */ - element: Distinct< ElementSymbol >; - /** The characteristic time for half of a sample to decay. */ - halfLife: Distinct< number | null >; - /** Whether the decay chain ends at this nuclear state. */ - stable: Distinct< boolean >; - /** The possible decay paths leading from this nuclide to daughters. */ - daughterChains: Distinct< NuclideDecayChainLink[] >; - /** The possible parent nuclides that decay into this nuclide. */ - parentChains: Distinct< NuclideDecayChainLink[] >; - /** The distance from the primordial or starting parent in the network. */ - chainDepth: Distinct< number >; - /** Whether this nuclide represents the final stable endpoint. */ - isTerminal: Distinct< boolean >; -} >; - -/** - * The complete network of all isotopic decay relationships in the database. - * This will be auto-generated from the nuclide collection. - * @template N - The specific nuclide identifier type used as the key for the decay chain entries. - */ -export type NuclideDecayChains = Collection< { - [ N in NuclideId ]?: NuclideDecayChainEntry< N >; -} >; - -/** - * The comprehensive entity for all nuclear and isotopic data in the repository. - */ -export type NuclideEntity = { - /** Detailed scientific records for each individual nuclide. */ - nuclides: NuclideCollection; - /** Auto-generated index for fast lookup by proton/neutron counts. */ - index: NuclideIndex; - /** Auto-generated graph of all radioactive decay paths and parent-child relationships. */ - decayChains: NuclideDecayChains; -}; diff --git a/types/entity/substance.ts b/types/entity/substance.ts deleted file mode 100644 index b8bac5b8..00000000 --- a/types/entity/substance.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file substance.ts - * @description Defines the universal schema for any chemical or physical substance. - * This is the primary structural unit that aggregates all scientific data collections - * including physical, chemical, and safety properties. - */ - -import type { Collection } from '../abstract/collection'; -import type { AbundanceCollection } from '../collection/abundance'; -import type { ChemistryCollection } from '../collection/chemistry'; -import type { CrystallographyCollection } from '../collection/crystallography'; -import type { DescriptiveCollection } from '../collection/descriptive'; -import type { GenericCollection } from '../collection/generic'; -import type { PhysicsCollection } from '../collection/physics'; -import type { SafetyCollection } from '../collection/safety'; - -/** - * Universal container for a substance's scientific data. - * @template C The classification type specific to the entity (e.g., Element, Compound). - */ -export type Substance< C extends Collection< unknown > > = Collection< { - /** High-level taxonomic classification and categorical identifiers. */ - classification: C; - /** Qualitative and historical metadata (names, descriptions, media). */ - descriptive: DescriptiveCollection; - /** Generic, non-specific data (e.g., prices, market data). */ - generic?: GenericCollection; - /** Data regarding the relative presence across various environments. */ - abundance?: AbundanceCollection; - /** Macroscopic physical behaviors and thermodynamic states. */ - physics?: PhysicsCollection; - /** Internal lattice structure and crystallographic symmetry properties. */ - crystallography?: CrystallographyCollection; - /** Reactivity, stoichiometry, and molecular geometry properties. */ - chemistry?: ChemistryCollection; - /** Hazard identifications, safety ratings, and toxicological data. */ - safety?: SafetyCollection; -} >; diff --git a/types/index.ts b/types/index.ts deleted file mode 100644 index 43875d9c..00000000 --- a/types/index.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file index.ts - * @description The primary entry point for the chemical and physical database schema. - * This file aggregates all entities (Elements, Compounds, Minerals, Mixtures, Nuclides) - * and high-level registries into a single unified data model. - */ - -import type { BlobCollection } from './abstract/blob'; -import type { Collection } from './abstract/collection'; -import type { ReferenceCollection } from './abstract/reference'; -import type { DBMeta, DBStats } from './abstract/meta'; -import type { UnitCollection } from './abstract/unit'; -import type { CompoundEntity } from './entity/compound'; -import type { ElementEntity } from './entity/element'; -import type { MineralEntity } from './entity/mineral'; -import type { MixtureEntity } from './entity/mixture'; -import type { NuclideEntity } from './entity/nuclide'; - -/** - * The high-level root of the scientific repository. - * Aggregates metadata, scientific entity data, and global registries (units, references) - * into a single structured object. - */ -export type Database = Collection< { - /** Global administrative metadata. */ - meta: DBMeta; - /** Metrics on entity distribution and contributor activity. */ - stats: DBStats; - - /** The primary scientific datasets grouped by entity domain. */ - data: Collection< { - /** Comprehensive registry of chemical elements and their physical properties. */ - elements: ElementEntity; - /** Extensive network of isotopes, nuclear states, and decay relationships. */ - nuclides: NuclideEntity; - /** Large-scale collection of chemical compounds and their structural data. */ - compounds: CompoundEntity; - /** Geological registry of mineral species and their diagnostic characteristics. */ - minerals: MineralEntity; - /** Physical chemistry database for solutions, colloids, and specialized mixtures. */ - mixtures: MixtureEntity; - } >; - - /** The global registry of physical quantities and their supported scientific units. */ - units: UnitCollection; - /** The centralized repository of all scientific citations and verifiable data sources. */ - references: ReferenceCollection; - /** The centralized repository of all binary large objects. */ - blobs: BlobCollection; -} >;