instructSite

byDarren Hopwood

import os from fastapi import FastAPI, File, UploadFile, HTTPException from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from supabase import create_client, Client app = FastAPI(title="instructBrain™ AI Engine", version="1.0.0") # Enable Cross-Origin Resource Sharing (CORS) so your Lovable frontend can talk to it safely app.add_middleware( CORSMiddleware, allow_origins=["*"], # In production, restrict this to your Lovable deployment URL allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Initialize Supabase Client Connection SUPABASE_URL = os.getenv("SUPABASE_URL") SUPABASE_KEY = os.getenv("SUPABASE_SERVICE_ROLE_KEY") # Use service role key to bypass RLS limits during testing if not SUPABASE_URL or not SUPABASE_KEY: raise RuntimeError("Missing Supabase configuration environment variables.") supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY) class AnalysisRequest(BaseModel): project_id: str drawing_name: str @app.get("/") def read_root(): return {"status": "online", "engine": "instructBrain v1.0.0"} @app.post("/api/v1/analyze-blueprint") async def analyze_blueprint(project_id: str, drawing_name: str, file: UploadFile = File(...)): """ Accepts an architectural drawing PDF, runs text/vector extraction, matches rules from Supabase, and inserts found scope gaps. """ try: # Read raw binary data from uploaded file pdf_bytes = await file.read() # TODO: Insert Phase 2 extraction logic here (PyMuPDF parser) return { "success": True, "message": f"Successfully initialized parsing for {drawing_name}", "bytes_received": len(pdf_bytes) } except Exception as e: raise HTTPException(status_code=500, detail=str(e))

LandingLoginDashboardAnalysisSignupSettingsResultsHomeUploadsRulesUploadScopeGaps
Landing

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 5

instructSite System Requirements Document

1. Introduction

This document outlines the system requirements for the project named "instructSite," which is designed to analyze architectural drawings using AI and Supabase as a backend. The document will detail the system's functionality, user personas, visual themes, and technical specifications.

2. System Overview

The instructSite project aims to provide a robust platform for analyzing architectural drawings. It leverages AI capabilities to extract text from PDF drawings, cross-match it with predefined rules, and identify potential scope gaps. The system uses FastAPI for the backend, PyMuPDF for PDF parsing, and Supabase for data storage and rule management.

3. Functional Requirements

  • As a User, I should be able to upload architectural drawing PDFs for analysis.
  • As a System, I should extract all text callouts from the uploaded PDF using PyMuPDF.
  • As a System, I should query the Supabase "interface_risk_rules" table to retrieve keyword arrays and templates.
  • As a System, I should cross-match extracted text against keywords and flag conflicts if any rule matches two or more keywords.
  • As a System, I should auto-inject identified discrepancies into the Supabase "scope_gaps" table with an "Open" status and default severity.
Page 2 of 5

4. User Personas

  • Admin: Manages system configurations, oversees analysis processes, and reviews flagged conflicts.
  • User: Uploads architectural drawings for analysis and reviews the results.

5. Visuals Colors and Theme

Color Palette

  • primary: #2A4365 (Deep Blue)
  • primary_light: #3B5998 (Light Blue)
  • secondary: #E53E3E (Crimson)
  • accent: #38A169 (Emerald Green)
  • highlight: #ED8936 (Orange)
  • bg: #F7FAFC (Light Gray)
  • surface: rgba(255, 255, 255, 0.9) (White)
  • text: #1A202C (Dark Gray)
  • text_muted: #718096 (Muted Gray)
  • border: rgba(226, 232, 240, 0.5) (Light Blue Gray)
Page 3 of 5

6. Signature Design Concept

Interactive Blueprint Explorer

The homepage will feature an interactive blueprint explorer, where users can upload their architectural drawings and see a dynamic visualization of the analysis process. Using @react-three/fiber and @react-three/drei, the blueprint will be rendered in 3D, allowing users to zoom, pan, and rotate the drawing. As the analysis progresses, detected conflicts will be highlighted in real-time with pulsating markers. Users can click on these markers to view detailed information about each conflict, including the matched keywords and suggested resolutions. This immersive experience will make the analysis process engaging and intuitive.

7. Interaction Model & Motion Direction

  • Landing Page Interaction Model: Parallax
    • The landing page will utilize a parallax effect to create a sense of depth as users scroll through the content. Layers of atmospheric elements will move at different speeds, enhancing the storytelling aspect of the platform.
  • Internal Pages: Static
    • Internal pages such as dashboards and settings will maintain a static layout for clarity and ease of use.
Page 4 of 5

8. Non-Functional Requirements

  • The system should handle file uploads up to 50MB efficiently.
  • The backend should process and analyze drawings within 5 seconds on average.
  • The system should support concurrent uploads and analyses without performance degradation.

9. Tech Stack

  • Frontend: React for Web
  • Backend: FastAPI
  • Database: Supabase (PostgreSQL)
  • PDF Parsing: PyMuPDF
  • 3D Rendering: @react-three/fiber, @react-three/drei
  • Environment Management: Docker, docker-compose

10. Assumptions and Constraints

  • The system assumes that all uploaded PDFs are valid architectural drawings.
  • The system is constrained by the performance and availability of the Supabase backend.
  • The environment variables for Supabase configuration must be correctly set for the system to function.
Page 5 of 5

11. Glossary

  • AI Engine: The component responsible for analyzing drawings and identifying scope gaps.
  • Supabase: A backend-as-a-service platform providing database and authentication services.
  • PyMuPDF: A Python library for parsing and extracting text from PDF files.
  • CORS: Cross-Origin Resource Sharing, a mechanism to allow restricted resources on a web page to be requested from another domain.

This document provides a comprehensive overview of the instructSite project, detailing its functionality, design, and technical requirements. If you have any further questions or need additional information, feel free to reach out.

Landing design preview
Landing: View Platform
Login: Sign In
Dashboard: View Overview
Dashboard: Review Conflicts
ScopeGaps: View Flagged Items
ScopeGaps: Update Status
Rules: Manage Keywords
Rules: Edit Templates
Settings: Configure System
Settings: Set Severities
Uploads: Monitor Analyses