An advanced AI-powered platform that transforms complex work order and asset information into intelligent, interconnected databases with sophisticated diagnostic capabilities. The system processes industrial data to create meaningful insights and relationships, enabling better asset management and decision-making.
-
Frontend: TypeScript + React + Vite
- MUI (Material-UI) for component library
- D3.js for interactive data visualization
- Axios for API communication
- Vitest for testing
-
Backend: Python + Flask
- Flask-SQLAlchemy for ORM
- Flask-Migrate for database migrations
- OpenAI GPT-4 integration for AI capabilities
- Pytest for testing
-
Databases:
- PostgreSQL for relational data
- Neo4j for graph relationships
├── api/ # Backend Flask application
│ ├── app.py # Main application entry
│ ├── routes.py # API endpoints
│ ├── models.py # Database models
│ ├── chat_handler.py # AI chat functionality
│ └── tests/ # Backend tests
│
└── frontend/ # React frontend application
├── src/
│ ├── components/ # React components
│ ├── services/ # API services
│ └── types/ # TypeScript types
└── public/ # Static assets
- Python 3.11+
- Node.js 20+
- PostgreSQL 16+
- Neo4j Database
# Database Configuration
DATABASE_URL=postgresql://[user]:[password]@[host]:[port]/[dbname]
PGUSER=your_pg_user
PGPASSWORD=your_pg_password
PGDATABASE=your_database
PGHOST=your_host
PGPORT=your_port
# API Keys
OPENAI_API_KEY=your_openai_api_key- Clone the repository:
git clone <repository-url>
cd repository-name- Backend Setup:
# Install Python dependencies
pip install -r requirements.txt
# Initialize database
flask db upgrade
# Start the Flask server
python app.py- Frontend Setup:
# Install Node.js dependencies
cd frontend
npm install
# Start development server
npm run dev
# Build for production
npm run build-
CSV Processing
# Example: Upload work order CSV POST /api/upload Content-Type: multipart/form-data file: work_orders.csv
-
Automated Entity Extraction
# Example output { "entities": [ ["Asset123", "Asset"], ["Facility1", "Facility"] ], "relationships": [ { "source": "Asset123", "target": "Facility1", "type": "LOCATED_IN" } ] }
-
Validation Rules
// Example rule definition interface Rule { condition: string; action: string; priority: number; }
-
Entity Relationship Mapping
interface GraphNode { id: string; label: string; type: string; } interface GraphLink { source: string; target: string; type: string; }
- Natural language querying using GPT-4
- Context-aware responses
- Intelligent data analysis
- Interactive D3.js graph visualization
- Real-time updates
- Zoom and pan capabilities
- Node and relationship filtering
All API endpoints require valid authentication.
POST /api/upload
Content-Type: multipart/form-data
file: CSV file containing work order dataResponse:
{
"status": "success",
"ontology": {
"entities": [...],
"relationships": [...]
}
}POST /api/validate-ontology
Content-Type: application/json
{
"ontology": {
"entities": [...],
"relationships": [...]
}
}POST /api/chat
Content-Type: application/json
{
"query": "Show me all assets in Facility A"
}interface FileUploadProps {
onProcessed: (result: any) => void;
}
const FileUpload: React.FC<FileUploadProps> = ({ onProcessed }) => {
// Component implementation
};interface OntologyValidatorProps {
ontology: {
entities: [string, string][];
relationships: {
source: string;
target: string;
type: string;
}[];
};
onValidated: (graph: any) => void;
}interface GraphViewerProps {
graph: {
nodes: GraphNode[];
edges: GraphLink[];
};
}CREATE TABLE node (
id SERIAL PRIMARY KEY,
label VARCHAR NOT NULL,
type VARCHAR NOT NULL,
properties JSONB
);CREATE TABLE edge (
id SERIAL PRIMARY KEY,
source_id INTEGER REFERENCES node(id),
target_id INTEGER REFERENCES node(id),
type VARCHAR NOT NULL,
properties JSONB
);- Python: PEP 8 compliance
- TypeScript: ESLint + Prettier
- React: Functional components with hooks
# Run tests with coverage
pytest --cov=api
# Run specific test file
pytest api/tests/test_e2e.py# Run all tests
npm run test
# Run with coverage
npm run test:coverage- Feature branches from main
- Pull request review required
- CI/CD checks must pass
- Squash merge to main
- Fork the repository on Replit
- Set required environment variables
- Run the following workflows:
- Frontend Build
- Frontend Dev Server
- API Server
- Enable CORS protection
- Set up rate limiting
- Configure proper logging
- Enable SSL/TLS
- Set up monitoring
Error: could not connect to server: Connection refused
- Check PostgreSQL service status
- Verify DATABASE_URL
- Ensure database exists
Error: OpenAI API key not found
- Set OPENAI_API_KEY environment variable
- Check API key validity
- Verify API quota
Error: Type ... is not assignable to type ...
- Run
tscfor type checking - Update type definitions
- Check component props
- Index heavily queried columns
- Use connection pooling
- Implement query caching
- Use React.memo for heavy components
- Lazy load routes
- Optimize D3.js rendering
- Cache frequent queries
- Implement rate limiting
- Use compression middleware
- Fork the repository
- Create feature branch
- Follow code style guidelines
- Add tests for new features
- Create pull request
- All tests must pass
- Code coverage >80%
- No TypeScript errors
- ESLint/Prettier compliance
For issues and feature requests, please create an issue in the repository.
This project is proprietary and confidential.
- v0.1.0 - Initial release
- Basic ontology extraction
- Graph visualization
- Chat interface
- OpenAI for GPT-4 API
- D3.js community
- Material-UI team