Welcome to your Python + n8n Starter Guide! This guide is designed for tech-savvy doctors who want to build AI-driven solutions for their medical practice using Python, Pinecone.io, and n8n.
By the end of this guide, you’ll have the tools and templates to:
You’ll need a few libraries to get started:
pip install pinecone-client sentence-transformers
import pinecone
# Initialize Pinecone with your API key
pinecone.init(api_key="YOUR_API_KEY", environment="us-west1-gcp")
# Create an index for clinical notes
index = pinecone.Index("medical-notes")
Use SentenceTransformers to convert text into vector embeddings.
from sentence_transformers import SentenceTransformer
# Load a pre-trained transformer model
model = SentenceTransformer('all-MiniLM-L6-v2')
# Sample clinical note
note = "Patient presents with fever, sore throat, and fatigue."
# Generate an embedding for the note
embedding = model.encode(note)
print(embedding)
# Index the embedding with a unique identifier
index.upsert([("patient_123", embedding)])
# Confirm the embedding is indexed
print(index.describe_index_stats())