@welldot/core
v0.9.0
Published
TypeScript types, Zod validators, and serialization utilities for the .well open format — a JSON standard for water well data.
Maintainers
Readme
@welldot/core
Documentation: docs.welldot.org/core
Overview
TypeScript types, Zod validators, and serialization utilities for the .well open format — a JSON-based standard for representing water well data.
This README covers installation, a quick start, the API (types, validators, functions and unit conversion), the water quality and recommended vocabularies, the FGDC texture codes and a short tour of the format. The normative specification lives in spec/v2.
Table of contents
- What is
.well? - Installation
- Quick Start
- API Reference
- Water Quality Vocabulary and Limit Sets (v2.3)
- Recommended Vocabularies (v2.3)
- FGDC Texture Patterns
.wellFormat Overview- Contributing
- License
What is .well?
.well is an open file format for encoding the complete record of a water well as a single, self-describing JSON document. A .well file contains:
- Constructive data — borehole geometry, casing strings, screens, reducers, gravel packs, centralizers, and cement pads
- Geologic data — lithological column, discrete fractures, and cave zones
- Administrative metadata — well identity, construction type and purpose (
well_type,well_purpose), authority-scoped IDs (well_id), driller, construction date, and geographic coordinates with explicit CRS - Hydrodynamic events — ledger of static level readings, pumping tests (constant-rate, step-drawdown, airlift), and recovery phases
- Aquifer analysis — interpreted parameter sets: transmissivity, specific capacity, storativity, and Jacob loss coefficients
- Operational history — timestamped log of maintenance, inspections, incidents, status changes and permit condition fulfillment, with HTTPS attachment references
- Pump installations — installation history of the well's pumps: nameplate data, intake depth, riser and electrical data (v2.3)
- Permits — legal instruments that authorize, exempt or register the well or its use (drilling and abstraction permits, exemptions, registrations): validity, granted flow and daily operating time, volume limits, monthly schedule, and conditions (condicionantes) whose deadlines are derived from ISO 8601 date durations, with their fulfillments, an administrative status (requested, suspended…) and an administrative history (v2.3)
- Meters, production and operating regime — totalizer (hidrômetro) installation history, a production ledger of meter readings and declared volumes (volumes are derived, never stored as totals), and the declared operating regime in force from a given instant (v2.3)
- Water quality — a
water_samplesledger of samples, each with its field and laboratory results, sampling point and depth, purge and stabilization readings, laboratory and chain of custody, field QA/QC (duplicates, splits, blanks), per-result filtration, lab flags and data validation. Parameters are identified by{ code, vocabulary }against a versioned vocabulary of 98welldotcodes (plus CAS numbers andx-codes), and units come from the code. Limits are never stored in the file (v2.3) - Attachments — HTTPS-referenced files typed by
document_type: a root-levelattachmentsarray for general files about the well (e.g. the drilling report), plus per-record attachments on log entries, permits (and their history steps and condition fulfillments), pumps, meters, events, analyses and water samples. The root array does not collect the per-record ones (v2.3)
The format is designed for three use cases: visualization of technical well profiles, registration with regulatory bodies, and hydrogeological research.
See the v2 format specification (current revision: v2.4) for the complete schema reference and design rationale. The v1 spec remains available for reference.
The JSON Schema ships with the package as @welldot/core/well.schema.json and is published at https://welldot.org/schema/v2/well.schema.json.
Example wells
The package ships 14 complete, valid .well files in examples/. They are built on real wells from the Brazilian SIAGAS registry, with illustrative names, permits, analyses and operating data. Together they cover crystalline, karst, sedimentary, deep, flowing, hand-dug and monitoring wells, plus incomplete and inconsistent records. Import them as @welldot/core/examples/<file>, or download them from https://welldot.org/examples/<file>.
Installation
# npm
npm install @welldot/core
# pnpm
pnpm add @welldot/core
# yarn
yarn add @welldot/coreRequirements: Node.js >= 18. zod is bundled as a dependency.
Quick Start
import type { Well, BoreHole, Lithology } from '@welldot/core';
import {
WellSchema,
parseWell,
serializeWell,
deserializeWell,
hasWellData,
isWellEmpty,
} from '@welldot/core';
// Parse and validate a .well JSON string — throws ZodError on invalid input
const well = parseWell(rawJsonString);
// Validate an existing object with the Zod schema directly
const result = WellSchema.safeParse(unknownData);
// Serialize a Well object to a versioned JSON string
const jsonString = serializeWell(well);
// Deserialize — handles versioned format and legacy formats
const restored = deserializeWell(jsonString);
// Check if a well has a profile to draw, or holds any data at all
const empty = isWellEmpty(well);
const hasData = hasWellData(well);API Reference
Types
All types are exported as TypeScript type-only exports (zero runtime cost).
| Type | Description |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Well | Complete static record of a water well (v2) |
| BoreHole | A drilled interval with diameter and optional drilling method |
| WellCase | Steel or plastic casing installed in the borehole |
| Reduction | Transition piece between different casing diameters |
| WellScreen | Slotted screen section for water intake (screen_slot in mm) |
| WellStatus | Closed status_change vocabulary: active, maintenance, inactive, decommissioned, abandoned (v2.3) |
| SurfaceCase | Protective casing near the surface |
| HoleFill | Annular fill material (gravel_pack or seal) |
| CementPad | Concrete wellhead pad dimensions |
| Centralizer | Casing/screen centralizers over a depth interval with spacing (v2.1) |
| Lithology | Geological description of a depth interval |
| Texture | { code: string \| number; vocabulary?: string } — lithology texture reference |
| Fracture | A discrete fracture or fracture zone |
| Cave | A cavity or void zone |
| Constructive | Grouped type: borehole + casings + screens + fills |
| Geologic | Grouped type: lithology + fractures + caves |
| WellId | Authority-scoped well identifier { authority, id, primary? } |
| Location | Geographic location with optional elevation and CRS properties |
| LocationProperties | CRS, datum, and precision metadata for a Location |
| LevelReading | A single depth/time reading during a pumping or recovery phase |
| RecoveryPhase | Time-series of level readings after pump shutdown |
| PumpingStep | One flow-rate step in a pumping test |
| HydrodynamicEventBase | Common fields shared by all hydrodynamic event types |
| SpotMeasurementEvent | A single static water level reading |
| ConstantRateEvent | A constant-rate pumping test |
| StepDrawdownEvent | A step-drawdown pumping test |
| AirliftEvent | An air-lift development or test |
| RecoveryOnlyEvent | Recovery measurements without drawdown data |
| LoggerSeriesEvent | Continuous level series recorded by an installed sensor (v2.4) |
| LoggerReading | A logger_series reading, located by datetime (v2.4) |
| BarometricCompensation | logger_series.barometric_compensation values (v2.4) |
| ReadingAggregation | logger_series.aggregation values (v2.4) |
| HydrodynamicEvent | Discriminated union of all event types + x- custom events |
| AquiferAnalysis | An interpreted set of aquifer parameters |
| Attachment | An HTTPS-referenced document, typed by document_type (common type since v2.3) |
| PumpInstallation | One installation of a pump in the well (v2.3) |
| PumpElectrical | Electrical data of a pump installation (v2.3) |
| Permit | A legal instrument that authorizes, exempts or registers the well or its use — drilling or abstraction permit, exemption, registration (v2.3) |
| PermitAdministrativeStatus | 'requested' \| 'granted' \| 'suspended' \| 'revoked' \| 'denied' \| 'withdrawn' (v2.3) |
| PermitHistoryEntry | One administrative step of a permit: filing, process, notification, fee (v2.3) |
| PermitCondition | An obligation (condicionante) of a permit, with derived deadlines and its fulfillments (v2.3) |
| ConditionFulfillment | The record of one condition deadline being met (v2.3) |
| VolumeLimit | A volume stated in a permit for a daily, monthly or annual period (v2.3) |
| MonthlyGrant | One month of a permit's month-by-month grant (v2.3) |
| Meter | One installation of a totalizer (hidrômetro) in the well (v2.3) |
| ProductionEntryBase | Common fields of every production ledger entry (v2.3) |
| MeterReading | A totalizer register value in m³ (type: 'meter_reading') (v2.3) |
| EstimatedVolume | A volume estimated for a period, without a meter (type: 'estimated_volume') (v2.3) |
| FlowReading | An instantaneous flow rate in m³/h with an optional discharge_head in m (type: 'flow_reading'); never part of a volume (v2.6) |
| ProductionEntry | MeterReading \| EstimatedVolume \| FlowReading — one entry of the production ledger (v2.3) |
| OperatingRegime | Declared flow rate, daily operating time and days per week from effective_from (v2.3) |
| WaterSample | One water sample and its results; water_samples is a ledger corrected with corrects (v2.3) |
| SamplingPoint | Where the sample was taken: type, point depth or from/to interval, device, pump_installation_id (v2.3) |
| Purge | Purge before collection: duration, volume, flow rate, stabilization and readings (v2.3) |
| PurgeReading | One stabilization reading during the purge (v2.3) |
| Laboratory | Laboratory, accreditation, report number, batch, receipt instant and temperature (v2.3) |
| WaterQualityResult | One result: exactly one of value, presence or text, plus qualifier, limits, fraction, validation (v2.3) |
| ResultQualifier | '<' \| '>' \| 'not_detected' \| 'estimated' (v2.3) |
| Parameter | { code; vocabulary } — welldot, cas or x-… parameter identity (v2.3) |
| Filtration | Filter pore_size (µm) and location (field | lab) (v2.3) |
| ResultValidation | Reviewer validation: status (unvalidated, validated, qualified, rejected), qualifier, guideline (v2.3) |
| TimeResolution | 'day' — marks an instant known only by its date (*_resolution fields) (v2.3) |
| HistoryLogEntry | One entry in the operational history log (incl. maintenance and status_change fields, and hydrodynamic_event_ids / sample_ids links) |
| Units | { length; diameter; flow?; power?; volume?; head? } — display/input unit preferences |
| LengthUnits | 'm' \| 'ft' |
| DiameterUnits | 'mm' \| 'inches' |
| FlowUnits | 'm3/h' \| 'L/s' \| 'gpm' |
| PowerUnits | 'kW' \| 'cv' \| 'hp' |
| VolumeUnits | 'm3' \| 'L' \| 'ft3' \| 'gal' (gal is the US gallon) |
| HeadUnits | 'm' \| 'mca' \| 'ft' \| 'kPa' \| 'bar' \| 'psi' \| 'kgf/cm2' — head of water; canonical m (1 mca = 1 m). Absent head follows the length unit |
| UnitsTypes | 'metric' \| 'imperial' |
| TextureType | { code: TextureCode; label: string } — a single FGDC texture entry (lookup) |
| TextureCode | number \| string — numeric FGDC code or custom string code |
| SectionKey | Section of a well for share visibility / redaction (includes 'water_quality' since v2.3) |
| ParameterDefinition | One vocabulary entry: code, group, EN label, translations, unit, value form, CAS, molar mass, charge (v2.3) |
| ParameterGroup | Vocabulary group (physical, major_ion, metal, microbiology, …) (v2.3) |
| ParameterForm | 'value' \| 'presence' \| 'text' (v2.3) |
| ParameterUnit | { symbol; ucum? } — canonical unit of a parameter (v2.3) |
| LimitSet, Limit, LimitBasis | A jurisdiction limit set and its per-code limits (v2.3) |
| ConcentrationUnits | 'mg/L' \| 'ug/L' \| 'ng/L' \| 'g/L' (v2.3) |
Validators
Each schema validates its corresponding type at runtime. All schemas are Zod objects and compose with standard Zod methods (.parse, .safeParse, .extend, etc.).
| Export | Validates |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| WellSchema | Well (the complete document; .passthrough() preserves unknown keys) |
| BoreHoleSchema | BoreHole |
| WellCaseSchema | WellCase |
| ReductionSchema | Reduction |
| WellScreenSchema | WellScreen |
| WellStatusSchema | WellStatus (z.enum — any other value is rejected) |
| SurfaceCaseSchema | SurfaceCase |
| HoleFillSchema | HoleFill |
| CementPadSchema | CementPad |
| CentralizerSchema | Centralizer |
| LithologySchema | Lithology |
| TextureSchema | Texture |
| FractureSchema | Fracture |
| CaveSchema | Cave |
| WellIdSchema | WellId |
| LocationPropertiesSchema | LocationProperties |
| LocationSchema | Location |
| LevelReadingSchema | LevelReading |
| RecoveryPhaseSchema | RecoveryPhase |
| PumpingStepSchema | PumpingStep |
| HydrodynamicEventBaseSchema | HydrodynamicEventBase |
| SpotMeasurementEventSchema | SpotMeasurementEvent |
| ConstantRateEventSchema | ConstantRateEvent |
| StepDrawdownEventSchema | StepDrawdownEvent |
| AirliftEventSchema | AirliftEvent |
| RecoveryOnlyEventSchema | RecoveryOnlyEvent |
| LoggerSeriesEventSchema | LoggerSeriesEvent |
| LoggerReadingSchema | LoggerReading |
| HydrodynamicEventSchema | HydrodynamicEvent (discriminated union; only x- types pass through) |
| AquiferAnalysisSchema | AquiferAnalysis |
| AttachmentSchema | Attachment |
| PumpInstallationSchema | PumpInstallation |
| PumpElectricalSchema | PumpElectrical |
| PermitSchema | Permit |
| PermitConditionSchema | PermitCondition |
| ConditionFulfillmentSchema | ConditionFulfillment |
| PermitHistoryEntrySchema | PermitHistoryEntry |
| PermitAdministrativeStatusSchema | PermitAdministrativeStatus |
| VolumeLimitSchema | VolumeLimit |
| MonthlyGrantSchema | MonthlyGrant |
| MeterSchema | Meter (max_reading > 0) |
| ProductionEntryBaseSchema | ProductionEntryBase |
| MeterReadingSchema | MeterReading |
| EstimatedVolumeSchema | EstimatedVolume |
| FlowReadingSchema | FlowReading (non-negative flow_rate and precisions; discharge_head of any sign) (v2.6) |
| ProductionEntrySchema | ProductionEntry (discriminated union + x- passthrough; a known type missing required fields is rejected) |
| OperatingRegimeSchema | OperatingRegime (non-negative daily_operating_time, integer days_per_week 1–7) |
| HistoryLogEntrySchema | HistoryLogEntry |
| WaterSampleSchema | WaterSample (results must have at least one entry) |
| SamplingPointSchema | SamplingPoint (depth and from/to are mutually exclusive) |
| PurgeSchema | Purge |
| PurgeReadingSchema | PurgeReading |
| LaboratorySchema | Laboratory |
| WaterQualityResultSchema | WaterQualityResult (exactly one value form except not_detected; </>/estimated need value; unit required for x- and forbidden for welldot/cas) |
| ResultQualifierSchema | ResultQualifier (z.enum) |
| ParameterSchema | Parameter (vocabulary must be welldot, cas or x-…) |
| FiltrationSchema | Filtration |
| ResultValidationSchema | ResultValidation (closed status enum) |
| TimeResolutionSchema | TimeResolution (z.literal('day')) |
Functions
parseWell(json: string): Well
Parses a raw JSON string and validates it against WellSchema. Throws a ZodError on validation failure. Unknown members (x- fields and blocks) are kept at every level, including inside array items. Placeholders from older writers are read as absent: a blank (empty or whitespace-only) type on well_case, well_screen and reduction items, and a cement_pad whose members are all blank or zero. version is kept as written. Does not handle legacy formats — use deserializeWell for that.
serializeWell(well: Well): string
Serializes a Well object to a versioned .well JSON string ("version": "2.6", WELL_FORMAT_VERSION). Omits null members outside x- fields and @context. Emits location when set; does not emit deprecated flat lat/lng/elevation or other legacy v1 keys. Omits undefined optional fields. Root members the spec does not define (x- fields and blocks, foreign members) are written unchanged after the spec blocks, as the spec requires. Never writes placeholders: a blank type on well_case, well_screen and reduction items is omitted (unknown material), and so is a cement_pad whose members are all blank or zero.
deserializeWell(jsonString: string): Well | null
Parses and normalizes a JSON string into a Well. Handles multiple formats:
- v2 format (
"version": "2.x", or the integer2written before v2.4) — passes v2-specific fields through directly - v1 format (
"version": 1) — applies v1→v2 normalizations:fgdc_texture→texture,screen_slot_mm→screen_slot, flatlat/lng/elevation→location - Legacy formats with
constructive/geologicsub-objects - Legacy
diam_polinch diameters →diametermm conversion (× 25.4) - Typo
bole_hole→bore_holecompatibility - Placeholders, in every version: a blank
typeonwell_case,well_screenandreductionitems is dropped, and so is acement_padwhose members are all blank or zero (an absentcement_padis left absent)
A v2 file keeps its version as written (2, "2.4", …); serializeWell always writes the current version. Returns null if the parsed data is empty. Throws on unrecognized version numbers.
Format version and time zone (v2.4)
| Export | Description |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| WELL_FORMAT_VERSION | The version serializeWell writes: "2.6". |
| parseFormatVersion(value) | Parses 2 or "M.m" into a FormatVersion ({ major, minor }); undefined for 2.4, "2.4.1", "v2.4" and other values. |
| compareFormatVersions(a, b) | Compares two "M.m" strings as two integers ("2.10" is after "2.9"); throws on malformed input. |
| isIanaTimeZone(value) | Whether value is an IANA time zone name (America/Belem), for location.properties.timezone. Offsets are not valid. |
| LoggerSeriesEvent / LoggerReading | Types of the logger_series hydrodynamic event and its readings; validated by LoggerSeriesEventSchema / LoggerReadingSchema. |
isWellEmpty(well: Well | null | undefined): boolean
Returns true when all constructive and geologic arrays are empty. Accepts null and undefined (both treated as empty).
hasWellData(well: Well | null | undefined): boolean
Returns true when the well holds any data: a profile, or any other filled root member (identification, location, events, samples, permits, x- members, …). A registry record without construction or geology has data although isWellEmpty says it has nothing to draw. Blank strings, zeros and objects holding only those do not count.
calculatedWellDepth(well: Well): number
Deepest to across the constructive arrays (bore hole, casings, screens, reductions, hole fill), ignoring geology. 0 without constructive data. Used as the fallback for a missing well_depth.
redactWell(well: Well, visibility: WellVisibility): Well
Copy of well with hidden parts emptied (arrays become [], optional fields are removed), so the result stays schema-valid. visibility keys are the 7 SECTION_KEYS and/or the fields of VISIBILITY_TREE (e.g. meters, permits, location); false hides, missing keys are visible, and a hidden section hides all its fields. VISIBILITY_LEAF_KEYS lists the finest toggles. References from visible records to hidden ones are left as-is. Unknown root members (x- fields and blocks) are kept only when nothing is hidden; nested ones follow their record.
redactWell(well, { operation: false }); // whole section
redactWell(well, { meters: false, location: false }); // single fieldsUnit conversion
.well files always store canonical SI units; these helpers convert for display and input.
| Quantity | Functions |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Length | metersToFeet, feetToMeters |
| Diameter | mmToInches, inchesToMm, slotNumberToMm, mmToSlotNumber |
| Flow | cubicMeterPerHourToLitersPerSecond, litersPerSecondToCubicMeterPerHour, cubicMeterPerHourToUsGallonsPerMinute, usGallonsPerMinuteToCubicMeterPerHour, flowFromCanonical, flowToCanonical |
| Power | cvToKilowatts, kilowattsToCv, hpToKilowatts, kilowattsToHp, powerFromCanonical, powerToCanonical |
| Volume | litersToCubicMeters, cubicMetersToLiters, cubicMetersToCubicFeet, cubicFeetToCubicMeters, cubicMetersToUsGallons, usGallonsToCubicMeters, volumeFromCanonical, volumeToCanonical |
| Time | minutesToHours, hoursToMinutes |
| Pressure | kilopascalToPsi, psiToKilopascal |
| Head | headFromCanonical, headToCanonical (HeadUnits: m, mca, ft, kPa, bar, psi, kgf/cm² ↔ canonical m of water), METER_OF_WATER_KPA (9.80665 kPa per m) (v2.6) |
| Transmissivity | squareMeterPerSecondToSquareMeterPerDay, squareMeterPerDayToSquareMeterPerSecond |
| Coordinates | decimalDegreesToDms, dmsToDecimalDegrees (DmsCoordinate) |
| Concentration | concentrationToCanonical, concentrationFromCanonical (ConcentrationUnits: mg/L, µg/L, ng/L, g/L ↔ canonical mg/L) (v2.3) |
| Conductivity | milliSiemensPerMeterToMicroSiemensPerCm (×10), milliSiemensPerCmToMicroSiemensPerCm (×1000) (v2.3) |
| Lab report import | turbidityCodeForUnit (NTU/FNU/FAU/FTU/uT → turbidity code), normalizeColorUnit (mg Pt-Co/L, PCU, TCU → uH), expandedToStandardUncertainty (U / k → one-sigma value_precision) (v2.3) |
*FromCanonical(value, unit) converts from the canonical unit (m³/h, kW, m³, m of head) to the given display unit; *ToCanonical(value, unit) converts back.
Water Quality Vocabulary and Limit Sets (v2.3)
The welldot water quality parameter vocabulary is published as versioned data. Each ParameterDefinition carries the code, group, canonical English label, translations (labels.pt), canonical unit (display symbol and UCUM code), value form (value, presence or text), the CAS equivalence when one exists, and molar mass and charge for ions used in ion balance and hydrochemical diagrams.
| Export | Description |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| WATER_QUALITY_PARAMETERS | The 98 welldot parameter definitions |
| WATER_QUALITY_VOCABULARY_VERSION | Version of the published vocabulary |
| WATER_QUALITY_UNITS | Canonical units used by the vocabulary (mg/L, µS/cm, °C, mV, NTU/FNU/FAU/FTU, uH, MPN/CFU counts, Bq/L) |
| getParameterDefinition(param) | Looks up a { code, vocabulary }; a cas code resolves through the published equivalences to its welldot entry |
| parameterKey(param) | Canonical identity — a welldot code and its CAS equivalent produce the same key (duplicate detection, grouping) |
| isKnownParameter(param) | false only for a welldot code unknown to this vocabulary version (cas and x- are always accepted) |
| WHO_GDWQ_2022 | WHO Guidelines for Drinking-water Quality (2022) |
| BR_GM_MS_888_2021 | Brasil — Portaria GM/MS 888/2021 |
| EU_2020_2184 | EU Drinking Water Directive 2020/2184 |
| WATER_QUALITY_LIMIT_SETS | All bundled limit sets, in display order |
| getLimitSet(id) | Finds a bundled limit set by id (who_gdwq_2022, br_gm_ms_888_2021, eu_2020_2184) |
| NEPHELOMETRIC_TURBIDITY_CODES | turbidity, turbidity_ntu, turbidity_fnu — compared with nephelometric limits; turbidity_fau never is |
import {
getLimitSet,
getParameterDefinition,
parameterKey,
} from '@welldot/core';
getParameterDefinition({ code: '14808-79-8', vocabulary: 'cas' })?.code; // 'sulfate'
parameterKey({ code: 'sulfate', vocabulary: 'welldot' }); // 'sulfate'
getLimitSet('who_gdwq_2022')?.limits.find(l => l.code === 'arsenic');Limits are never written to .well files (jurisdiction neutrality): consumers pick a set at display time and compare results with the derivation helpers of @welldot/utils. The bundled limit values are transcribed from the cited sources and must be verified against the official documents before any regulatory use.
Recommended Vocabularies (v2.3)
Many .well string fields are open: any value (or an x- extension) is valid, but the spec recommends a vocabulary. Each one is exported as data, with display labels keyed by BCP 47 language tag (en and pt always present). Field types use OpenVocab<T> (T | (string & {})), so the recommended values autocomplete while any string still type-checks.
| Vocabulary | Field |
| ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| WELL_TYPES | well_type (artesian is deprecated) |
| WELL_PURPOSES | well_purpose[] |
| DRILLING_METHODS | bore_hole[].drilling_method |
| CONSTRUCTION_MATERIALS | well_case[].type, well_screen[].type, reduction[].type, pump_installations[].riser_material |
| SCREEN_SLOT_TYPES | well_screen[].slot_type |
| CENTRALIZER_TYPES | centralizers[].type |
| CEMENT_PAD_TYPES | cement_pad.type |
| PUMP_TYPES, POWER_SOURCES | pump_installations[].type, .power_source |
| METER_TYPES | meters[].type |
| READING_SOURCES, ESTIMATION_METHODS | production[].source, production[].method |
| PERMIT_TYPES, WATER_USES | permits[].type, permits[].water_use[] |
| CONDITION_CATEGORIES | permits[].conditions[].category |
| PERMIT_HISTORY_TYPES | permits[].history[].type |
| HISTORY_LOG_CATEGORIES, HISTORY_LOG_SEVERITIES, MAINTENANCE_TYPES | history_logs[].category, .severity, .maintenance_type |
| HYDRODYNAMIC_EVENT_TYPES, MEASUREMENT_METHODS | hydrodynamic_events[].type, .measurement_method |
| AQUIFER_ANALYSIS_METHODS | aquifer_analysis[].method |
| DOCUMENT_TYPES, DOCUMENT_TYPE_SUGGESTIONS | attachments[].document_type (and per-context suggestion order) |
| SAMPLE_TYPES, SAMPLING_METHODS, SAMPLING_POINT_TYPES, SAMPLING_DEVICES | water_samples[] sampling fields |
Labels are LanguageText<'en' | 'pt'>. LanguageText<L> is the general localized-text type (Record<string, string> keyed by BCP 47 tag), where L lists the tags that must be present — LanguageText alone requires none. LanguageTextInput adds the plain-string, JSON-string and null/undefined forms accepted by resolveLanguageText.
| Helper | Description |
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| getVocabLabel(vocab, value, locale) | Label in locale (pt-BR → pt → en); free-text and x- values are returned as-is |
| resolveLanguageText(text, locale) | Resolves a LanguageTextInput with the same fallback: a LanguageText object, a plain string (returned as-is), a JSON object string (parsed; malformed JSON stays a plain string) or null/undefined (''); empty labels count as missing |
| getVocabEntry / isVocabValue | Looks up a value's entry / checks whether it is recommended |
| vocabValues(vocab, { includeDeprecated }) | The recommended values, deprecated ones left out by default |
| formatVocabList(vocab, values, locale) | Comma-separated labels of a multi-valued field (e.g. well_purpose), unknown values kept as-is |
import {
CONSTRUCTION_MATERIALS,
PERMIT_TYPES,
getVocabLabel,
type OpenVocab,
type PermitType,
} from '@welldot/core';
const type: OpenVocab<PermitType> = 'abstraction_permit'; // or any string
getVocabLabel(PERMIT_TYPES, type, 'pt'); // 'Outorga de direito de uso'
getVocabLabel(PERMIT_TYPES, 'x-special', 'pt'); // 'x-special'Closed vocabularies
Fields whose values the schema fixes (no free text, no x-) ship in the same shape as the open vocabularies — VocabEntry lists with en/pt labels — so getVocabLabel labels any value without consumer translations. Each list is checked at compile time against its type, so it cannot drift from the schema. The *_VALUES lists are the bare values.
| Vocabulary | Field |
| ------------------------------------------------------------- | --------------------------------------------- |
| WELL_STATUSES (WELL_STATUS_VALUES) | history_logs[].status (status_change) |
| PERMIT_ADMINISTRATIVE_STATUSES | permits[].status |
| VOLUME_LIMIT_PERIODS | permits[].volume_limits[].period |
| PRODUCTION_ENTRY_TYPES | production[].type |
| RESULT_QUALIFIERS (QUALIFIER_VALUES) | result qualifier |
| RESULT_FRACTIONS (FRACTION_VALUES) | result fraction |
| MEASUREMENT_LOCATIONS | result measured_in, filtration.location |
| VALIDATION_STATUSES (VALIDATION_STATUS_VALUES) | result validation.status |
| PARAMETER_GROUPS (PARAMETER_GROUP_VALUES) | parameter vocabulary groups, in display order |
| BAROMETRIC_COMPENSATIONS (BAROMETRIC_COMPENSATION_VALUES) | logger_series.barometric_compensation |
| READING_AGGREGATIONS (READING_AGGREGATION_VALUES) | logger_series.aggregation |
Value rules without labels: NUMERIC_QUALIFIERS, PARENT_SAMPLE_TYPES, BLANK_SAMPLE_TYPES. Parameter names: getParameterLabel(parameter, locale) (CAS numbers resolve through the published equivalences; unknown codes are returned as-is).
FGDC Texture Patterns
FGDC_TEXTURES_OPTIONS is a typed array of 284 texture pattern entries drawn from the FGDC Digital Cartographic Standard for Geologic Map Symbolization (FGDC-STD-013-2006). Assign a code to the texture field of a Lithology record to attach a standardized fill pattern to a depth interval.
import { FGDC_TEXTURES_OPTIONS } from '@welldot/core';
import type { Texture, TextureCode } from '@welldot/core';
// Lookup by code
const sandstone = FGDC_TEXTURES_OPTIONS.find(t => t.code === 607);
// { code: 607, label: 'Massive sand or sandstone' }
// Build a select list for a UI
const options = FGDC_TEXTURES_OPTIONS.map(t => ({
value: t.code,
label: t.label,
}));Codes are grouped by series:
| Series | Category | | ------ | ------------------------------------------------------ | | 100 | Surficial deposits | | 200 | Sedimentary patterns | | 300 | Igneous patterns | | 400 | Miscellaneous / Metamorphic patterns | | 500 | Glacial / Periglacial patterns | | 600 | Sedimentary lithology (most useful for well logging) | | 700 | Metamorphic and igneous lithology |
See fgdc-textures.md for the complete annotated list of all 284 codes.
.well Format Overview
All depths are in meters from ground level (0 = surface). All diameters are in millimeters. Geographic coordinates use WGS84 decimal degrees. The MIME type is application/vnd.well+json.
A minimal v2.6 .well document:
{
"version": "2.6",
"well_type": "tubular",
"name": "PP-01",
"location": { "lat": -1.4558, "lng": -48.5039, "elevation": 12.5 },
"bore_hole": [
{ "from": 0, "to": 80, "diameter": 250, "drilling_method": "rotary" }
],
"well_case": [
{ "from": 0, "to": 60, "type": "carbon_steel", "diameter": 200 }
],
"reduction": [],
"well_screen": [
{
"from": 60,
"to": 80,
"type": "stainless_steel",
"slot_type": "continuous_slot",
"diameter": 150,
"screen_slot": 0.5
}
],
"surface_case": [{ "from": 0, "to": 3, "diameter": 300 }],
"hole_fill": [
{
"from": 60,
"to": 80,
"type": "gravel_pack",
"diameter": 250,
"description": "2-4mm gravel"
}
],
"cement_pad": {
"type": "concrete",
"width": 1.0,
"thickness": 0.15,
"length": 1.0
},
"lithology": [],
"fractures": [],
"caves": []
}For the complete schema reference, field vocabulary, and design rationale see the .well v2 format specification. The v1 spec remains available for reference.
Contributing
Issues and pull requests are welcome. The source lives in packages/core within the well-profiler monorepo.
git clone https://github.com/welldothq/welldot.git
cd well-profiler
pnpm install
cd packages/core
pnpm build
pnpm testLicense
Apache 2.0 — see LICENSE for the full text.
