@almaobservatory/model
v1.0.1
Published
ALMA observation tool data models: APDM types, value wrappers (DoubleWithUnit, Frequency, SkyCoordinates, etc.), and concurrent-access support.
Keywords
Readme
@almaobservatory/model
An Angular library of TypeScript interfaces and helper builders for the ALMA observation-tool data model. The shapes mirror the APDM (ALMA Project Data Model) class structure described at https://www.roe.ac.uk/ukatc/projects/alma/APDM-Cycle10/.
The interfaces were generated by fetching json from the NGOT backend and using typescript-generator.
Shared between ngOT and SnooPI, and consumed transitively by
@almaobservatory/astro.
What's inside
- APDM domain types —
ObsProject,ScienceGoal,TargetParameters,SpectralSetupParameters,Rectangle,SinglePoint, etc. - Value wrappers —
DoubleWithUnit,Frequency,Velocity,Angle,SkyCoordinates,Latitude,Longitude - Spectral-setup model —
ReceiverBand,ReceiverBandstable, science / expected / overlaid spectral-line shapes - Configuration types — control-and-performance, time estimates, calibration
- Concurrent-access support — STOMP / WebSocket helpers used by ngOT's real-time collaboration features
The full public surface is in src/public-api.ts.
Installation
npm install @almaobservatory/modelIf you're installing @almaobservatory/astro, this package is pulled in as
a peer dependency automatically.
The @stomp/rx-stomp and uuid packages are runtime dependencies and will
be installed alongside.
Usage
import { SkyCoordinates, Frequency, Field, buildField } from '@almaobservatory/model';
const coords: SkyCoordinates = {
longitude: { value: 86.8, unit: 'deg' },
latitude: { value: -70.7, unit: 'deg' },
type: 'ABSOLUTE'
};
const freq: Frequency = { value: 230.5, unit: 'GHz' };
// Builder for a default SinglePoint Field
const field = buildField('ICRS');Most consumers use these types alongside the converters in
@almaobservatory/astro.
Development
The library lives under projects/model/ in the ngOT workspace. From the
workspace root:
# Build the library to dist/model
ng build model
# Full workspace rebuild
npm run build-allngOT's own code imports from model (path-mapped to dist/model); you do
not need to publish to npm in order to consume changes inside ngOT.
Publishing a new version
When the data model changes and external consumers (SnooPI, etc.) need to pick up the new version, publish a new release.
# 1. Bump the version in projects/model/package.json
# (patch / minor / major per semver)
# 2. From the workspace root:
npm run publish-model
# 3. Verify
npm view @almaobservatory/modelWhen making breaking changes — renaming or removing types,
restructuring an interface — bump the major version. Note that
@almaobservatory/astro declares @almaobservatory/model: ^1.0.0 as a
peer dependency, so a 2.0.0 of model requires a coordinated bump in astro.
Requires npm credentials for the @almaobservatory org.
License
ALMA Observatory.
