File size: 684 Bytes
5e4e457
 
9d2bec8
5e4e457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex
from llama_index.core import Settings

def create_symptom_index():
    """Create and return symptom index from ICD-10 data."""
    print("build_symptom_index: Loading documents from data directory...")
    documents = SimpleDirectoryReader(
        input_dir="data",
        filename_as_id=True
    ).load_data()
    
    print(f"build_symptom_index: Creating vector index from {len(documents)} documents...")
    symptom_index = VectorStoreIndex.from_documents(
        documents,
        show_progress=True
    )
    
    print("build_symptom_index: Symptom index created successfully")

    return symptom_index