Asset Management

Defining the Ground Truth of Your Infrastructure with CSVs


1. Asset Engine: The Foundation of Your Graph

The rescile Asset Engine is the foundation of your digital twin. It builds the initial resource graph from a set of “ground truth” data sources. These sources are simple, human-readable CSV files known as Assets, located in the data/assets/ directory. Each asset file represents a collection of a single type of component in your environment, such as applications, databases, networks, or contracts.

Assets are the artifacts that are taken as given and do not need to be modeled. Ideally, they are provided by an external system of record (like a CMDB, a contract management system, or a cloud provider’s inventory export). This “configuration-as-code” approach allows subject matter experts to easily provide and maintain foundational data without needing to understand complex graph structures.

Core Conventions

The rescile asset engine follows several key conventions to transform flat CSV files into graph resources.

1. File Naming Determines Resource Type

The name of the CSV file (without the extension) determines the type (or label) for all resources created from it.

  • data/assets/application.csv → creates resources of type application.
  • data/assets/database.csv → creates resources of type database.

2. The First Column is the Primary Key

Every CSV file must have a header row. The first column is always treated as the unique primary key for the resources in that file. rescile automatically creates an additional name property for every resource, populated with the value from this first column, to ensure a consistent primary key property across all resource types.

data/assets/application.csv

name,owner,runtime
billing-api,team-alpha,java
frontend-app,team-bravo,nodejs
  • The header of the first column is name.
  • billing-api and frontend-app are the unique primary key values.
  • While the header for this column can be anything (e.g., id, or matching the file name like application), rescile will always create a name property from its value for consistency.

3. Subsequent Columns are Properties

All columns after the first one become the properties of the resource. The column header is the property’s key, and the cell value is its value.

The billing-api resource will have the properties:

  • name: “billing-api” (from the primary key column)
  • owner: “team-alpha”
  • runtime: “java”

4. Automatic Type Conversion

All values are initially read as strings, but the importer automatically converts them to appropriate types based on their content:

  • "true" / "false" (case-insensitive) → Booleans (true/false)
  • "123" → Integers (123)
  • "123.45" → Floats (123.45)
  • "item1, item2" → Array of strings (["item1", "item2"])

To prevent automatic conversion and enforce that a column’s values are always treated as strings, prefix the column header in your CSV file with a tilde (~). This is useful for values that might otherwise be misinterpreted, such as version numbers that look like floats (e.g., "2.0") or names that contain commas.

Example: Enforcing String Type

Consider a CSV for legal entities where a name might contain a comma:

data/assets/party.csv

name,~legal_name
cloudflare,"Cloudflare, Inc."
  • Without the ~ prefix on legal_name, the value "Cloudflare, Inc." would be incorrectly parsed as an array: ["Cloudflare", " Inc."]
  • With the ~legal_name header, the importer correctly treats the entire value as a single string property: legal_name: "Cloudflare, Inc."

Creating Relationships

The asset engine can automatically create relationships between resources using two powerful, convention-based methods.

Method 1: Foreign Keys

If a column header in one CSV file matches the filename of another (e.g., a database column in application.csv), the importer automatically creates a relationship.

  1. Define database.csv:
name,type,version
billing-db,PostgreSQL,14
  1. Add a database column to application.csv:

    name,owner,database
    billing-api,team-alpha,billing-db
    
  • Result: A relationship is created from the billing-api application to the billing-db database. The relationship’s type is taken from the column name, database. (application:billing-api) -[database]-> (database:billing-db)

Method 2: Multiple Relationships from a Single Column

If a foreign key column contains a comma-separated list of values, rescile will create a separate relationship for each value.

data/assets/application.csv

name,owner,dependencies
billing-api,team-alpha,"auth-service,logging-service"
  • Result: If auth-service and logging-service exist as primary keys in a dependencies.csv file, the billing-api application will have two outgoing relationships of type dependencies.

Advanced Features

Ignoring Columns for Relationship Creation

If a column name matches another resource type but you do not want a relationship to be created, prefix the column header with an underscore (_). The column will be imported as a regular property, and no relationship will be created.

name,_database
billing-api,"This is just a comment about a database"

Renaming Relationship Types

The default relationship type is the column name. You can override this using a [[retype_relation]] rule in a Model file.

data/models/application.toml

origin_resource = "application"

[[retype_relation]]
property_key = "database" # The column name in the CSV
new_type = "CONNECTS_TO"   # The new relationship type
  • Result: The relationship will now be (application) -[CONNECTS_TO]-> (database).

This foundational graph is then ready to be transformed and enriched by the architectural Models and governed by Compliance Rules.