model.csv
Inspect CSV columns and configure their import.
2 functions / 5 types
Index
| Function | Description |
|---|---|
| inspect | Inspects a CSV file and proposes a column configuration. |
| inspectString | Inspects CSV text and proposes a column configuration. |
| Type | Description |
|---|---|
| AttributeType | The roles an attribute can have, one arm per role, so measurement semantics exist only on the role that is read under them. |
| HeaderConfig | How one CSV column becomes a model attribute. |
| HeaderConfigMap | How each CSV column becomes a model attribute, keyed by column name. |
| RealMeasurementKind | How a numeric attribute relates to the size of the thing it describes. |
| UnitConversion | Converts an imported column’s values to the units the model uses. |
inspect
inspect(args: { path: string }, transactionId?: string): Promise<ModelCsvHeaderConfigMap>Inspects a CSV file and proposes a column configuration.
Returns: How each CSV column becomes a model attribute, keyed by column name.
Returns Promise<ModelCsvHeaderConfigMap>.
path : string
Path to the CSV
transactionId optional : string
inspectString
inspectString(args: { csv: string }, transactionId?: string): Promise<ModelCsvHeaderConfigMap>Inspects CSV text and proposes a column configuration.
Returns: How each CSV column becomes a model attribute, keyed by column name.
Returns Promise<ModelCsvHeaderConfigMap>.
csv : string
CSV content. Only the header row plus the first few data rows are inspected.
transactionId optional : string
AttributeType
type ModelCsvAttributeType = { kind: "x" } | { kind: "y" } | { kind: "z" } | { kind: "dx" } | { kind: "dy" } | { kind: "dz" } | { kind: "real"; value: ModelCsvRealMeasurementKind } | { kind: "string" } | { kind: "rgb" } | { kind: "int" } | { kind: "normal" } | { kind: "bool" }The roles an attribute can have, one arm per role, so measurement semantics exist only on the role that is read under them.
HeaderConfig
How one CSV column becomes a model attribute.
kind optional : ModelCsvAttributeType
The attribute role this column maps to.
rename optional : string
Override for the attribute’s name. When absent, the source name is kept.
unitConversion optional : ModelCsvUnitConversion
Linear conversion applied to the column’s values. When absent, none is applied.
HeaderConfigMap
How each CSV column becomes a model attribute, keyed by column name.
columns optional : Record<string, ModelCsvHeaderConfig>
One entry per column, keyed by the column’s name in the CSV header row.
RealMeasurementKind
Enum
How a numeric attribute relates to the size of the thing it describes.
Density = 3
The object’s density.
IndependentValue = 0
Value independent of the object’s geometry.
ValueByVolume = 2
Value scaling with the object’s volume.
ValueByWeight = 1
Value scaling with the object’s volume and density.
UnitConversion
Converts an imported column’s values to the units the model uses.
offset : number
Constant added after scaling.
scale : number
Multiplier applied to each source value.