{
  "id": "p3LpReporting001",
  "name": "P3 LP reporting inputs",
  "nodes": [
    {
      "id": "514f3c9e-2dd4-42a6-8dce-ed38dc5bc742",
      "name": "Human: input",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -110,
        -170
      ],
      "parameters": {
        "content": "## Human: input\nA person uploads the documents in the form.",
        "width": 320,
        "height": 330,
        "color": 6
      }
    },
    {
      "id": "c9c10bb8-cd32-45f0-8bff-e8424e609b1a",
      "name": "Human: result",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        4050,
        -170
      ],
      "parameters": {
        "content": "## Human: result\nThe same person sees the results table in the browser.",
        "width": 320,
        "height": 330,
        "color": 6
      }
    },
    {
      "id": "9766aba1-9bd1-4617-8f3d-6977cdada81a",
      "position": [
        0,
        0
      ],
      "name": "Upload",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.5,
      "parameters": {
        "formTitle": "LP reporting inputs",
        "formDescription": "Upload the quarterly KPI submissions of portfolio companies (PDF or Excel). They are normalised to USD, flagged, and drafted into the portfolio section of the quarterly report.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "KPI submissions",
              "fieldName": "files",
              "fieldType": "file",
              "multipleFiles": true,
              "acceptFileTypes": ".pdf, .xlsx",
              "requiredField": true
            }
          ]
        },
        "options": {
          "path": "lp-reporting",
          "appendAttribution": false
        }
      },
      "webhookId": "d91ac08e-ea2a-4a1a-841c-996c758e0c20"
    },
    {
      "id": "d3f5c48e-e7ff-4819-849b-747c6b5fea0c",
      "position": [
        260,
        0
      ],
      "name": "Read document",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "blkReadDocument1",
          "cachedResultName": "read document (OCR)",
          "cachedResultUrl": "/workflow/blkReadDocument1"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "notes": "PDF and Excel: the OCR service reads both"
    },
    {
      "id": "a961f73c-d741-40e0-84b9-463e4954318a",
      "position": [
        520,
        0
      ],
      "name": "Fields to extract",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "32f6ec93-9f0c-4503-8902-94a8b37c08f6",
              "name": "schema",
              "value": "kpi",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "261fa86e-d6f3-4ec0-82b6-ed06f7132161",
      "position": [
        780,
        0
      ],
      "name": "Extract KPIs",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "blkExtractFields",
          "cachedResultName": "extract fields (LLM)",
          "cachedResultUrl": "/workflow/blkExtractFields"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "notes": "LLM reads the KPIs; amounts in thousands are multiplied out"
    },
    {
      "id": "335a2741-a335-4892-8f0f-1d6a4052170a",
      "position": [
        1040,
        0
      ],
      "name": "FX rate",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "parameters": {
        "resource": "row",
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "fx_rates",
          "cachedResultName": "fx_rates"
        },
        "matchType": "allConditions",
        "filters": {
          "conditions": [
            {
              "keyName": "currency",
              "condition": "eq",
              "keyValue": "={{ $json.record.currency }}"
            }
          ]
        },
        "limit": 1
      },
      "alwaysOutputData": true,
      "notes": "Rate to USD from the fx_rates table (EUR 1.08)"
    },
    {
      "id": "f8f08846-235c-473d-8d40-724013cb1ecc",
      "position": [
        1300,
        0
      ],
      "name": "In USD",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "da47a465-927e-4ad3-82ad-e6f97c12085b",
              "name": "fileName",
              "value": "={{ $('Extract KPIs').item.json.fileName }}",
              "type": "string"
            },
            {
              "id": "ec54c3fb-f246-4080-8535-06c97285cd42",
              "name": "company",
              "value": "={{ $('Extract KPIs').item.json.record.company }}",
              "type": "string"
            },
            {
              "id": "37e16ef5-3438-4007-8cda-956770c27c93",
              "name": "period",
              "value": "={{ $('Extract KPIs').item.json.record.period }}",
              "type": "string"
            },
            {
              "id": "5b686fa6-f952-423b-8849-97310dbd5da2",
              "name": "currency",
              "value": "USD",
              "type": "string"
            },
            {
              "id": "1bb689b7-84ea-455a-8e51-fbe4bb8870d5",
              "name": "revenue",
              "value": "={{ ($('Extract KPIs').item.json.record.revenue * $json.usd_rate).round() }}",
              "type": "number"
            },
            {
              "id": "f37856cb-14bf-4eb6-86a3-eeaa63cd4af8",
              "name": "ebitda",
              "value": "={{ ($('Extract KPIs').item.json.record.ebitda * $json.usd_rate).round() }}",
              "type": "number"
            },
            {
              "id": "45a5996d-0a2c-4c5f-8a2e-49a78951dc87",
              "name": "cash",
              "value": "={{ ($('Extract KPIs').item.json.record.cash * $json.usd_rate).round() }}",
              "type": "number"
            },
            {
              "id": "bc1a9e18-2386-4394-8071-1a77b19d55bf",
              "name": "monthlyBurn",
              "value": "={{ ($('Extract KPIs').item.json.record.monthlyBurn * $json.usd_rate).round() }}",
              "type": "number"
            },
            {
              "id": "708799a1-072c-4fbd-84f5-c7905064eb1e",
              "name": "headcount",
              "value": "={{ $('Extract KPIs').item.json.record.headcount }}",
              "type": "number"
            },
            {
              "id": "5ce68831-0bc9-46c1-85b6-53e6e1790c76",
              "name": "commentary",
              "value": "={{ $('Extract KPIs').item.json.record.commentary }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      }
    },
    {
      "id": "a72a9fff-89cc-4269-8bf8-2b47d860a2fb",
      "position": [
        1560,
        0
      ],
      "name": "Runway",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "36ec08f8-6b03-4cbf-87b4-0c3a566ae737",
              "name": "runwayMonths",
              "value": "={{ $json.monthlyBurn > 0 ? ($json.cash / $json.monthlyBurn).round(1) : null }}",
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "notes": "Months of cash at the current burn; empty when the company does not burn cash"
    },
    {
      "id": "ae2c278d-54d9-48b1-828b-7b8b7bfd08ec",
      "position": [
        1820,
        0
      ],
      "name": "Question: commentary",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "10e6a0e7-4b73-44e7-801d-6e9f998bd123",
              "name": "state",
              "value": "={{ $json.company }}, quarter ended {{ $json.period }}.\n\n{{ $json.commentary }}",
              "type": "string"
            },
            {
              "id": "c0e621bb-0961-4624-8d4b-70fee6014487",
              "name": "questions",
              "value": "{\n  \"materialEvent\": {\n    \"type\": \"noul\",\n    \"instructions\": \"Does the commentary mention a material adverse event, such as a covenant breach, a key person leaving, a major customer lost, a recall or a need for new funding?\",\n    \"criteria\": {\n      \"true\": \"a material adverse event is mentioned\",\n      \"false\": \"no material adverse event is mentioned\"\n    }\n  },\n  \"outlook\": {\n    \"type\": \"choice\",\n    \"instructions\": \"How does the company describe its outlook?\",\n    \"criteria\": {\n      \"positive\": \"growing, on plan or better, no problems mentioned\",\n      \"neutral\": \"mixed: some things better, some worse\",\n      \"negative\": \"below plan, losses, covenant problems or new funding needed\"\n    }\n  }\n}",
              "type": "object"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "af877bbf-e9cb-48a2-860b-e99b480474c2",
      "position": [
        2080,
        0
      ],
      "name": "Ask Jev",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "blkDecideJev0001",
          "cachedResultName": "decide (Jev)",
          "cachedResultUrl": "/workflow/blkDecideJev0001"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "mode": "each",
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "notes": "Material event? Outlook?"
    },
    {
      "id": "8d03e581-7cb3-441e-8390-994ab883b8d5",
      "position": [
        2340,
        0
      ],
      "name": "Status",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "parameters": {
        "mode": "rules",
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "56d0ab01-a171-4a91-859a-e73adaa0332a",
                    "leftValue": "={{ $json.answers.materialEvent.value }}",
                    "rightValue": "",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "material event"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "9a29e9ec-a6cb-42c3-8056-2249e01f230a",
                    "leftValue": "={{ $json.runwayMonths }}",
                    "rightValue": "",
                    "operator": {
                      "type": "number",
                      "operation": "exists",
                      "singleValue": true
                    }
                  },
                  {
                    "id": "d28ab5a5-5950-458f-870d-a1f20466a716",
                    "leftValue": "={{ $json.runwayMonths }}",
                    "rightValue": 6,
                    "operator": {
                      "type": "number",
                      "operation": "lt"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "runway under 6"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "8592cc2f-5d54-4939-8c01-261bf53fef0e",
                    "leftValue": "={{ $json.answers.outlook.value }}",
                    "rightValue": "negative",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "negative outlook"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "8638925b-bf0f-4b67-8713-277bc6de8509",
                    "leftValue": "={{ $json.runwayMonths }}",
                    "rightValue": "",
                    "operator": {
                      "type": "number",
                      "operation": "exists",
                      "singleValue": true
                    }
                  },
                  {
                    "id": "46c92b1c-1b6e-4570-8206-c92b9eadb805",
                    "leftValue": "={{ $json.runwayMonths }}",
                    "rightValue": 12,
                    "operator": {
                      "type": "number",
                      "operation": "lt"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "runway under 12"
            }
          ]
        },
        "looseTypeValidation": true,
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "ok"
        }
      },
      "notes": "First match wins: change the month limits here"
    },
    {
      "id": "4bf2c92c-b904-4b5b-8257-1ce8582873c7",
      "position": [
        2860,
        0
      ],
      "name": "All companies back together",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "parameters": {
        "mode": "append",
        "numberInputs": 5
      },
      "notes": "Waits for every status branch"
    },
    {
      "id": "3c194892-f2fe-4178-8d89-a8d371b43191",
      "position": [
        3120,
        0
      ],
      "name": "Save KPIs",
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "parameters": {
        "resource": "row",
        "operation": "insert",
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "kpi_records",
          "cachedResultName": "kpi_records"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "company": "={{ $json.company }}",
            "period": "={{ $json.period }}",
            "currency": "={{ $json.currency }}",
            "revenue": "={{ $json.revenue }}",
            "ebitda": "={{ $json.ebitda }}",
            "cash": "={{ $json.cash }}",
            "monthlyBurn": "={{ $json.monthlyBurn }}",
            "headcount": "={{ $json.headcount }}",
            "runwayMonths": "={{ $json.runwayMonths }}",
            "materialEvent": "={{ $json.answers.materialEvent.value }}",
            "outlook": "={{ $json.answers.outlook.value }}",
            "status": "={{ $json.status }}",
            "reason": "={{ $json.reason }}",
            "fileName": "={{ $json.fileName }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "company",
              "displayName": "company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "period",
              "displayName": "period",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "currency",
              "displayName": "currency",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "revenue",
              "displayName": "revenue",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "ebitda",
              "displayName": "ebitda",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "cash",
              "displayName": "cash",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "monthlyBurn",
              "displayName": "monthlyBurn",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "headcount",
              "displayName": "headcount",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "runwayMonths",
              "displayName": "runwayMonths",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "materialEvent",
              "displayName": "materialEvent",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "boolean",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "outlook",
              "displayName": "outlook",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "reason",
              "displayName": "reason",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "fileName",
              "displayName": "fileName",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      }
    },
    {
      "id": "70cd3d07-02d2-45a6-86e3-9f364d83069d",
      "position": [
        3380,
        0
      ],
      "name": "Result row",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "205e38aa-4ad9-4813-8f68-a74167f88708",
              "name": "Company",
              "value": "={{ $json.company }}",
              "type": "string"
            },
            {
              "id": "4cf434d3-f7ea-48e1-8c65-d89a25bc0a5e",
              "name": "Period",
              "value": "={{ $json.period }}",
              "type": "string"
            },
            {
              "id": "90e9a7a3-cdca-434b-85a6-d56aa4c50bbd",
              "name": "Revenue",
              "value": "=USD {{ ($json.revenue / 1000000).toFixed(2) }}m",
              "type": "string"
            },
            {
              "id": "19b3e6a2-ac4c-441f-8165-ae80d9fb81a6",
              "name": "EBITDA",
              "value": "=USD {{ ($json.ebitda / 1000000).toFixed(2) }}m",
              "type": "string"
            },
            {
              "id": "c7aea1c6-cf07-432d-8eee-7e3d44fa84a8",
              "name": "Cash",
              "value": "=USD {{ ($json.cash / 1000000).toFixed(2) }}m",
              "type": "string"
            },
            {
              "id": "c78478cd-1bab-47da-82f4-5283154f5612",
              "name": "Runway",
              "value": "={{ $json.runwayMonths ? $json.runwayMonths + ' months' : 'not burning cash' }}",
              "type": "string"
            },
            {
              "id": "391fab0f-d484-4476-8b0a-0890097f4880",
              "name": "Outlook",
              "value": "={{ $json.outlook }}",
              "type": "string"
            },
            {
              "id": "6cc699f3-5916-46e9-8900-06540ebf0599",
              "name": "Status",
              "value": "={{ $json.status }}",
              "type": "string"
            },
            {
              "id": "3ed0d674-cc69-424e-8f25-a8c5145fabbe",
              "name": "Reason",
              "value": "={{ $json.reason }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "notes": "One row of the results table"
    },
    {
      "id": "11adde00-950f-4107-8489-09c4ff9d7df5",
      "position": [
        3640,
        0
      ],
      "name": "Results table",
      "type": "n8n-nodes-base.html",
      "typeVersion": 1.2,
      "parameters": {
        "operation": "convertToHtmlTable",
        "options": {
          "customStyling": true,
          "tableAttributes": "style=\"border-collapse:collapse;font-size:14px;margin:0 auto\"",
          "headerAttributes": "style=\"background:#f2f2f2;border:1px solid #ccc;padding:6px 8px;text-align:left;vertical-align:top\"",
          "cellAttributes": "style=\"border:1px solid #ccc;padding:6px 8px;text-align:left;vertical-align:top\""
        }
      }
    },
    {
      "id": "7c0e8445-cf47-41f5-8403-fea894f44290",
      "position": [
        3900,
        0
      ],
      "name": "Table and draft",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "notes": "Waits for the draft, then one item with table and text"
    },
    {
      "id": "c142c31f-1c6f-465a-85d4-36017bbbae21",
      "position": [
        4160,
        0
      ],
      "name": "Show result",
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.5,
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "=<div style=\"font-family:system-ui,sans-serif\"><h2 style=\"text-align:center\">LP reporting inputs: result</h2>{{ $json.table }}<h3 style=\"text-align:center\">Draft: portfolio section of the quarterly report</h3><div style=\"max-width:720px;margin:16px auto;white-space:pre-wrap;text-align:left\">{{ $json.text }}</div></div>"
      },
      "webhookId": "05405540-d413-4010-89a2-9825afd2a954"
    },
    {
      "id": "01037099-cf51-4e65-88b5-df2ba1c719a0",
      "position": [
        3120,
        300
      ],
      "name": "All companies",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "parameters": {
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "company"
            },
            {
              "fieldToAggregate": "revenue"
            },
            {
              "fieldToAggregate": "ebitda"
            },
            {
              "fieldToAggregate": "cash"
            },
            {
              "fieldToAggregate": "runwayMonths"
            },
            {
              "fieldToAggregate": "reason"
            },
            {
              "fieldToAggregate": "commentary"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "a7b6f487-e1ab-453d-8f48-5b5ce32eaefb",
      "position": [
        3380,
        300
      ],
      "name": "Draft portfolio section (LLM)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "parameters": {
        "promptType": "define",
        "text": "=You write the portfolio section of the quarterly report of Team Rocket Opportunities Fund I LP to its investors. One short paragraph per company, factual and neutral, amounts in USD millions. Mention covenant breaches, management changes and funding needs plainly. End with one sentence on the portfolio overall. No headings, no bullet points.\n\nThe companies (lists in the same order: company, revenue, EBITDA, cash in USD, runway in months, flag, management commentary):\n{{ $json.toJsonString() }}"
      }
    },
    {
      "id": "51849f83-1e7d-47a1-8a16-8673b23f92f6",
      "position": [
        2600,
        -320
      ],
      "name": "Escalate: material event",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b5915fea-db70-4126-8b61-2360221e273c",
              "name": "status",
              "value": "escalate",
              "type": "string"
            },
            {
              "id": "f9ea4f34-e11e-4b31-879d-5a729bdffe05",
              "name": "reason",
              "value": "material event mentioned in the commentary",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "7edbb023-c709-4d81-8da3-993bde4982ea",
      "position": [
        2600,
        -160
      ],
      "name": "Escalate: runway",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "5b272554-ca5e-44c1-8dec-67cbf05b634e",
              "name": "status",
              "value": "escalate",
              "type": "string"
            },
            {
              "id": "be62a91e-b0e9-4989-84f9-63c68c6fca65",
              "name": "reason",
              "value": "runway under 6 months",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "17541d0f-a18e-4370-86f6-d1ed1c1c7855",
      "position": [
        2600,
        0
      ],
      "name": "Review: outlook",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "0cc9a2ad-c0a6-4d36-8f95-b3aec26bdce9",
              "name": "status",
              "value": "review",
              "type": "string"
            },
            {
              "id": "57e7a5bd-4f5f-40c1-8e37-c51acd7358b7",
              "name": "reason",
              "value": "negative outlook",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "77efd9f7-e105-4f90-8bf2-ede4026f0caf",
      "position": [
        2600,
        160
      ],
      "name": "Review: runway",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "744e39de-4b64-4440-8226-e13dadc890a6",
              "name": "status",
              "value": "review",
              "type": "string"
            },
            {
              "id": "a244a996-d474-41a8-8ed5-2116b90d3292",
              "name": "reason",
              "value": "runway under 12 months",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "ded4e03b-8443-46ef-8fdc-fa8f5f4122d7",
      "position": [
        2600,
        320
      ],
      "name": "OK",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "da940220-2727-435e-8312-50c220902404",
              "name": "status",
              "value": "ok",
              "type": "string"
            },
            {
              "id": "35f2a77f-835c-44d1-8f05-29ac54b56f91",
              "name": "reason",
              "value": "",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "7f68bd7a-c377-47fd-88c5-cbd2c414fd5b",
      "position": [
        3380,
        520
      ],
      "name": "Chat model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "cred-openai",
          "name": "n8n free OpenAI API credits"
        }
      }
    },
    {
      "id": "682ab34d-0510-4099-8dc3-c3d535fe4ff3",
      "position": [
        0,
        -470
      ],
      "name": "About",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "parameters": {
        "content": "## P3 LP reporting inputs (Jev)\nRead each submission (PDF or Excel), the LLM extracts the KPIs, the fx_rates table converts to USD, Runway divides cash by burn, Jev flags material events and the outlook, the Status node decides, the LLM drafts the portfolio section of the quarterly report. No code.",
        "width": 660,
        "height": 260,
        "color": 7
      }
    }
  ],
  "connections": {
    "Upload": {
      "main": [
        [
          {
            "node": "Read document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read document": {
      "main": [
        [
          {
            "node": "Fields to extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields to extract": {
      "main": [
        [
          {
            "node": "Extract KPIs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract KPIs": {
      "main": [
        [
          {
            "node": "FX rate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FX rate": {
      "main": [
        [
          {
            "node": "In USD",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "In USD": {
      "main": [
        [
          {
            "node": "Runway",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Runway": {
      "main": [
        [
          {
            "node": "Question: commentary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Question: commentary": {
      "main": [
        [
          {
            "node": "Ask Jev",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask Jev": {
      "main": [
        [
          {
            "node": "Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "All companies back together": {
      "main": [
        [
          {
            "node": "Save KPIs",
            "type": "main",
            "index": 0
          },
          {
            "node": "All companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save KPIs": {
      "main": [
        [
          {
            "node": "Result row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Result row": {
      "main": [
        [
          {
            "node": "Results table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Results table": {
      "main": [
        [
          {
            "node": "Table and draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Table and draft": {
      "main": [
        [
          {
            "node": "Show result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "All companies": {
      "main": [
        [
          {
            "node": "Draft portfolio section (LLM)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Status": {
      "main": [
        [
          {
            "node": "Escalate: material event",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Escalate: runway",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Review: outlook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Review: runway",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Escalate: material event": {
      "main": [
        [
          {
            "node": "All companies back together",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Escalate: runway": {
      "main": [
        [
          {
            "node": "All companies back together",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Review: outlook": {
      "main": [
        [
          {
            "node": "All companies back together",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Review: runway": {
      "main": [
        [
          {
            "node": "All companies back together",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "OK": {
      "main": [
        [
          {
            "node": "All companies back together",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "Draft portfolio section (LLM)": {
      "main": [
        [
          {
            "node": "Table and draft",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Chat model": {
      "ai_languageModel": [
        [
          {
            "node": "Draft portfolio section (LLM)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true
  }
}
