@welldot/core 0.1.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,85 @@
1
+ # `.well` File Format Specification — Version 2.0: Overview
2
+
3
+ **Version:** 2.0 **Extension:** `.well` **Encoding:** UTF-8 **Base format:** JSON **MIME type:** `application/vnd.well+json` **JSON Schema:** `https://welldot.org/schema/v2/well.schema.json` **JSON Schema draft:** 2020-12 **JSON-LD Context (optional):** `https://welldot.org/context/v2.jsonld` **Status:** Ratified — shipped in `@welldot/core` v0.2.0
4
+
5
+ **See also:** [format-reference.md](./format-reference.md) · [object-schemas.md](./object-schemas.md) · [interoperability.md](./interoperability.md)
6
+
7
+ ---
8
+
9
+ ## Changes from v1
10
+
11
+ ```
12
+ v2.0 additions:
13
+ - location object (supersedes top-level lat/lng/elevation)
14
+ - well_id (array of authority-scoped identifiers)
15
+ - profiles (JSON Schema URLs for regulatory and domain-specific constraints)
16
+ - texture object (multi-vocabulary, replaces v1 fgdc_texture string)
17
+ - hydrodynamic_events (append-only ledger of water-level observations)
18
+ - aquifer_analysis (interpreted aquifer parameter sets)
19
+ - history_logs (operational log of interventions and incidents,
20
+ with updated_at edit timestamp)
21
+ - optional @context (reserved for JSON-LD interoperability)
22
+ - optional *_precision fields on key measurements
23
+ - WellScreen.screen_slot renamed from screen_slot_mm
24
+
25
+ v2.0 tightenings:
26
+ - All numeric values are SI by spec. The format does not encode a
27
+ units declaration; see § Units for the canonical mapping. v1 was
28
+ de facto SI in practice and no v1 file in existence declared
29
+ non-SI units, so this is a clarification rather than a breaking
30
+ change. Display and input units are application concerns.
31
+
32
+ v2.0 preserves all v1 fields. Parsers must accept v1 documents
33
+ unchanged and must accept the following v1-to-v2 normalizations:
34
+ - Top-level lat/lng/elevation → location.lat/lng/elevation
35
+ - fgdc_texture: "<code>" → texture: { code, vocabulary: "fgdc" }
36
+ - screen_slot_mm → screen_slot (value preserved; both versions are
37
+ in millimeters)
38
+ - bole_hole → bore_hole (v1 typo compatibility)
39
+ - diam_pol (inches) → diameter (mm), multiplied by 25.4
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Purpose
45
+
46
+ The `.well` format is an open standard for representing water well data. It is designed to serve three distinct but complementary use cases:
47
+
48
+ **Visualization.** The format contains sufficient constructive and geological detail to produce accurate technical well profile drawings — including borehole geometry, casing strings, screens, gravel packs, lithological columns, fractures, and caves — at true depth scale.
49
+
50
+ **Registration.** The format captures the administrative and physical identity of a well, providing a complete static record suitable for submission to regulatory bodies, inclusion in national well registries, and long-term archival.
51
+
52
+ **Research.** The structured geological and constructive data, combined with the hydrodynamic event ledger and interpreted aquifer parameters, enables cross-well analysis, aquifer characterization, and hydrogeological research. Field vocabulary choices are aligned with international standards.
53
+
54
+ ---
55
+
56
+ ## Design Principles
57
+
58
+ - **Self-describing** — full field names are used throughout; a `.well` file can be read and understood without consulting the spec.
59
+ - **Versioned** — includes a `version` field for forward compatibility; parsers must reject unrecognized versions.
60
+ - **Self-contained** — a single file encodes the complete record of one well.
61
+ - **Units are SI, declared by spec** — all numeric values in a `.well` file are stored in SI units. The format does not encode a per-file units declaration. See § Units for the canonical unit of each quantity. Conversion to and from a user's preferred display or input units is an application concern.
62
+ - **CRS is declared, not assumed** — geographic coordinates are accompanied by an explicit coordinate reference system declaration. The default is WGS84 (`EPSG:4326`).
63
+ - **Ground level as zero** — all depth values are measured from ground level (0); elevation above the WGS84 ellipsoid (or declared datum) is stored separately in `location.elevation`.
64
+ - **Geographic north** — all azimuth values are referenced to geographic north.
65
+ - **Append-only event history (by authoring convention)** — `hydrodynamic_events` is intended as a ledger. New measurements should be added as new entries; existing entries should not be modified. This is enforced by authoring tools in the welldot stack, not by the file format itself. The format provides `id`, `datetime`, and `sequence` to support this discipline.
66
+ - **Derived values are never stored raw** — `s/Q`, `Q/s`, drawdown `s`, and any other value computable from stored fields must not appear as stored fields. Applications compute them on demand.
67
+ - **Interpreted results are versioned** — `aquifer_analysis` records which method was used, who performed the analysis, and which events were used as input. Multiple analyses may coexist.
68
+ - **Graceful incompleteness** — a record with only a flow rate and a dynamic level is valid. A record with only a static level measurement is valid. Validators must not reject incomplete events.
69
+ - **Mutable operational log with edit traceability** — `history_logs` entries are editable to allow correction of field errors. Each entry carries a separate `updated_at` timestamp that records when the entry itself was last modified, distinct from the `datetime` field that records when the logged event occurred.
70
+ - **Preserve unknown members** — parsers must preserve and pass through any unrecognized fields or top-level blocks without modification, following the GeoJSON foreign members convention. This ensures forward compatibility.
71
+
72
+ ---
73
+
74
+ ## Known Limitations of v2
75
+
76
+ The following are recognized limitations of this version, reserved for future versions:
77
+
78
+ - **No internationalization of text fields.** All free-text fields (`description`, `notes`, `author`, etc.) are opaque strings with no language tag. A file produced in Brazil will have Portuguese content; one from Norway will have Norwegian. v3 will consider BCP 47 language objects for text fields, with backward-compatible string fallback.
79
+ - **No water quality block.** Chemical and physical water quality measurements are out of scope for v2 and reserved for v3.
80
+ - **No geophysical logs block.** Downhole geophysical surveys (resistivity, gamma ray, caliper) are out of scope for v2 and reserved for v3.
81
+ - **No multi-well linking.** Storativity determination requires observation well data. The top-level `references` field name is reserved for v3 to link wells across files.
82
+
83
+ ---
84
+
85
+ _`.well` Format Specification v2.0 — Ratified_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@welldot/core",
3
- "version": "0.1.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "TypeScript types, Zod validators, and serialization utilities for the .well open format — a JSON standard for water well data.",
6
6
  "keywords": [
@@ -50,16 +50,19 @@
50
50
  "dist",
51
51
  "README.md",
52
52
  "LICENSE",
53
- "well-specifications.md"
53
+ "docs"
54
54
  ],
55
55
  "dependencies": {
56
+ "defu": "^6.1.4",
56
57
  "zod": "^3.23.8"
57
58
  },
58
59
  "devDependencies": {
59
60
  "tsup": "^8.3.0",
61
+ "tsx": "^4.22.0",
60
62
  "typescript": "^5.3.3",
61
63
  "vite": "^8.0.9",
62
64
  "vitest": "^4.1.5",
65
+ "zod-to-json-schema": "^3.25.2",
63
66
  "@welldot/lint": "0.0.1"
64
67
  },
65
68
  "scripts": {
@@ -67,6 +70,7 @@
67
70
  "dev": "tsup --watch",
68
71
  "lint": "eslint .",
69
72
  "lint:fix": "eslint . --fix",
70
- "test": "vitest run"
73
+ "test": "vitest run",
74
+ "generate:schema": "tsx scripts/generate-schema.ts"
71
75
  }
72
76
  }