Module 3 · Data, Variables, Samples, and Measurement Lesson 30 of 120
Data Provenance, Lineage, Ownership, and Licensing
A useful feature needs a traceable origin.
Transcript
23 sentences · select one to jump thereCheck your understanding
Does metadataComplete=true prove the license permits redistribution?
Code lab
Run it yourself
The lesson source in 7 languages. Edit it, run TypeScript and Python right here, and compare with the expected output.
/**
* Fintech Math Bootcamp · Lesson 030 of 120
* Data Provenance, Lineage, Ownership, and Licensing
* Module 03: Data, Variables, Samples, and Measurement
*
* Scenario: A useful feature needs a traceable origin
* Rule: source → transform → feature → decision
*
* Try it: Does metadataComplete=true prove the license permits redistribution?
*
* Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
* Free course: https://courses.thefintechbuilder.com
* Synthetic teaching example, not financial advice or a production library.
*/
export function lesson030() {
const record = {source: "synthetic-payments-v1",
owner: "course", license: "teaching",
transform: "sum-by-customer-v1", inputIds: ["P1","P2"]};
const required = ["source", "owner", "license", "transform"] as const;
const result = required.every(k => record[k].length > 0);
return result;
}
export const checkedResult = true;
// Run this file directly: npx tsx lessons/03-data-variables-samples-and-measurement/030-data-provenance-lineage-ownership-and-licensing.ts
if (process.argv[1] && import.meta.url.endsWith(process.argv[1].replace(/\\/g, "/").split("/").pop()!)) {
console.log(JSON.stringify(lesson030(), null, 2));
}
Your output
Press Run to execute the code in your browser.
Expected output
true"""
Fintech Math Bootcamp · Lesson 030 of 120
Data Provenance, Lineage, Ownership, and Licensing
Module 03: Data, Variables, Samples, and Measurement
Scenario: A useful feature needs a traceable origin
Rule: source → transform → feature → decision
Try it: Does metadataComplete=true prove the license permits redistribution?
Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
Free course: https://courses.thefintechbuilder.com
Synthetic teaching example, not financial advice or a production library.
Run it: python main.py
"""
import json
def lesson030() -> bool:
record = {
"source": "synthetic-payments-v1",
"owner": "course",
"license": "teaching",
"transform": "sum-by-customer-v1",
"input_ids": ["P1", "P2"],
}
required = ("source", "owner", "license", "transform")
result = all(len(record[k]) > 0 for k in required)
return result
if __name__ == "__main__":
print(json.dumps(lesson030(), indent=2))
Your output
Press Run to execute the code in your browser.
Expected output
true/**
* Fintech Math Bootcamp · Lesson 030 of 120
* Data Provenance, Lineage, Ownership, and Licensing
* Module 03: Data, Variables, Samples, and Measurement
*
* Scenario: A useful feature needs a traceable origin
* Rule: source → transform → feature → decision
*
* Try it: Does metadataComplete=true prove the license permits redistribution?
*
* Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
* Free course: https://courses.thefintechbuilder.com
* Synthetic teaching example, not financial advice or a production library.
*
* Run it: javac Main.java && java Main
*/
import java.util.Arrays;
import java.util.List;
public class Main {
static final class ProvenanceRecord {
final String source;
final String owner;
final String license;
final String transform;
final List<String> inputIds;
ProvenanceRecord(String source, String owner, String license, String transform, List<String> inputIds) {
this.source = source;
this.owner = owner;
this.license = license;
this.transform = transform;
this.inputIds = inputIds;
}
// Looks up one of the text metadata fields by name.
String field(String name) {
switch (name) {
case "source": return source;
case "owner": return owner;
case "license": return license;
case "transform": return transform;
default: throw new IllegalArgumentException("Unknown field " + name);
}
}
}
static boolean lesson030() {
ProvenanceRecord record = new ProvenanceRecord("synthetic-payments-v1",
"course", "teaching",
"sum-by-customer-v1", Arrays.asList("P1", "P2"));
List<String> required = Arrays.asList("source", "owner", "license", "transform");
boolean result = required.stream().allMatch(k -> record.field(k).length() > 0);
return result;
}
public static void main(String[] args) {
System.out.println(lesson030());
}
}
No browser runner for Java yet
Read the code here, then run it in your own toolchain or a ready-made cloud workspace.
Expected output
true// Fintech Math Bootcamp · Lesson 030 of 120
// Data Provenance, Lineage, Ownership, and Licensing
// Module 03: Data, Variables, Samples, and Measurement
//
// Scenario: A useful feature needs a traceable origin
// Rule: source → transform → feature → decision
//
// Try it: Does metadataComplete=true prove the license permits redistribution?
//
// Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
// Free course: https://courses.thefintechbuilder.com
// Synthetic teaching example, not financial advice or a production library.
//
// Run it: go run main.go
package main
import (
"encoding/json"
"fmt"
)
type ProvenanceRecord struct {
Source string
Owner string
License string
Transform string
InputIDs []string
}
// field looks up one of the text metadata fields by name.
func (r ProvenanceRecord) field(name string) string {
switch name {
case "source":
return r.Source
case "owner":
return r.Owner
case "license":
return r.License
case "transform":
return r.Transform
}
return ""
}
func lesson030() bool {
record := ProvenanceRecord{
Source: "synthetic-payments-v1", Owner: "course", License: "teaching",
Transform: "sum-by-customer-v1", InputIDs: []string{"P1", "P2"},
}
required := []string{"source", "owner", "license", "transform"}
result := true
for _, k := range required {
if len(record.field(k)) == 0 {
result = false
break
}
}
return result
}
func main() {
printJSON(lesson030())
}
// printJSON prints a value as JSON indented with two spaces, like JSON.stringify(value, null, 2).
func printJSON(value any) {
out, err := json.MarshalIndent(value, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(out))
}
No browser runner for Go yet
Read the code here, then run it in your own toolchain or a ready-made cloud workspace.
Expected output
true/**
* Fintech Math Bootcamp · Lesson 030 of 120
* Data Provenance, Lineage, Ownership, and Licensing
* Module 03: Data, Variables, Samples, and Measurement
*
* Scenario: A useful feature needs a traceable origin
* Rule: source → transform → feature → decision
*
* Try it: Does metadataComplete=true prove the license permits redistribution?
*
* Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
* Free course: https://courses.thefintechbuilder.com
* Synthetic teaching example, not financial advice or a production library.
*
* Run it: g++ -std=c++17 -o main main.cpp && ./main
*/
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
struct ProvenanceRecord {
std::string source;
std::string owner;
std::string license;
std::string transform;
std::vector<std::string> inputIds;
// Looks up one of the text metadata fields by name.
const std::string& field(const std::string& name) const {
if (name == "source") return source;
if (name == "owner") return owner;
if (name == "license") return license;
if (name == "transform") return transform;
throw std::invalid_argument("Unknown field " + name);
}
};
bool lesson030() {
const ProvenanceRecord record{"synthetic-payments-v1",
"course", "teaching",
"sum-by-customer-v1", {"P1", "P2"}};
const std::vector<std::string> required{"source", "owner", "license", "transform"};
const bool result = std::all_of(required.begin(), required.end(),
[&record](const std::string& k) { return record.field(k).length() > 0; });
return result;
}
int main() {
std::cout << (lesson030() ? "true" : "false") << "\n";
}
No browser runner for C++ yet
Read the code here, then run it in your own toolchain or a ready-made cloud workspace.
Expected output
true//! Fintech Math Bootcamp · Lesson 030 of 120
//! Data Provenance, Lineage, Ownership, and Licensing
//! Module 03: Data, Variables, Samples, and Measurement
//!
//! Scenario: A useful feature needs a traceable origin
//! Rule: source → transform → feature → decision
//!
//! Try it: Does metadataComplete=true prove the license permits redistribution?
//!
//! Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
//! Free course: https://courses.thefintechbuilder.com
//! Synthetic teaching example, not financial advice or a production library.
//!
//! Run it: rustc main.rs && ./main
#[allow(dead_code)] // input_ids is part of the lineage but not a required text field
struct ProvenanceRecord {
source: &'static str,
owner: &'static str,
license: &'static str,
transform: &'static str,
input_ids: Vec<&'static str>,
}
impl ProvenanceRecord {
/// Looks up one of the text metadata fields by name.
fn field(&self, name: &str) -> &str {
match name {
"source" => self.source,
"owner" => self.owner,
"license" => self.license,
"transform" => self.transform,
_ => panic!("Unknown field {}", name),
}
}
}
fn lesson030() -> bool {
let record = ProvenanceRecord {
source: "synthetic-payments-v1",
owner: "course",
license: "teaching",
transform: "sum-by-customer-v1",
input_ids: vec!["P1", "P2"],
};
let required = ["source", "owner", "license", "transform"];
let result = required.iter().all(|k| record.field(k).len() > 0);
result
}
fn main() {
println!("{}", lesson030());
}
No browser runner for Rust yet
Read the code here, then run it in your own toolchain or a ready-made cloud workspace.
Expected output
true/**
* Fintech Math Bootcamp · Lesson 030 of 120
* Data Provenance, Lineage, Ownership, and Licensing
* Module 03: Data, Variables, Samples, and Measurement
*
* Scenario: A useful feature needs a traceable origin
* Rule: source → transform → feature → decision
*
* Try it: Does metadataComplete=true prove the license permits redistribution?
*
* Lesson article: https://thefintechbuilder.com/financial-mathematics-statistics-and-data-foundations/data-variables-samples-and-measurement/data-provenance-lineage-ownership-and-licensing/
* Free course: https://courses.thefintechbuilder.com
* Synthetic teaching example, not financial advice or a production library.
*
* Run it: dotnet run (inside a console project that holds this Program.cs)
*/
using System.Text.Json;
Console.WriteLine(JsonSerializer.Serialize(Lesson030()));
static bool Lesson030()
{
var record = new ProvenanceRecord(Source: "synthetic-payments-v1",
Owner: "course", License: "teaching",
Transform: "sum-by-customer-v1", InputIds: new[] { "P1", "P2" });
string[] required = { "source", "owner", "license", "transform" };
var result = required.All(k => record.Field(k).Length > 0);
return result;
}
record ProvenanceRecord(string Source, string Owner, string License, string Transform, string[] InputIds)
{
// Looks up one of the text metadata fields by name.
public string Field(string name) => name switch
{
"source" => Source,
"owner" => Owner,
"license" => License,
"transform" => Transform,
_ => throw new ArgumentException($"Unknown field {name}"),
};
}
No browser runner for C# yet
Read the code here, then run it in your own toolchain or a ready-made cloud workspace.
Expected output
truePrefer your own machine? Every file is in the course repository · open it in Codespaces.
Lesson notes
The rule
source → transform → feature → decision