Skip to content

foundation29org/Dx29_server_gpt

Repository files navigation

DxGPT Server

1. Overview

DxGPT is a diagnostic decision support software based on GPT-4. GPT-4 is an Artificial Intelligence (AI) language model developed by OpenAI. It is designed to generate text from previous input. This means that the software can generate a list of diseases from a description of symptoms. However, due to the characteristics of the model, there is a possibility that the software has errors. Therefore, it should not be used for medical use.

Once the list of diseases is generated, it can be completed with further information to refine the diagnosis. This includes collecting clinical data, performing laboratory tests, and gathering information from the medical record. This will help clinicians make a more informed decision about the diagnosis. It is important that users give us feedback on the use of the software so that we can improve the model. This is important because it helps us to better understand how the software is being used and how we can improve it.

We are currently working on developing new features for the software. We are looking for collaborators who want to investigate the use of these models in diagnostics. If you are interested, please contact us for more information.

2. Current model accuracy

In a recent preliminary evaluation conducted by Foundation 29 using 200 synthetic patient cases generated by language models, DxGPT demonstrated some ability to suggest correct diagnoses of rare diseases. Specifically, when evaluated for strict accuracy (i.e., whether the correct diagnosis appeared in first position), DxGPT obtained an accuracy of 67.5%, getting the diagnosis right in 135 of the 200 cases. If a more flexible metric is considered, counting correct diagnoses in both the first and first 5 positions, the accuracy increases to 88.5% (177 out of 200 cases). While these initial results are encouraging, DxGPT is still at an early stage of development.

For more details on the evaluation methodology and results, please see our GitHub repository and the associated article.



The client code is here: Dx29 client

 

 

Copyright © 2025 Foundation29

DxGPT API Server

Containerization and Deployment

This project is configured to work with Docker and can be deployed on Azure Container Apps with secure secret management using native Container Apps secrets.

Deployment on Azure Container Apps

The project uses Azure Container Apps with Azure Key Vault for secure secret management through RBAC (Role-Based Access Control).

Requirements

  • Docker and Docker Compose installed
  • Node.js 18.x (for local development without Docker)
  • An Azure subscription
  • Azure CLI installed and configured
  • Azure Key Vault with RBAC enabled
  • Admin permissions in Azure to configure RBAC

Environment Variables

The project uses environment variable files for each environment. An env.example file has been created with all the necessary variables. Copy this file to create specific files for each environment:

# For local development
cp env.example env.local

# For development on Azure
cp env.example env.dev

# For production on Azure
cp env.example env.prod

Then edit each file with the corresponding values for each environment.

Secret Management

The system implements multiple layers of security:

  1. RBAC for granular access control
  2. Managed identities for secure authentication
  3. Secure references to secrets via URIs
  4. Secret protection in Key Vault
  5. Environment isolation through separate resources

Local Execution with Docker

To run the project locally using Docker:

# Local development environment
docker-compose build app-local --no-cache    ||   docker-compose build --no-cache

docker-compose up app-local

# Development environment for Azure
docker-compose up app-dev

# Production environment
docker-compose up app-prod

If it fails occasionally, try:

docker-compose down
docker-compose build --no-cache

Image Building

# Build development image
docker build -t dxgpt-api:dev -f Dockerfile.dev .

# Build production image
docker build -t dxgpt-api:prod -f Dockerfile .

OpenAPI Specification

The project includes an OpenAPI specification that defines all the API endpoints. This specification is located in docs/dxgpt-api.yaml.

Direct Swagger/OpenAPI Editing

Instead of using JSDoc annotations, we work directly with the OpenAPI specification file. This gives more control and allows using visual editors:

  1. Edit OpenAPI File Directly: Modify the docs/dxgpt-api.yaml file directly
  2. Use Swagger Editor: Import/export your specification at Swagger Editor

Validation

To validate the OpenAPI specification, run:

npm run validate-openapi

Swagger UI

There are two ways to view the API documentation:

  1. Within the Main Application: Documentation is available at the /docs endpoint when the server is running
  2. Standalone Swagger UI Server: Run a dedicated documentation server:
npm run swagger-ui

This will start a server at http://localhost:3000 dedicated to displaying your API documentation.

This specification is necessary to integrate the API with Azure API Management (APIM) and generate the developer portal.

Cost Tracking System

The cost tracking system allows calculating and storing the cost of AI operations in a simplified way:

Supported Operations

  • diagnose - Main diagnosis
  • info_disease - Disease information
  • follow_up_questions - Follow-up questions
  • er_questions - Emergency questions
  • process_follow_up - Process follow-up answers
  • summarize - Summarize medical descriptions
  • multimodal_detect_type - Medical image type detection
  • multimodal_process_image - Medical image processing

Simplified Approach

  • AI call only: Track only the main AI call
  • No translations: Translations are not tracked as they have no direct cost
  • Save on success: Costs are saved only when the operation succeeds

Supported Models

  • gpt4o - GPT-4 Omni (precio estándar)
  • o3 - Modelo de razonamiento prolongado
  • gpt5 - Multimodal (texto + imágenes)
  • gpt5mini - LLM rápido y económico
  • gpt5nano - LLM de muy bajo coste para detección/traducción ligeras
  • sonar / sonar-pro / sonar-reasoning-pro - Perplexity con búsqueda web y citas

Auxiliary services:

  • translation_service - Azure Translator (detection and translation)
  • document_intelligence - Azure Document Intelligence (Layout)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors