losalamos.tools.ingest_variables#
Batch-creation tool for variable registry notes.
Reads a seed file (TOML, YAML, or JSON) and writes one Obsidian .md note
per entry into a target vault folder using losalamos.notes.NoteVariable.
Codes are user-assigned and must appear in each entry. Shared fields
(subject, tags, category, etc.) can be declared once in
defaults and are merged into every entry automatically.
Usage#
python -m losalamos.tools.ingest_variables --variables <seed_file> [--overwrite]
Seed file#
The seed holds one or more batches. Each batch targets one vault folder
and carries its own defaults and entries.
[[batch]]
vault = "/path/to/vault/hydrology"
[batch.defaults]
subject = "[[Surface Hydrology]]"
tags = ["hydrology"]
category = "physical"
[[batch.entries]]
code = "F101V001"
name = "Streamflow"
alias = "streamflow"
units = "m^3/s"
range = "[0U)"
symbol = "Q"
dimension = "L^{3}/T"
[[batch]]
vault = "/path/to/vault/climate"
[batch.parameters]
fallback_title = false
[batch.defaults]
subject = "[[Climatology]]"
tags = ["climate"]
batch:
- vault: /path/to/vault/hydrology
defaults:
subject: "[[Surface Hydrology]]"
tags: [hydrology]
category: physical
entries:
- code: F101V001
name: Streamflow
alias: streamflow
units: m^3/s
range: "[0U)"
symbol: Q
dimension: "L^{3}/T"
- vault: /path/to/vault/climate
parameters:
fallback_title: false
defaults:
subject: "[[Climatology]]"
tags: [climate]
entries: []
[
{
"vault": "/path/to/vault/hydrology",
"defaults": {
"subject": "[[Surface Hydrology]]",
"tags": ["hydrology"],
"category": "physical"
},
"entries": [
{
"code": "F101V001",
"name": "Streamflow",
"alias": "streamflow",
"units": "m^3/s",
"range": "[0U)",
"symbol": "Q",
"dimension": "L^{3}/T"
}
]
},
{
"vault": "/path/to/vault/climate",
"parameters": {"fallback_title": false},
"defaults": {
"subject": "[[Climatology]]",
"tags": ["climate"]
},
"entries": []
}
]
Batch keys#
vaultRequired per batch. Path to the destination vault folder.
parametersOptional dict of batch-level behavioural flags.
fallback_title(bool, defaulttrue)When
true, entries whosetitleis absent or empty receive the value ofnameas their title automatically.
defaultsFields applied to every entry in the batch. Entry-level values override on conflict, except for
tagswhich are merged additively.tagsAdditive.
defaultstags apply to every entry; entry-level tags extend them. The base tagvariable-noteis always prepended.subjectEntry-level value overrides the default for that entry. Write as Obsidian wiki-link notation:
[[Note Name]].codeUser-assigned. Not validated — omitting it leaves the field blank.
Functions
|
Read a seed file (TOML, YAML, or JSON) and process all batches. |
- losalamos.tools.ingest_variables.ingest_variables(seed_path: Path, overwrite: bool = False) None[source]#
Read a seed file (TOML, YAML, or JSON) and process all batches.
The seed must be a list of batch dicts, each with a
vault, optionaldefaults, and anentrieslist. TOML and YAML files may wrap batches under a top-levelbatchkey; JSON files may be a bare list. A single batch dict is also accepted.- Parameters:
seed_path (
pathlib.Path) – Path to the seed file (TOML, YAML, or JSON).overwrite (bool) – If
False(default), existing files are skipped.