Inspiration

Heredicheck was inspired by the need for early detection of hereditary diseases using AI and structured patient data. By leveraging Graph Neural Networks (GNNs) and FHIR-compliant synthetic data, we aim to provide a predictive healthcare solution that can identify genetic risks before symptoms appear.

What it does

Heredicheck-AI predicts hereditary disease risks by analyzing family relationships and medical history. The system: ✔ Generates synthetic patient data using FHIR standards
✔ Constructs a knowledge graph linking family members
✔ Trains a GNN model to predict disease probabilities
✔ Deploys a FastAPI service for real-time inference

How we built it

1. Generating FHIR-Compliant Synthetic Patient Data

We used Synthea to create synthetic patient records with structured medical histories.

git clone https://github.com/synthetichealth/synthea.git
cd synthea
./run_synthea -p 1000  # Generates 1000 synthetic patients

Synthea lacked explicit family relationships, so we implemented a post-processing pipeline that:
✔ Extracts RelatedPerson resources from the FHIR JSON output
✔ Maps each RelatedPerson to a Patient ID, ensuring correct parent-child linking
✔ Assigns hereditary diseases based on family history probabilities
✔ Generates an edge list representing family connections for graph modeling

Data Processing Steps:

I. Load Synthea-Generated FHIR JSON

   import json

   with open("synthea_output/fhir/Patient.json") as f:
     patients = json.load(f)

   with open("synthea_output/fhir/RelatedPerson.json") as f:
     relationships = json.load(f)

II. Extract Parent-Child Relationships

   parent_child_map = {}
   for relation in relationships["entry"]:
     resource = relation["resource"]
     if "patient" in resource:
       child_id = resource["patient"]["reference"].split("/")[-1]
       parent_id = resource["id"]
       parent_child_map[child_id] = parent_id

III. Construct Edge List for Graph Neural Network

   edge_list = []
   for child, parent in parent_child_map.items():
     edge_list.append((child, parent))  # Directed edge: child → parent

IV. Convert Edge List to Torch Tensors

   import torch
   edge_index = torch.tensor(edge_list, dtype=torch.long).t().contiguous()

AI Model Training

After constructing the graph, we trained a Graph Neural Network (GNN) for disease risk prediction. The dataset was split into training (80%) and testing (20%) sets.

Model Training Loop:

optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
criterion = torch.nn.BCELoss()  # Binary Cross-Entropy Loss for multi-label classification

for epoch in range(100):
  optimizer.zero_grad()
  output = model(node_features, edge_index)
  loss = criterion(output, labels)
  loss.backward()
  optimizer.step()
  print(f"Epoch {epoch}: Loss = {loss.item()}")

Training Accuracy: 87%

Test F1-Score: 0.78 (multi-label classification)

Challenges We Ran Into

One major challenge was understanding the FHIR API structure, particularly how RelatedPerson and FamilyMemberHistory resources link patients. Synthea-generated data lacked explicit family connections, so we had to develop a post-processing pipeline to reconstruct realistic hereditary relationships.

Another difficulty was training a Graph Neural Network (GNN) on complex, multi-label medical data. Ensuring disease probabilities aligned with real-world epidemiological patterns required iterative tuning and custom loss functions.

Integrating the AI model with MeldRx also introduced hurdles, including FHIR-compliant authentication and data access restrictions. We had to adapt our API to return structured FHIR Observation resources that align with standard healthcare protocols.

Accomplishments That We're Proud Of

Successful FHIR-compliant AI system that predicts hereditary diseases
Graph-based learning approach capturing multi-generation health patterns
Seamless integration with MeldRx, enabling real-time AI-powered risk assessments
Custom post-processing pipeline that enriches synthetic patient data with realistic family structures

What We Learned

Through this project, we deepened our understanding of FHIR APIs, MeldRx workflows, and synthetic healthcare data generation. We also gained experience in graph-based AI modeling, particularly how GNNs can infer hidden hereditary disease risks.

Additionally, we learned how to optimize AI models for structured medical data and ensure compliance with FHIR interoperability standards.

What's Next for Heredicheck

🚀 Expanding to more hereditary diseases beyond the current six conditions
📊 Improving AI explainability to help doctors interpret risk assessments
🔗 Enhancing interoperability with real-world Electronic Health Records (EHRs)
🛠️ Optimizing for real-time performance, making AI predictions faster and more efficient

Built With

Share this project:

Updates