@micropasts/3d-model-paradata-builder
v0.1.1
Published
Zero-dependency React JSX paradata JSON and CSV generator for 3D cultural heritage viewers
Maintainers
Readme
@micropasts/3d-model-paradata-builder
A React editor for creating, importing, and exporting structured paradata for 3D cultural heritage and photogrammetry workflows. It provides a live JSON preview and downloads JSON or a flattened CSV representation.
[!NOTE] This generator was inspired by the paradata created by Eva Perez Chirinos
on her Chiriandreses Museum demo and the resulting files can be incorporated into the GLB-viewer
The package is intended to be embedded in an existing React application. It does not provide a server, persistence layer, or domain-specific validation. The demo can be used as a standalone product.
Features
- Record object metadata, photogrammetry processing details, complexity and quality ratings, texture-map provenance, assessment, lab notes, capture equipment and tolerances, acquisition chunks, and derived assets.
- Start from an existing record or load a JSON file.
- Preview the cleaned record as JSON, copy it to the clipboard, or download it
as
.paradata.jsonor.paradata.csv. - Receive clean record data and export events through callbacks.
- Choose a light or dark component theme.
Requirements
- React 18 or newer and React DOM 18 or newer (peer dependencies).
- A modern browser for browser-based features such as file import, clipboard access, and downloads.
React is not bundled as a runtime dependency; install it in your application.
Install
npm install @micropasts/3d-model-paradata-builderIf your app does not already depend on React and React DOM, install them too:
npm install react react-domQuick start
Import the component and the package stylesheet in your application entry point:
import { ParadataBuilder } from '@micropasts/3d-model-paradata-builder';
import '@micropasts/3d-model-paradata-builder/styles.css';
const startingRecord = {
recordId: 'BM-2300',
title: 'Bronze object photogrammetry',
objectMetadata: [
{ label: 'Materials', value: 'Bronze' },
{ label: 'Collection', value: 'Example collection' },
],
};
export default function App() {
return (
<ParadataBuilder
initialRecord={startingRecord}
theme="dark"
onChange={(cleanRecord) => {
console.log('Record changed', cleanRecord);
}}
onExportJson={(cleanRecord, jsonString) => {
console.log('JSON exported', cleanRecord, jsonString);
}}
onExportCsv={(cleanRecord, csvString) => {
console.log('CSV exported', cleanRecord, csvString);
}}
/>
);
}initialRecord initializes the editor and reloads it when a non-null value is
provided or changed. onChange receives the cleaned record as the user edits
it. Export callbacks run when the corresponding download action is used; they
receive both the cleaned record and the serialized file contents.
The default export is the ParadataBuilder component. It is also available as
a named export, as are the data helpers described below.
Component API
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| initialRecord | object or null | null | Record data used to populate the editor. Missing sections are filled with editable defaults. |
| theme | 'dark' or 'light' | 'dark' | Selects the component's color theme. |
| onChange | (cleanRecord) => void or null | null | Called with the cleaned record after edits. |
| onExportJson | (cleanRecord, jsonString) => void or null | null | Called when the user downloads JSON. |
| onExportCsv | (cleanRecord, csvString) => void or null | null | Called when the user downloads CSV. |
The component owns its editing state. Supply initialRecord to seed that
state; use onChange to observe edits or persist them in your application.
The component does not expose a controlled value prop.
Record format
Every section is optional in exported records. Blank fields and empty sections are removed when the draft is cleaned for the preview, callbacks, and exports. The editor starts with these sections:
| Property | Shape | Description |
| --- | --- | --- |
| recordId | string | Record or object identifier. |
| title | string | Optional custom record title. |
| objectMetadata | { label, value }[] | Flexible object metadata rows. Both label and value must be non-empty to be exported. |
| processingSummary.fields | { label, value }[] | Processing details such as software or workflow. |
| processingSummary.ratings | { label, value }[] | Complexity, quality, or other ratings. |
| textureMaps | { name, statuses, notes? }[] | Texture-map provenance. The UI offers MEASURED, ESTIMATED, PATCHED, SYNTHETIC, and NOT CREATED. |
| assessment | { label, value }[] | Assessment details such as condition. |
| labNotes | string | Free-text post-processing notes. |
| captureTolerances | { label, value }[] | Capture equipment, settings, and tolerances. |
| acquisitionChunks | { chunk, exposure?, opticsAndFocus?, rotationalSteps?, images? }[] | Capture details grouped by chunk. |
| derivedAssets.software | string | Software used to create derived assets. |
| derivedAssets.assets | asset objects | Derived mesh or other asset details. |
Each derived asset may contain asset, mesh, alignment, tiePoints,
vertices, faces, filename, format, and size. The field-row shape
{ label, value } is also used for processing fields and ratings, assessment,
metadata, and capture tolerances. Labels and string values are trimmed when a
record is cleaned; rows without both a label and a value are omitted. Optional
properties and empty collections are omitted from the resulting record.
Example:
{
"recordId": "BM-2300",
"title": "Bronze object photogrammetry",
"objectMetadata": [
{ "label": "Materials", "value": "Bronze" }
],
"processingSummary": {
"fields": [
{ "label": "Software", "value": "Agisoft Metashape Standard 2.2.2" }
],
"ratings": [
{ "label": "Complexity", "value": "Medium" }
]
},
"textureMaps": [
{
"name": "Albedo",
"statuses": ["MEASURED"],
"notes": "Color corrected"
}
],
"acquisitionChunks": [
{
"chunk": "Turntable",
"exposure": "1/80 s",
"opticsAndFocus": "50 mm, fixed focus",
"rotationalSteps": "10 degrees",
"images": "36"
}
],
"derivedAssets": {
"software": "Agisoft Metashape",
"assets": [
{
"asset": "Textured mesh",
"mesh": "High detail",
"alignment": "Aligned",
"tiePoints": "12000",
"vertices": "250000",
"faces": "500000",
"filename": "BM-2300.obj",
"format": "OBJ",
"size": "45 MB"
}
]
}
}The builder shapes and cleans records but does not validate them against a formal schema. Unknown properties are not included in cleaned records and exports. Application-specific validation and management of any additional properties are the responsibility of the integrating application.
Exports
JSON
The JSON preview and download contain the cleaned record, pretty-printed with
two-space indentation. The filename is based on the record ID, then the title,
or paradata if neither is set; it is normalized to lowercase and unsafe
filename characters are replaced with hyphens. Downloaded files end in
.paradata.json.
The Load JSON action parses a selected JSON file and uses it to populate the editor. A file that cannot be parsed displays an import error. Loading a record fills in default editor rows for missing or empty sections; those defaults are not included in the exported record unless populated.
CSV
CSV is a flattened, one-value-per-row view of the record. It has this header:
section,subsection,key,value,notesThe section identifies the record group; subsection is used for processing
fields/ratings and to distinguish chunks and assets. Texture statuses are
joined with |. Additional chunk and asset properties are summarized in
the value cell. Cells containing commas, quotes, or newlines are quoted and
embedded quotes are doubled. Cells beginning with spreadsheet formula
characters are prefixed with an apostrophe to reduce formula-injection risk.
Rows use CRLF line endings. Downloaded files end in .paradata.csv.
Public exports
import ParadataBuilder, {
ParadataBuilder as NamedParadataBuilder,
TEXTURE_STATUS_OPTIONS,
DEFAULT_RECORD,
normalizeDraft,
buildCleanParadataRecord,
paradataToCsv,
} from '@micropasts/3d-model-paradata-builder';| Export | Description |
| --- | --- |
| ParadataBuilder (default and named) | React editor component. |
| TEXTURE_STATUS_OPTIONS | Status labels available in the texture-map editor. |
| DEFAULT_RECORD | Default draft shape used by the editor. |
| normalizeDraft(initialValue) | Creates a draft with default sections, populated from an initial record. |
| buildCleanParadataRecord(draft) | Trims and removes blank values/sections from a draft. |
| paradataToCsv(record) | Serializes a record to CSV text. |
The package stylesheet is available as the @micropasts/3d-model-paradata-builder/styles.css
subpath. Import it from your application entry point when using the component.
Develop this repository
Requirements: Node.js and npm.
npm install
npm run devThe Vite development server runs the package demo. The demo shows the editor and lets you switch between light and dark themes.
Available scripts:
| Command | Description |
| --- | --- |
| npm run dev | Start the local Vite demo server. |
| npm run build | Build the distributable library into dist/. |
| npm run build:docs | Build the demo site into docs/ for static hosting. |
| npm run preview | Preview a production build locally. |
The library build emits an ES module, a UMD/CommonJS-compatible bundle, and the package stylesheet. React and React DOM are external peer dependencies.
License
MIT. See LICENSE.md.
