Repository navigation
v0.6.0-rc1
Pre-releaseThis release makes output match the target schema, catches more spec mistakes before a run, and replaces Session with a shorter way to set up a transformer from Python, along with a rewrite of the docs and tutorials.
The output-typing and identifier changes were validated against dm-bip before release. Every BDC cohort ran end to end and was checked against BDCHM, with no map-time or validation failure traced to linkml-map.
Heads up: output changes
These make output valid against the target schema where it wasn't before, but a downstream consumer may see different values.
- Values take the target schema's type. When a slot derivation declares no
range, values are now coerced to the target slot's range from--target-schema. This coverspopulated_from,expr:andvalue:results.'52.3'from a TSV becomes a number,"false"becomesFalse, and a value that can't be parsed fails at mapping time instead of at validation. An explicit specrangestill wins. (#361, #366) - Enum-ranged slots emit the permissible value key. A spec can spell a value by its key,
meaning,titleor an alias.FEMALEandOMOP:8532both come out as the key. A value matching no permissible value passes through with a warning, or fails under--strict. (#373) - Decimals are exact everywhere.
range: decimalvalues become exact decimals and are written as exact numbers in JSON, YAML, TSV/CSV, Parquet and DuckDB. Trailing zeros are kept (52.30stays52.30). (#355) - Streaming YAML drops null slots, like the JSON writers already did. (#367)
- Tabular runs apply
is_ainheritance. A class derivation'sis_a/mixinsparents were applied when mapping single objects but ignored when streaming TSV/CSV input, so inherited slot derivations and joins were missing from the output. (#388)
Heads up: identifiers are opt-in
A class derivation whose target class has an identifier slot it doesn't derive is now an error, unless you set mint_ids: true on the spec, in class_defaults.<Class>, or on the class derivation. With it set, the record gets a content-hash id: uuid5 of the record's canonical content, so the same record always gets the same id. These are content hashes, not stable identifiers. Entities other records refer to (participants, visits) should keep deriving natural-key ids. (#357, #365)
Heads up: runs that silently did nothing now fail
- No input data is an error. If no class derivation finds its table in the input,
map-datanow fails withNo input data for any class derivation: expected one of ['Person'], found ['people']. It used to write nothing and exit 0. Runs where only some derivations find data are unchanged. (#379) - A single input file is read as
--source-type. Tables are named by file stem, somap-data --source-type Person people.tsvlooked for aPersontable, foundpeople, and produced nothing. A single file now takes the--source-typename. (#379) - Statement blocks under
--unrestricted-evalrun as written. A multi-statement expression used to run only its first statement and ignore assignments. It now runs in full, reading slots assrc.<slot>. A{slot}or bare slot name there is undefined, and fails the row instead of quietly returning None or a wrong value. Single expressions are unchanged. (#383)
Removed and deprecated
Sessionis deprecated. Construct anObjectTransformerinstead (below). It now carries the standard@deprecatedmarker, so type checkers and IDEs flag its use. (#377, #387)- The function-based stream writers are removed:
yaml_stream,json_stream,jsonl_stream,tsv_stream,csv_stream,get_stream_writerandTabularStreamWriter.stream, deprecated since 0.5.4. Usemake_stream_writerandStreamWriter.process, orMultiStreamWriter. (#385) from linkml_map import *no longer exportsSession. It raisedAttributeErrorbefore, since__all__listed a name the package never imported. (#351)
Setting up a transformer in Python
The constructor takes the spec and schemas as paths, dicts or loaded objects, replacing Session. load_specification is exported too. (#376, #379)
from linkml_map import ObjectTransformer
tr = ObjectTransformer(specification="spec.yaml", source_schemaview="source.yaml", target_schemaview="target.yaml")
tr.map_object(row)Constant records are emitted once
A class derivation with no populated_from whose slots are all constant value:s now yields one object and reads no input, instead of one copy per row of some table. (#390)
validate-spec catches more before you run
These checks also run in the map-data pre-flight.
value:andvalue_mappingsliterals that aren't permissible values of the target enum. (#374)- A spec
rangethat overrides a conflicting target range, such asrange: stringon an enum slot. (#375) - A
range:that names no type, class or enum. (#383) - Misspelled keys in a derivation's own
joins:block. These used to pass, and then every joined value came out null. (#382) - Fewer false errors: on dotted references through joined tables (#378), constant
value:slots (#350), andis_a-only parent derivations (#359).
Docs
The docs are split into a Quick Start, a Python Tutorial, a Writing Specifications guide and a Command-Line Reference, with every example re-run. The tutorials no longer use Session. Schema reference pages moved to per-kind folders, so links like schema/ClassDerivation/ are now schema/classes/ClassDerivation/. (#377, #384)
Other fixes
multi_file_transformerresolved inputs against the output directory when given a stringoutput_directory. (#352)- CSV output didn't quote list and dict cells, so a multi-item list split across columns. (#355)
Dependencies
- linkml and linkml-runtime are locked at 1.12.1. The
>=1.11.0floor is unchanged. - New:
simplejson(exact decimals in JSON) andtyping-extensions(the@deprecatedmarker).