AutomationFlowsAI & RAG › Vectorize Medical Procedures for Semantic Search with Tuss, Gemini & Pgvector

Vectorize Medical Procedures for Semantic Search with Tuss, Gemini & Pgvector

ByThiago Vazzoler Loureiro @thiagovazzoler on n8n.io

This workflow vectorizes the TUSS (Terminologia Unificada da Saúde Suplementar) table by transforming medical procedures into vector embeddings ready for semantic search.

Event trigger★★★★☆ complexityAI-powered11 nodesVector Store PgvectorText Splitter Token SplitterGoogle Gemini EmbeddingsN8N Nodes Oracle Database ParameterizationDocument Default Data Loader
AI & RAG Trigger: Event Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #6543 — we link there as the canonical source.

This workflow follows the Documentdefaultdataloader → Google Gemini Embeddings recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "6nPKaWcXqc2YPy87",
  "name": "VECTORIZE TUSS TABLE",
  "tags": [],
  "nodes": [
    {
      "id": "c3de0ca4-e8e7-4e27-93a3-82cf65c0153f",
      "name": "Postgres PGVector Store2",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
      "onError": "continueRegularOutput",
      "position": [
        1216,
        256
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "tableName": "{your_table_name_here}"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "ed23ae91-a574-4573-a4b6-77d05a927985",
      "name": "Token Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
      "position": [
        1504,
        704
      ],
      "parameters": {
        "chunkSize": 100
      },
      "typeVersion": 1
    },
    {
      "id": "85128969-3eaf-4d79-adce-cf7791c26f7a",
      "name": "Embeddings Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        1056,
        448
      ],
      "parameters": {},
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4fccff60-abd4-423d-971e-fed9f14cce18",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 432,
        "height": 208,
        "content": "## DATABASE AND/OR FILE CONNECTION\n\n### HERE YOU SHOULD PROVIDE THE TUSS TABLE, WITH ONE COLUMN NAMED CD_ITEM AND ANOTHER NAMED DS_ITEM\n"
      },
      "typeVersion": 1
    },
    {
      "id": "104c2ec3-9ad4-4cd0-851f-be002e7b5a13",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        48
      ],
      "parameters": {
        "width": 352,
        "content": "## VECTORIZATION\n\nHERE THE VECTORIZATION WILL BE PERFORMED IN A POSTGRES DATABASE USING PGVECTOR\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ac59dec8-36c6-473d-8622-a6c9e6dddfa9",
      "name": "VECTORIZE TUSS TABLE",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -176,
        240
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c9f12d90-9b9f-42fb-8519-6367b4ce11e2",
      "name": "ORACLE DATABASE CONNECTION",
      "type": "n8n-nodes-oracle-database-parameterization.Oracle Database with Parameterization",
      "position": [
        176,
        240
      ],
      "parameters": {
        "query": "SELECT CD_ITEM, DS_ITEM FROM {sua tabela aqui }"
      },
      "credentials": {
        "oracleCredentials": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ad808bb8-02ef-4075-be77-17512b144cb8",
      "name": "COLLECTION OF MEDICAL PROCEDURES",
      "type": "n8n-nodes-base.code",
      "position": [
        464,
        240
      ],
      "parameters": {
        "jsCode": "return $input.first().json.rows;"
      },
      "typeVersion": 2
    },
    {
      "id": "936a7ab6-7149-4a3e-ad7b-6bc12670df31",
      "name": "FOR - MEDICAL PROCEDURES",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        816,
        32
      ],
      "parameters": {
        "options": {}
      },
      "executeOnce": false,
      "typeVersion": 3,
      "alwaysOutputData": false
    },
    {
      "id": "1c1f20ee-d3e5-4015-b428-bff52abf9361",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        480
      ],
      "parameters": {
        "width": 352,
        "height": 224,
        "content": "## DATA LOADER\n\nResponsible for preparing and formatting the textual data before vectorization, ensuring that each piece of information has the correct structure and metadata\u2014such as the medical procedure code and its description\u2014to generate precise and useful vectors for semantic search.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "07b91604-696c-467e-a9ba-0046f9a76761",
      "name": "Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1328,
        496
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "cd_item",
                "value": "={{ $json.cd_item }}"
              },
              {
                "name": "procedureName",
                "value": "={{ $json.ds_item }}"
              }
            ]
          }
        },
        "jsonData": "=Medical procedure code: {{ $json.cd_item }}\nMedical procedure description: {{ $json.ds_item }}",
        "jsonMode": "expressionData"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d1a6766c-bc43-46c9-9581-ca5c86ca300f",
  "connections": {
    "Data Loader": {
      "ai_document": [
        [
          {
            "node": "Postgres PGVector Store2",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Token Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "VECTORIZE TUSS TABLE": {
      "main": [
        [
          {
            "node": "ORACLE DATABASE CONNECTION",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Postgres PGVector Store2",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "FOR - MEDICAL PROCEDURES": {
      "main": [
        [],
        [
          {
            "node": "Postgres PGVector Store2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres PGVector Store2": {
      "main": [
        [
          {
            "node": "FOR - MEDICAL PROCEDURES",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ORACLE DATABASE CONNECTION": {
      "main": [
        [
          {
            "node": "COLLECTION OF MEDICAL PROCEDURES",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "COLLECTION OF MEDICAL PROCEDURES": {
      "main": [
        [
          {
            "node": "FOR - MEDICAL PROCEDURES",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow vectorizes the TUSS (Terminologia Unificada da Saúde Suplementar) table by transforming medical procedures into vector embeddings ready for semantic search.

Source: https://n8n.io/workflows/6543/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow creates an intelligent document assistant called "Mookie" that can answer questions based on your uploaded documents. Here's how it operates: Document Ingestion: The system can automatic

Document Default Data Loader, Lm Chat Azure Open Ai, Agent +9
AI & RAG

Prod: Notion to Vector Store - Dimension 768. Uses textSplitterTokenSplitter, notionTrigger, notion, summarize. Event-driven trigger; 8 nodes.

Text Splitter Token Splitter, Notion Trigger, Notion +3
AI & RAG

This n8n automation is designed to extract, process, and store content from Notion pages into a Pinecone vector store. Here's a breakdown of the workflow:

Text Splitter Token Splitter, Notion Trigger, Notion +3
AI & RAG

Camila IA. Uses postgres, crypto, redis, agent. Webhook trigger; 92 nodes.

Postgres, Crypto, Redis +13
AI & RAG

Api Schema Extractor. Uses manualTrigger, httpRequest, splitOut, textSplitterRecursiveCharacterTextSplitter. Event-driven trigger; 88 nodes.

HTTP Request, Text Splitter Recursive Character Text Splitter, Document Default Data Loader +9