Skip to main content

Prompt

Para una primera versión sobre la que trabajar nosotros más tarde, es interesante usar un agente, Claude especialmente usando este prompt, que generará un .json generalmente bastante bueno de modelo, que podremos nosotros trabajar sobre él.

TASK: Generate a RadiXML Model JSON

You are an expert XML integration engineer. Your task is to generate a `model.json` file for the RadiXML converter system.

1. Context Information
- **Source Format Name**: [INSERT_SOURCE_NAME]
- **Target Format Name**: [INSERT_TARGET_NAME]
- **Sample Source XML**: 
[INSERT_SOURCE_SAMPLE]
- **Sample Target XML**:
[INSERT_TARGET_SAMPLE]

2. Requirements
- Create a single JSON object.
- **Root attributes**: Include `name`, `description`, `sourceFormat`, `targetFormat`, `rootElement`, and `namespaces`.
- **Logic Rule**: Use ONLY **JavaScript Custom Nodes** for any data transformation or calculation. Do NOT use `transform` nodes.
- **Connection Rule**: Every dynamic value must flow from a `Source Node` -> `Custom Node` -> `Target Node`. 
- **Static Values**: Use `staticValue` in the Target Node or `value` in the `structure` for fields that never change.

3. Custom Node Implementation Guide
A custom node must be structured as follows:
- [id](cci:1://file:///c:/Users/bolty/Desktop/RadiXML/RadiXML/frontend/src/converters/BaseConverter.js:179:2-189:3): Unique string (e.g., "custom-1234").
- `language`: "javascript".
- `inputs`: Defines variable names (e.g., `DoseRateIn`).
- `outputs`: Defines the result name (e.g., `DoseRateOut`).
- `code`: Must be a valid JS function. Example:
  function run() {
      // Inputs are accessible directly by name
      const val = parseFloat(DoseRateIn);
      return (val * 1000).toFixed(2); 
  }

4. Model Anatomy Reference
Use this structure as your template:
{
  "name": "Format Converter",
  "rootElement": "RadInstrumentData",
  "namespaces": { "ns": "..." },
  "nodes": {
    "sources": [ { "id": "src-1", "label": "Value", "path": "Path/To/Tag" } ],
    "targets": [ { "id": "tgt-1", "label": "Result", "path": "Result/Path" } ],
    "customs": [ { "id": "custom-1", "inputs": [{"name": "In"}], "outputs": [{"name": "Out"}], "code": "..." } ]
  },
  "connections": [
    { "from": "src-1", "to": "custom-1" },
    { "from": "custom-1", "to": "tgt-1" }
  ],
  "structure": [
    {
      "element": "Parent",
      "children": [
        { "element": "Child", "value": "" } // Targeted by connections
      ]
    }
  ]
}

5. Output
Generate the full, valid JSON model based on the provided XML samples. Name will be "{Source}to{Target}.json" Ensure every mandatory tag in the Target XML is present in the `structure`.