Advanced Octave A17 — Provenance of derived results
Advanced GNU Octave with GX-TXT · Module 03
A derived result is more useful when we can understand which data has generated it and what operation has been applied. This lesson publishes a new synthetic series with a reference to the source and structured metadata readable through public APIs.
Objectives and prerequisites
We use the Synthetic Dataset of lesson A07 and introductory course publishing skills. The test uses GX-TXT dev112-P011-bis and Octave 9.4.0. We multiply the tension for two: the operation is didactic and the result is not a measure.
The octave_advanced_scaled output dataset is created-only. Run the test in a dedicated session with the free ID; to repeat it choose a new ID or a new session, without erasing existing results.
Describe source and operation
Import provenienza.m, record it in the Session and run it in the Runner.
After reading the source values, the script builds two metadata and includes them in the publication request:
metadata = struct();
metadata.('study.kind') = 'synthetic';
metadata.('processing.operation') = 'multiply voltage by 2';
request = struct('dataset_id',target,'contract','table.generic','storage','csv', ...
'x_values',t,'y_values',2*original,'source_dataset_ids',{{source}}, ...
'structured_metadata',metadata, ...
'x_variable',struct('variable_id','time_s','name','time_s','unit','s'), ...
'y_variable',struct('variable_id','scaled_v','name','scaled_v','unit','V'));
gxtxt_api_call('DATASET_PUBLICATION_API_v2','publish_series',{request});
The source_dataset_ids field identifies the bed dataset; the metadata declare that the study is synthetic and that the tension has been multiplied by two. Structured fields and reference to the source perform complementary functions: the description does not replace identity and identity alone does not explain transformation.
Reread data and metadata
The script calls DATASET_METADATA_API_v1/read for metadata and CANONICAL_DATASET_API_v2/read_range for published values.
In the test the new Dataset contains 11 rows and the first value is 2,400 V, the double of 1,2 V in the source series. The reading shows processing.operation and study.kind; the framework can add more own information. The shown control does not verify all 11 values nor demonstrates that a textual description is correct: in a real case it systematically compares output, formula and sources.
Document without inventing
It only records actually used sources and parameters actually applied. If you change units, declare the appropriate conversion; multiply a value by two does not automatically change its physical size. Stores version of the script, conditions and limits: metadata completes the analysis, but do not replace scientific controls.
Exercise
- Which Dataset is declared as a source?
- What is the difference between the reference to the source and
processing.operation? - Why not read metadata is not enough to verify the whole transformation?
Worked solution
octave_advanced_sensor.- The first identifies the origin; the second describes the declared operation.
- It is also necessary to compare the values and verify that the description corresponds to the code and actual data.
Other steps of this project
- Advanced Octave A75 — Dynamical systems in phase space
- Advanced Octave A81 — Geography of the waves and a 3D surface
- Advanced Octave A82 — Age, sex and demographic inequalities
- Advanced Octave A83 — All-cause mortality, certified COVID deaths and surveillance
- Advanced Octave A84 — A reproducible public account
- Advanced Octave A73 — Optimization landscapes and 3D trajectories