
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
= Process Structured CSV files (structured_csv
)
image:https://badge.fury.io/rb/structured_csv.svg["Gem Version", link="https://badge.fury.io/rb/structured_csv"] image:https://github.com/riboseinc/structured_csv/actions/workflows/main.yml/badge.svg["Tests", link="https://github.com/riboseinc/structured_csv/actions/workflows/main.yml"]
== Purpose
The structured_csv_to_yaml
script converts a "Structured CSV
" file into a YAML file.
When you have data of a yet-undefined data structure, it is useful to manage them inside a CSV file which can be viewed and edited by a CSV editor, such as Excel.
This is extremely useful in developing a normalized structure for such data, as you can ensure that the existing data can be normalized according to a defined structure.
Ultimately, the data is to be meant to exported to a YAML file.
This script supports UTF-8 CSV files.
NOTE: This was originally developed to create over 50 normalized data models for ITU Operational Bulletin data. See https://github.com/ituob/ for more details.
== Installation
Add this line to your application's Gemfile
:
and then run:
Or install it without a Gemfile
:
== Usage
Where,
input-file.csv
:: is the input CSV file, the output will be named as input-file.yaml
.
== Details
A Structured CSV file has these properties:
Two structured sections. A section is defined by the first column on an otherwise empty row that is either the first row or a row preceded by an empty row. Two section types are allowed: METADATA
and DATA
.
The METADATA
section has values organized like key-value pairs:
The key
can be a normal string or namespaced:
foobar
, this maps to the YAML key foobar:
foo.bar.boo
, this maps to the YAML structure: +
A typical YAML output is like:
A sample METADATA section looks like this table:
[cols,"a,a"] |=== |METADATA | |locale.bar.en | beef |locale.bar.fr | boeuf |locale.bar.jp | 牛肉 |===
And generates this YAML:
The DATA
section has values organized in a table form. The first row is the header row.
The first column is assumed to be the key.
A sample DATA section looks like this table:
[cols,"a,a,a,a"] |=== |DATA | | | |foo.bar.en | foo.bar.fr | foo.bar.jp | description |beef | boeuf | 牛肉 | Yummy! |pork | porc | 豚肉 | Delicious! |===
By default, this table generates this YAML format:
In cases where there is no DATA key, you have to specify the type=array
to generate an array:
[cols,"a,a,a,a"] |=== |DATA | type=array | | |foo.bar.en | foo.bar.fr | foo.bar.jp | description |beef | boeuf | 牛肉 | Yummy! |pork | porc | 豚肉 | Delicious! |===
data:
You are also allowed to specify the data types of columns. The types of string
, boolean
and integer
are supported.
[cols,"a,a,a,a"] |=== |DATA | | | |foo.bar.en[string] | foo.bar.fr[string] | yummy[boolean] | availability[integer] |beef | boeuf | TRUE | 3 |pork | porc | FALSE | 10 |===
== Examples
The samples/
folder contains a number of complex examples.
FAQs
Unknown package
We found that structured_csv demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.