Add LinkML schema for harmonized soil moisture data#3
Conversation
Introduce src/schemas/target_schema.yaml, a LinkML representation of the canonical 9-column harmonized dataset schema defined in target_schema.py. - HarmonizedRecord class with one slot per harmonized column, in the same order as HARMONIZED_COLUMNS - Slot ranges mirror EXPECTED_DTYPES (datetime, string, float, boolean) - minimum_value/maximum_value constraints mirror VALID_RANGES, with UCUM units on the measurement slots - datetime_UTC and site_id marked required; a class rule enforces that at least one moisture variable is present (matching validate_required_fields) - QCFlagVocabulary enum mirrors the Python enum (d1, g1, g2) - HarmonizedDataset wrapper class for a collection of records Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FUi8KYjn6jZ3QtznZi7yXE
Build out src/schemas/target_schema.yaml into a conventional LinkML project with examples, generated artifacts, and CI. - examples/valid and examples/invalid: instance files that must pass / must fail validation, covering required fields, value ranges, types, and the at-least-one-moisture-variable rule - project/pydantic/target_schema.py and project/jsonschema/target_schema.schema.json: generated, committed artifacts (gen-pydantic / gen-json-schema) - Reworked the moisture rule with an always-true precondition so it emits a well-formed if/then conditional that JSON Schema validators enforce - Dropped the unused qudt prefix; added .linkmllint.yaml disabling the naming rule (column names are a fixed external contract) - Makefile with gen / lint / test-examples / test-pytest targets - tests/test_target_schema_examples.py: pytest wrapper (skipped without linkml) - .github/workflows/linkml.yml: lint, validate examples, run pytest, and fail if committed artifacts drift from the schema - linkml optional-dependency group in pyproject.toml; README schema section; ignore examples/output working dir Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FUi8KYjn6jZ3QtznZi7yXE
|
@claude review this PR |
|
Claude finished @cmungall's task —— View job PR Review
Overall this is a well-structured, clean PR. The schema faithfully mirrors Issues1. The enum exists but no slot in 2. The JSON Schema The generated JSON Schema uses 3. Pydantic model does not enforce the The 4.
5. Minor:
Positives
Minor nits
|
- Fix repo_root default-arg bug: Option default None, resolve in body (was Path.cwd() evaluated at import time) [#6] - Audit the LS tool (path) [#8]; check Grep/Glob 'glob'/'pattern' for path-bearing patterns [#7] - Flag 'cd' into an answer location (answer key / real gold/processed), so a single-component read after it isn't missed [#1] - Remove dead '&& ||' token guard [#3] - --show-bash prints full multi-line commands instead of just the first line [#5] - Tests: LS, Grep glob, cd-into-answer-key, multi-cd chain, ~ expansion 53 tests green; real fold_ds07 trace still CLEAN. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
This PR introduces a LinkML schema definition for the harmonized soil moisture dataset, providing a formal semantic representation of the canonical 9-column target schema that all harmonized datasets must conform to.
Key Changes
src/schemas/target_schema.yaml- A complete LinkML schema defining the harmonized soil moisture data structureHarmonizedRecordclass representing a single row with 9 slots (datetime_UTC, site_id, depth_m, replicate, is_timeseries, interval_min, and three moisture measurement variables)HarmonizedDatasetclass as a collection of harmonized recordsQCFlagVocabularyenumeration for quality control flag valuestarget_schema.pymodule (HARMONIZED_COLUMNS, EXPECTED_DTYPES, VALID_RANGES)Notable Implementation Details
datetime_UTCandsite_idare marked as requiredhttps://claude.ai/code/session_01FUi8KYjn6jZ3QtznZi7yXE