{
  "name": "File upload",
  "nodes": [
    {
      "parameters": {
        "triggerOn": "folder",
        "path": "mudeli_input",
        "events": [
          "add"
        ],
        "options": {
          "awaitWriteFinish": true,
          "ignoreInitial": true
        }
      },
      "type": "n8n-nodes-base.localFileTrigger",
      "typeVersion": 1,
      "position": [
        -140,
        340
      ],
      "id": "8d716424-f142-4522-9280-a3c869837a78",
      "name": "Local File Trigger"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": "pdf_vectors",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "typeVersion": 1,
      "position": [
        460,
        580
      ],
      "id": "88afb19f-c434-4c45-8b55-8a3a6248bb7c",
      "name": "Postgres PGVector Store",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "batchSize": 32
        }
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsMistralCloud",
      "typeVersion": 1,
      "position": [
        420,
        780
      ],
      "id": "cfae9d05-03df-4bbb-99d1-8e82a99770ae",
      "name": "Embeddings Mistral Cloud2",
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fileSelector": "={{ $json.path }}",
        "options": {
          "fileExtension": "csv",
          "mimeType": "text/csv",
          "dataPropertyName": "data"
        }
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        40,
        340
      ],
      "id": "c88c32bf-e7ec-40dd-a502-2890f3167960",
      "name": "Read/Write Files from Disk1",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        240,
        340
      ],
      "id": "5b2477ca-b1bb-41f0-ba96-511ac5f233cc",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "kegg_annotations",
          "mode": "list",
          "cachedResultName": "kegg_annotations"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id": "={{ $json['Unnamed: 0'] }}",
            "length_bp": "={{ $json.length_bp }}",
            "quantification_keggcharter": "={{ $json['Quantification (KEGGCharter)'] }}",
            "locus_tag": "={{ $json.locus_tag }}",
            "ftype": "={{ $json.ftype }}",
            "gene": "={{ $json.gene }}",
            "ec_number": "={{ $json.EC_number }}",
            "cog": "={{ $json.COG }}",
            "product": "={{ $json.product }}",
            "ko_ec_column": "={{ $json['KO (ec-column)'] }}",
            "ec_ec_column": "={{ $json['EC (ec-column)'] }}",
            "ko_cog_column": "={{ $json['KO (cog-column)'] }}",
            "ko_keggcharter": "={{ $json['KO (KEGGCharter)'] }}",
            "ec_number_keggcharter": "={{ $json['EC number (KEGGCharter)'] }}",
            "Strain number": "={{ $('Local File Trigger').item.json.path.split('/').pop().replace('.csv', '') }}",
            "taxon": "={{ $json.taxonomy }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "locus_tag",
              "displayName": "locus_tag",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ftype",
              "displayName": "ftype",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "length_bp",
              "displayName": "length_bp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "gene",
              "displayName": "gene",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ec_number",
              "displayName": "ec_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "cog",
              "displayName": "cog",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "product",
              "displayName": "product",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "quantification_keggcharter",
              "displayName": "quantification_keggcharter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "taxon",
              "displayName": "taxon",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "ko_ec_column",
              "displayName": "ko_ec_column",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ec_ec_column",
              "displayName": "ec_ec_column",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ko_cog_column",
              "displayName": "ko_cog_column",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ko_keggcharter",
              "displayName": "ko_keggcharter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ec_number_keggcharter",
              "displayName": "ec_number_keggcharter",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Strain number",
              "displayName": "Strain number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        440,
        340
      ],
      "id": "99fd699d-f5af-4910-8070-216dacdc84f6",
      "name": "Postgres regular database",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "triggerOn": "folder",
        "path": "pdfs",
        "events": [
          "add"
        ],
        "options": {
          "awaitWriteFinish": true,
          "ignoreInitial": true
        }
      },
      "type": "n8n-nodes-base.localFileTrigger",
      "typeVersion": 1,
      "position": [
        -140,
        580
      ],
      "id": "39bba65b-d306-4b23-b6a7-a2eda7b71089",
      "name": "Local File Trigger1"
    },
    {
      "parameters": {
        "fileSelector": "={{ $json.path }}",
        "options": {
          "fileExtension": "pdf",
          "mimeType": "application/pdf",
          "dataPropertyName": "pdf_data"
        }
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        40,
        580
      ],
      "id": "3727a050-37ac-454c-849d-d5d5442a653f",
      "name": "Read/Write Files from Disk2",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "chunkSize": 3000,
        "chunkOverlap": 200,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        600,
        940
      ],
      "id": "08d9eca7-4a50-4128-81d6-bc8e864bf55e",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "operation": "pdf",
        "binaryPropertyName": "pdf_data",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        240,
        580
      ],
      "id": "0d96579d-3ecb-4a34-8f19-50d773da1097",
      "name": "Extract from File1"
    },
    {
      "parameters": {
        "jsonMode": "expressionData",
        "jsonData": "={{ $('Extract from File1').item.json.text }}",
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "file-name",
                "value": "={{ $('Read/Write Files from Disk2').item.json.fileName }}"
              }
            ]
          }
        }
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        560,
        780
      ],
      "id": "e3ce3e24-48df-4fa7-9952-207253dd8934",
      "name": "Default Data Loader"
    }
  ],
  "connections": {
    "Local File Trigger": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Mistral Cloud2": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Postgres regular database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Local File Trigger1": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk1": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk2": {
      "main": [
        [
          {
            "node": "Extract from File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File1": {
      "main": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "df48b059-2365-42c8-86a0-7f28a058b937",
  "id": "X74CslmFOweryfUc",
  "tags": []
}