Skip to main content

TraceCite with Julia

The optional Julia route into TraceCite’s canonical table model

Julia is optional

Julia is optional. TraceCite’s Python normaliser and CLI do not require Julia. Rendering this executable page requires Julia 1.10 or newer, DataFrames.jl, Tables.jl, and Quarto’s Julia engine.

This page uses the same table contract as the Python introduction: HTML MIME and native Pandoc output are two evidence routes into TraceCite’s canonical model.

Show source code
using DataFrames
using TraceCite


dirty_table = DataFrame(
    technology = [
        "Solar PV",
        "Battery | BESS",
        "Gas *peaker*",
        "Hydrogen <draft>",
        "Demand response",
    ],
    capital_cost_per_kw = Union{Missing, Float64}[1250.0, 890.5, 760.0, missing, 140.0],
    variable_cost_per_mwh = [0.0, 12.4, 185.0, 240.0, -15.0],
    status = ["firm", "provisional", "review", "missing", "credit"],
    notes = [
        "Currency: A\$1,250/kW",
        "literal pipe: north | south",
        "emphasis must remain literal",
        "HTML-looking text must be escaped",
        "negative value is intentional",
    ],
)

Evidence route 1: HTML MIME

A bare DataFrame is a normal Julia evidence route. Its retained HTML is preserved, and TraceCite can convert it to canonical Markdown and retrieval records without requiring the native helper. The same HTML adapter handles Literate and Documenter output.

Show source code
dirty_table
5×5 DataFrame
Row technology capital_cost_per_kw variable_cost_per_mwh status notes
String Float64? Float64 String String
1 Solar PV 1250.0 0.0 firm Currency: A$1,250/kW
2 Battery | BESS 890.5 12.4 provisional literal pipe: north | south
3 Gas *peaker* 760.0 185.0 review emphasis must remain literal
4 Hydrogen <draft> missing 240.0 missing HTML-looking text must be escaped
5 Demand response 140.0 -15.0 credit negative value is intentional

Evidence route 2: Native Pandoc tables

knowledge_table() needs a stable table identifier. A caption is optional, so the minimal form emits a bare pipe table without a numbered Quarto caption.

Show source code
println(
    knowledge_table(
        dirty_table;
        table_id = "dirty-dataframe-julia-minimal", # Required: stable TraceCite identity.
    ),
)
technology capital cost per kw variable cost per mwh status notes
Solar PV 1250 0 firm Currency: A$1,250/kW
Battery | BESS 890.5 12.4 provisional literal pipe: north | south
Gas *peaker* 760 185 review emphasis must remain literal
Hydrogen <draft> not available 240 missing HTML-looking text must be escaped
Demand response 140 -15 credit negative value is intentional

The advanced call below controls presentation, retrieval context, stable row identity, and the data-derived finding. TraceCite can also normalise tables produced by other libraries; this helper is a convenient Pandoc Markdown output route.

Show source code
println(
    knowledge_table(
        dirty_table;
        table_id = "tbl-dirty-julia", # Required: stable identity and Quarto target.
        caption = "Technology costs.", # Optional: visible caption enabling Quarto references.
        labels = Dict( # Optional: reader-facing column headings.
            "technology" => "Technology",
            "capital_cost_per_kw" => "Capital cost (\$/kW)",
            "variable_cost_per_mwh" => "Variable cost (\$/MWh)",
            "status" => "Status",
            "notes" => "Notes",
        ),
        formats = Dict( # Optional: deterministic numeric display formats.
            "capital_cost_per_kw" => ".2f",
            "variable_cost_per_mwh" => ".2f",
        ),
        units = Dict( # Optional: units retained in retrieval metadata and findings.
            "capital_cost_per_kw" => "\$/kW",
            "variable_cost_per_mwh" => "\$/MWh",
        ),
        row_identity = ["technology"], # Optional: logical identity for stable row IDs.
        summary = [ # Optional: first field is the subject of the generated finding.
            "technology", "capital_cost_per_kw", "status"
        ],
    ),
)
Table 1: Technology costs.
Technology Capital cost ($/kW) Variable cost ($/MWh) Status Notes
Solar PV 1250.00 0.00 firm Currency: A$1,250/kW
Battery | BESS 890.50 12.40 provisional literal pipe: north | south
Gas *peaker* 760.00 185.00 review emphasis must remain literal
Hydrogen <draft> not available 240.00 missing HTML-looking text must be escaped
Demand response 140.00 -15.00 credit negative value is intentional

First-row finding. For Solar PV, capital cost ($/kW) is 1250.00 $/kW and status is firm.

computed_first_row_summary() returns the finding on its own, for prose outside a table. With a single field, the finding states that field’s value.

Show source code
println(computed_first_row_summary(dirty_table; columns = ["status"]))

First-row finding. Status is firm.

What the canonical model provides

For either input route, TraceCite derives:

  • raw source evidence;
  • canonical Markdown;
  • normalised retrieval text;
  • table-level and row-level records; and
  • diagnostics, identifiers, and source hashes.

These are retrieval representations, not embedding vectors.