Anvil.Export.CSV (Anvil v0.1.1)
View SourceCSV export adapter with deterministic ordering and lineage tracking.
Implements the ADR-005 export system with:
- Streaming for memory safety
- Deterministic ordering (sample_id ASC, labeler_id ASC, submitted_at ASC)
- Export manifest generation with SHA256 hashes
- Proper CSV escaping
Summary
Functions
Legacy export function for backward compatibility.
Exports labels to CSV format following ADR-005 specification.
Functions
@spec export([Anvil.Label.t()], String.t(), keyword()) :: :ok | {:error, term()}
Legacy export function for backward compatibility.
This function is deprecated in favor of to_format/2.
Exports labels to CSV format following ADR-005 specification.
Options
:schema_version_id- (required) UUID of the schema version for reproducibility:output_path- (required) File path for the CSV export:sample_version- (optional) Forge version tag for full lineage tracking:limit- (optional) Maximum number of rows to export:offset- (optional) Number of rows to skip before exporting:filter- (optional) Additional filter criteria:redaction_mode- (optional) Redaction mode (:none,:automatic,:aggressive) (default::automatic):use_pseudonyms- (optional) Use labeler pseudonyms instead of IDs (default:true)
Returns
{:ok, %{manifest: manifest, output_path: path}}on success{:error, reason}on failure
Examples
iex> Anvil.Export.CSV.to_format(queue_id, %{
...> schema_version_id: schema_v2_id,
...> output_path: "/tmp/labels.csv"
...> })
{:ok, %{manifest: %Manifest{...}, output_path: "/tmp/labels.csv"}}