From a4c19424eca6f729df3f9597302732c28210dca9 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 11:28:41 +0200 Subject: [PATCH 01/15] Create blob.ts --- types/abstract/blob.ts | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 types/abstract/blob.ts diff --git a/types/abstract/blob.ts b/types/abstract/blob.ts new file mode 100644 index 0000000..9762c4f --- /dev/null +++ b/types/abstract/blob.ts @@ -0,0 +1,83 @@ +/** + * @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 { 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; + /** 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 or internal data URI. */ + 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. */ + 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; + /** 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. + */ +export type BlobFactory = Factory< 'blob', Blob, { + /** The unique, branded identifier for this binary asset. */ + blobId: BlobId; +} >; From d71081feb743af03615bbfe8251c181a23332a45 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 11:30:52 +0200 Subject: [PATCH 02/15] use blobs --- types/collection/descriptive.ts | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/types/collection/descriptive.ts b/types/collection/descriptive.ts index 0de85a5..a5fa805 100644 --- a/types/collection/descriptive.ts +++ b/types/collection/descriptive.ts @@ -4,9 +4,9 @@ * and historical context for chemical substances. */ -import type { D3Format, ImageFormat, LangCode } from '../../enum/util'; -import type { Collection, Distinct, Group, Single } from '../abstract/collection'; -import type { PrimitiveProperty } from '../abstract/property'; +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 { ISO8601Date, LangGroup } from '../abstract/util'; import type { RegistryGroup, StructureGroup } from './registry'; @@ -58,24 +58,17 @@ export type MediaGroup = Group< { /** Characteristic fingerprint data from various spectroscopic techniques. */ spectrum?: Group< { /** Base64 encoded data for the absorption spectrum. */ - absorption?: Single< PrimitiveProperty< string > >; + absorption?: BlobId; /** Base64 encoded data for the emission spectrum. */ - emission?: Single< PrimitiveProperty< string > >; + emission?: BlobId; /** Base64 encoded data for ultraviolet-visible spectroscopy data. */ - uv?: Single< PrimitiveProperty< string > >; + uv?: BlobId; /** Base64 encoded data for X-ray diffraction or spectroscopy. */ - xray?: Single< PrimitiveProperty< string > >; + xray?: BlobId; } >; /** Data files for rendering three-dimensional molecular or crystal structures. */ - structure3D?: Distinct< { - /** The raw Base64 encoded structural data (e.g., CIF, XYZ, PDB). */ - data: string; - /** The chemical data format used for the 3D representation. */ - format: D3Format; - /** External URL for a specialized 3D viewer or repository. */ - url?: string; - }[] >; + structure3D?: BlobId[]; } >; /** From 482f7dd1e53184e99d550a83bd58367df72c7a0e Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 11:32:33 +0200 Subject: [PATCH 03/15] fix factory type to include blobs --- types/abstract/util.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/abstract/util.ts b/types/abstract/util.ts index ca95f3a..b83a735 100644 --- a/types/abstract/util.ts +++ b/types/abstract/util.ts @@ -52,14 +52,14 @@ export type LangGroup< L extends LangCode = LangCode.ENGLISH, T = string > = Gro * 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). + * 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', + E extends EntityType | 'unit' | 'ref' | 'blob', C extends Collection< unknown >, K extends Record< string, string | number > > = Expand< Brand< K & { data: C }, E, 'type', true > >; From f30886eea905729d318bc81a2b38effc90bf47a7 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 11:33:05 +0200 Subject: [PATCH 04/15] add BlobType enum --- enum/util.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/enum/util.ts b/enum/util.ts index bb7ff8b..00e06ad 100644 --- a/enum/util.ts +++ b/enum/util.ts @@ -139,6 +139,18 @@ export enum UncertaintyType { 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. */ From ff34112720eeb92adf508ffbedf2f111d6958ff2 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 11:34:05 +0200 Subject: [PATCH 05/15] rework ox. state property --- types/collection/chemistry.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/types/collection/chemistry.ts b/types/collection/chemistry.ts index 1a48487..d687e5c 100644 --- a/types/collection/chemistry.ts +++ b/types/collection/chemistry.ts @@ -9,7 +9,7 @@ import type { MolecularShape, OxideCharacter, SolubilityQualifier } from '../../enum/chemistry'; import type { Collection, Group, Single } from '../abstract/collection'; -import type { NumberProperty, PrimitiveProperty } from '../abstract/property'; +import type { NumberProperty, PrimitiveProperty, StructProperty } from '../abstract/property'; /** * Registry of chemical properties describing the reactivity, structure, and energetics of substances. @@ -53,7 +53,16 @@ export type ChemistryCollection = Collection< { /** Grouping of properties related to the loss or gain of electrons. */ oxidation?: Group< { /** The formal charge an atom would have if all bonds were ionic. */ - oxidationStates?: Single< PrimitiveProperty< string > >; + 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; + } > >; /** The acidic or basic behavior of an element's oxide. */ oxideCharacter?: Single< PrimitiveProperty< OxideCharacter > >; } >; From 9fa600902f39d0110414b8c690e206294de723c3 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 11:39:53 +0200 Subject: [PATCH 06/15] reworking meta + stats --- types/abstract/meta.ts | 32 ++++++++++++++++++ types/abstract/util.ts | 2 +- types/collection/stats.ts | 71 --------------------------------------- types/index.ts | 15 +++++---- 4 files changed, 41 insertions(+), 79 deletions(-) create mode 100644 types/abstract/meta.ts delete mode 100644 types/collection/stats.ts diff --git a/types/abstract/meta.ts b/types/abstract/meta.ts new file mode 100644 index 0000000..6e39e09 --- /dev/null +++ b/types/abstract/meta.ts @@ -0,0 +1,32 @@ +import type { EntityType } from '../../enum/util'; +import type { Collection, Distinct } from './collection'; +import type { ISO8601Date } from './util'; + +export type Contributor = { + name: string; + contact?: string; +}; + +export type DBMeta = Collection< { + readonly schemaVersion: 1; + revision: string; + lastModified: ISO8601Date; + contributors: Contributor[]; + license: string; + source: string; +} >; + +export type DBStats = Collection< { + size: Distinct< number >; + entities: Distinct< { + [ E in EntityType ]: { + count: number; + bytes: number; + } + } >; + contributors: Distinct< Contributor & { + lastModified: ISO8601Date; + edits: number; + bytes: number; + }[] >; +} >; diff --git a/types/abstract/util.ts b/types/abstract/util.ts index b83a735..ffdef77 100644 --- a/types/abstract/util.ts +++ b/types/abstract/util.ts @@ -21,7 +21,7 @@ export type MetaData< T extends Collection< unknown > = Collection< unknown > > /** Internal metadata object for administrative and scientific tracking. */ '@metadata': Distinct< { /** The version of the schema used for this data object. */ - schemaVersion: 1; + readonly schemaVersion: 1; /** ISO 8601 timestamp of the last modification. */ lastModified: ISO8601Date; /** Unique commit hash or version identifier representing the data source state. */ diff --git a/types/collection/stats.ts b/types/collection/stats.ts deleted file mode 100644 index c00ca4b..0000000 --- a/types/collection/stats.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file stats.ts - * @description Defines the schema for database metrics, contributor activity, and - * entity distribution statistics. - */ - -import type { Collection, Distinct, Group } from '../abstract/collection'; - -/** - * Registry of database-wide metrics and administrative statistics. - */ -export type StatsCollection = Collection< { - /** The total storage size or relative scale of the data set. */ - size: Distinct< number >; - - /** Metrics regarding the distribution of scientific entities in the repository. */ - entities: Group< { - /** Stats for chemical elements. */ - elements: Distinct< { - /** The total number of unique chemical elements documented. */ - count: number; - /** The size of the chemical elements data in bytes. */ - bytes: number; - } >; - /** Stats for nuclides. */ - nuclides: Distinct< { - /** The total number of unique nuclides documented. */ - count: number; - /** The size of the nuclides data in bytes. */ - bytes: number; - } >; - /** Stats for compounds. */ - compounds: Distinct< { - /** The total number of unique compounds documented. */ - count: number; - /** The size of the compounds data in bytes. */ - bytes: number; - } >; - /** Stats for minerals. */ - minerals: Distinct< { - /** The total number of unique minerals documented. */ - count: number; - /** The size of the minerals data in bytes. */ - bytes: number; - } >; - /** Stats for mixtures. */ - mixtures: Distinct< { - /** The total number of unique mixtures documented. */ - count: number; - /** The size of the mixtures data in bytes. */ - bytes: number; - } >; - } >; - - /** - * List of individuals or organizations who have provided data or structural updates. - * The command "git shortlog -snc" will generate this list. - */ - contributors: Distinct< { - /** The official name or alias of the contributor. */ - name: Distinct< string >; - /** The ISO 8601 timestamp of the contributor's most recent change. */ - lastModified: Distinct< string >; - /** The cumulative count of verified data points or structural edits made. */ - edits: Distinct< number >; - /** The size of the contributor's data in bytes. */ - bytes: Distinct< number >; - /** The primary communication channel or professional URI for the contributor. */ - contact?: Distinct< string >; - }[] >; -} >; diff --git a/types/index.ts b/types/index.ts index 4af740f..6ca8b00 100644 --- a/types/index.ts +++ b/types/index.ts @@ -5,16 +5,16 @@ * 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 { MetaData } from './abstract/util'; 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'; -import type { StatsCollection } from './collection/stats'; /** * The high-level root of the scientific repository. @@ -22,11 +22,10 @@ import type { StatsCollection } from './collection/stats'; * into a single structured object. */ export type Database = Collection< { - /** Global administrative metadata including internal database statistics. */ - meta: MetaData< { - /** Detailed metrics on entity distribution and contributor activity. */ - stats: StatsCollection; - } >; + /** Global administrative metadata. */ + meta: DBMeta; + /** Metrics on entity distribution and contributor activity. */ + stats: DBStats; /** The primary scientific datasets grouped by entity domain. */ data: Collection< { @@ -46,4 +45,6 @@ export type Database = Collection< { unit: UnitCollection; /** The centralized repository of all scientific citations and verifiable data sources. */ refs: ReferenceCollection; + /** The centralized repository of all binary large objects. */ + blob: BlobCollection; } >; From 4f47a21140b83072de0d3c7a4eed72bbe83dfefe Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 14:57:00 +0200 Subject: [PATCH 07/15] declare Attribution type --- types/abstract/util.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/types/abstract/util.ts b/types/abstract/util.ts index ffdef77..04e737e 100644 --- a/types/abstract/util.ts +++ b/types/abstract/util.ts @@ -33,6 +33,23 @@ export type MetaData< T extends Collection< unknown > = Collection< unknown > > } >; } >; +/** + * 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 >; +} >; + /** * A specialized group for localized strings or values. * It enforces at least one primary language (usually English) and allows optional translations. From eb8e657dbd3caeac9c8570058d4755e4f65fa6f6 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 14:57:53 +0200 Subject: [PATCH 08/15] Update blob.ts --- types/abstract/blob.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/abstract/blob.ts b/types/abstract/blob.ts index 9762c4f..e801323 100644 --- a/types/abstract/blob.ts +++ b/types/abstract/blob.ts @@ -8,7 +8,7 @@ import type { Brand, Expand } from 'devtypes/types/util'; import type { BlobType, D3Format, ImageFormat } from '../../enum/util'; import type { RefId } from './reference'; -import type { Factory } from './util'; +import type { Attribution, Factory } from './util'; /** * Branded base attributes for all binary large objects. @@ -19,6 +19,8 @@ type BaseBlob< T extends BlobType > = Brand< { 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. */ From dd994d58d97b8ae338de0428e86d004c97411ed6 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 15:02:10 +0200 Subject: [PATCH 09/15] use attribution type for media assets --- types/collection/descriptive.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/types/collection/descriptive.ts b/types/collection/descriptive.ts index a5fa805..3a08646 100644 --- a/types/collection/descriptive.ts +++ b/types/collection/descriptive.ts @@ -8,7 +8,7 @@ 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 { ISO8601Date, LangGroup } from '../abstract/util'; +import type { Attribution, ISO8601Date, LangGroup } from '../abstract/util'; import type { RegistryGroup, StructureGroup } from './registry'; /** @@ -37,18 +37,10 @@ export type MediaGroup = Group< { images?: Distinct< { /** The absolute URL or path to the image file. */ url: string; - /** The file format of the image (e.g., PNG, JPEG). */ + /** The file encoding format of the image. */ format?: ImageFormat; - /** Information regarding the attribution or ownership of the image. */ - credits: string; - /** The legal license governing the use of the image. */ - license: string; - /** The creator or photographer of the media. */ - author?: string; - /** The originating website or publication. */ - source?: string; - /** The ISO 8601 date the image was last accessed. */ - accessed?: ISO8601Date; + /** 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. */ From 5e46003b0dc811444d8ad0809f88bb504ae9f908 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 15:02:55 +0200 Subject: [PATCH 10/15] Update index.ts --- types/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/index.ts b/types/index.ts index 6ca8b00..43875d9 100644 --- a/types/index.ts +++ b/types/index.ts @@ -42,9 +42,9 @@ export type Database = Collection< { } >; /** The global registry of physical quantities and their supported scientific units. */ - unit: UnitCollection; + units: UnitCollection; /** The centralized repository of all scientific citations and verifiable data sources. */ - refs: ReferenceCollection; + references: ReferenceCollection; /** The centralized repository of all binary large objects. */ - blob: BlobCollection; + blobs: BlobCollection; } >; From 4e362c46c473abf02ed5ef08c9d036e4ac111ba5 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 15:14:15 +0200 Subject: [PATCH 11/15] rework the DB meta / stats collections --- types/abstract/meta.ts | 67 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/types/abstract/meta.ts b/types/abstract/meta.ts index 6e39e09..a828b61 100644 --- a/types/abstract/meta.ts +++ b/types/abstract/meta.ts @@ -1,32 +1,81 @@ +/** + * @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'; -export type Contributor = { +/** + * 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; - revision: string; - lastModified: ISO8601Date; - contributors: Contributor[]; - license: string; - source: string; + /** 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; } } >; - contributors: Distinct< Contributor & { + /** 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; - }[] >; + } > [] >; } >; From 0e974bc4e045fd5216665824721a9aa001e6a253 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 15:16:37 +0200 Subject: [PATCH 12/15] add "context" field to all value types --- types/abstract/value.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/abstract/value.ts b/types/abstract/value.ts index 0eec49d..b61476c 100644 --- a/types/abstract/value.ts +++ b/types/abstract/value.ts @@ -26,7 +26,9 @@ type BaseValue< T extends ValueType > = Brand< { confidence?: ValueConfidence; /** Experimental or statistical uncertainty associated with the value. */ uncertainty?: Uncertainty; - /** Contextual information or remarks regarding the specific value or measurement. */ + /** Scientific context of the value. */ + context?: string; + /** Notes or remarks regarding the value. */ note?: string; }, T, 'type', true >; From a979c912154b480f48b06a866d56e4e60572d34b Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 17:46:05 +0200 Subject: [PATCH 13/15] min fixes --- enum/element.ts | 12 ++++-------- types/abstract/blob.ts | 13 +++++++++++++ types/abstract/reference.ts | 4 +++- types/abstract/util.ts | 34 +++++++++++++++++----------------- types/collection/chemistry.ts | 4 ++-- 5 files changed, 39 insertions(+), 28 deletions(-) diff --git a/enum/element.ts b/enum/element.ts index 9eff2dc..725765f 100644 --- a/enum/element.ts +++ b/enum/element.ts @@ -133,14 +133,10 @@ export enum ElementSymbol { * 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' + /** 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' }; /** diff --git a/types/abstract/blob.ts b/types/abstract/blob.ts index e801323..6aece84 100644 --- a/types/abstract/blob.ts +++ b/types/abstract/blob.ts @@ -78,6 +78,19 @@ 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. */ diff --git a/types/abstract/reference.ts b/types/abstract/reference.ts index b4e89e0..7f593f6 100644 --- a/types/abstract/reference.ts +++ b/types/abstract/reference.ts @@ -7,7 +7,7 @@ import type { ExtractFrom, RequireAtLeastOne, RequireExactlyOneFrom, StrictSubset } from 'devtypes/types/constraint'; import type { Brand, Expand } from 'devtypes/types/util'; -import type { ReferenceType } from '../../enum/util'; +import type { LangCode, ReferenceType } from '../../enum/util'; import type { Factory, ISO8601Date } from './util'; /** @@ -21,6 +21,8 @@ type BaseReference< T extends ReferenceType > = Brand< { url?: string; /** Digital Object Identifier - the unique permanent identifier for scholarly work. */ doi?: string; + /** Language of the reference. */ + language?: LangCode; }, T, 'type', true >; /** diff --git a/types/abstract/util.ts b/types/abstract/util.ts index 04e737e..18aef4b 100644 --- a/types/abstract/util.ts +++ b/types/abstract/util.ts @@ -11,6 +11,23 @@ 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 @@ -33,23 +50,6 @@ export type MetaData< T extends Collection< unknown > = Collection< unknown > > } >; } >; -/** - * 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 >; -} >; - /** * A specialized group for localized strings or values. * It enforces at least one primary language (usually English) and allows optional translations. diff --git a/types/collection/chemistry.ts b/types/collection/chemistry.ts index d687e5c..22f46ab 100644 --- a/types/collection/chemistry.ts +++ b/types/collection/chemistry.ts @@ -52,6 +52,8 @@ export type ChemistryCollection = Collection< { /** 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. */ @@ -63,8 +65,6 @@ export type ChemistryCollection = Collection< { /** Specific chemical context or remarks regarding this oxidation state. */ context?: string; } > >; - /** The acidic or basic behavior of an element's oxide. */ - oxideCharacter?: Single< PrimitiveProperty< OxideCharacter > >; } >; /** Grouping of properties related to the relationship between electricity and chemical change. */ From ca74d80247cd6b55777f3f57d8f956bccf611c84 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 18:15:51 +0200 Subject: [PATCH 14/15] rework unit system --- types/abstract/unit.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/types/abstract/unit.ts b/types/abstract/unit.ts index 47c48ac..58ef4b2 100644 --- a/types/abstract/unit.ts +++ b/types/abstract/unit.ts @@ -126,6 +126,10 @@ export const ValidUnits = { 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' ] }, @@ -147,9 +151,9 @@ export const ValidUnits = { massMagneticSusceptibility: { base: [ 'cm[3]/g', 'm[3]/kg' ], prefixable: [] }, /** Photometry: Luminous Flux */ - luminousFlux: { base: [ 'lm' ], prefixable: [] }, + luminousFlux: { base: [ 'lm' ], prefixable: [ 'lm' ] }, /** Photometry: Illuminance */ - illuminance: { base: [ 'lx', 'fc' ], prefixable: [] }, + illuminance: { base: [ 'lx', 'fc' ], prefixable: [ 'lx' ] }, /** Acoustics: Speed of Sound */ soundSpeed: { base: [ 'm/s', 'km/h', 'ft/s' ], prefixable: [ 'm/s' ] }, @@ -166,10 +170,10 @@ export const ValidUnits = { molarity: { base: [ 'M', 'mol/L' ], prefixable: [ 'mol/L' ] }, /** Chemistry: Molality (mol/kg) */ molality: { base: [ 'm', 'mol/kg' ], prefixable: [ 'mol/kg' ] }, - /** Chemistry: Dimensionless Mole Fraction */ - moleFraction: { base: [ '%', '‰', '*', 'ppm', 'ppb', 'ppt' ], prefixable: [] }, /** 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: [] }, @@ -180,6 +184,8 @@ export const ValidUnits = { 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: [] }, @@ -193,7 +199,8 @@ export const ValidUnits = { /** General Physics: Geometric Area */ area: { base: [ 'm[2]', 'b' ], prefixable: [ 'm[2]' ] }, /** General Physics: Dimensionless Quantity */ - quantity: { base: [ '*', '%', '‰', 'mol' ], prefixable: [] }, + quantity: { base: [ '*', '%', '‰' ], prefixable: [] }, + /** Economics: Monetary Currency */ currency: { base: [ 'USD', 'EUR', 'CHF' ], prefixable: [] } } as const; From b63a458a81f66d23ab8ab240c517f7f69c12bac9 Mon Sep 17 00:00:00 2001 From: komed3 Date: Mon, 20 Apr 2026 18:23:12 +0200 Subject: [PATCH 15/15] fix solubility props. --- types/collection/chemistry.ts | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/types/collection/chemistry.ts b/types/collection/chemistry.ts index 22f46ab..d15d9a2 100644 --- a/types/collection/chemistry.ts +++ b/types/collection/chemistry.ts @@ -8,7 +8,8 @@ import type { AcidBaseCharacter, BasicityType, BondType, Goldschmidt, HSAB, Hybridization, LewisModel, MolecularShape, OxideCharacter, SolubilityQualifier } from '../../enum/chemistry'; -import type { Collection, Group, Single } from '../abstract/collection'; +import type { EntityType } from '../../enum/util'; +import type { Collection, Distinct, Group, Single } from '../abstract/collection'; import type { NumberProperty, PrimitiveProperty, StructProperty } from '../abstract/property'; /** @@ -89,16 +90,30 @@ export type ChemistryCollection = Collection< { bindingEnergy?: Single< NumberProperty< 'energy' > >; } >; - /** Grouping of properties describing the ability of a substance to dissolve in a solvent. */ + /** Grouping of properties describing the ability of a substance to dissolve in various solvents. */ solubility?: Group< { - /** A qualitative descriptor of a substance's capacity to dissolve. */ - quantifier?: Single< PrimitiveProperty< SolubilityQualifier > >; - /** The maximum amount of the substance that will dissolve in water at equilibrium. */ - waterSolubility?: Single< NumberProperty< 'concentration' > >; - /** The equilibrium constant for the dissolution of an ionic compound in water. */ - solubilityProduct?: Single< NumberProperty< never > >; /** 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. */