blackmistcode commited on
Commit
a3bacb4
Β·
verified Β·
1 Parent(s): d74800f

Delete CLAUDE.md

Browse files
Files changed (1) hide show
  1. CLAUDE.md +0 -78
CLAUDE.md DELETED
@@ -1,78 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Project Overview
6
-
7
- Morphos is a veterinary diagnostic support tool β€” a single-page application (SPA) that performs real-time clinical pattern detection from lab values and optionally calls an AI model (HuggingFace or local Ollama) for clinical interpretation. It targets Canino and Felino patients.
8
-
9
- ## Running the App
10
-
11
- This is a static frontend with a PHP proxy backend. No build step required.
12
-
13
- Serve it locally with PHP's built-in server from the project root:
14
- ```bash
15
- php -S localhost:8000
16
- ```
17
-
18
- Then open `http://localhost:8000` in a browser. The PHP proxy (`api/hf_proxy.php`) requires the API key in `api/.env`:
19
- ```
20
- HF_API_KEY=<your_key>
21
- ```
22
-
23
- For local AI inference, Ollama must be running at `http://localhost:11434` with `medgemma:latest` pulled.
24
-
25
- ## Architecture
26
-
27
- ### Data Flow
28
-
29
- ```
30
- User form input
31
- β†’ analisis.js (real-time pattern detection, no server)
32
- β†’ UI updates (color-coded fields, pattern cards)
33
-
34
- User clicks "AnΓ‘lisis IA"
35
- β†’ ia.js (constructs prompt with patient data + flagged values)
36
- β†’ [HF route] β†’ api/hf_proxy.php β†’ HF Space Gradio API (SSE response)
37
- β†’ [Local route] β†’ Ollama chat completions API
38
- β†’ Display AI output in #salida-ia
39
- ```
40
-
41
- ### Key Files and Their Roles
42
-
43
- - **`js/analisis.js`** β€” Core engine (505 lines). Compares values against species-specific reference ranges, classifies severity (mild/moderate/severe), applies age/breed/sex adjustments, and identifies 50+ clinical patterns (anemia types, hepatic, renal, endocrine, etc.).
44
- - **`js/ia.js`** β€” AI abstraction layer. Builds the clinical prompt in Spanish, calls either HF Proxy or Ollama, and strips model-specific tokens from the response.
45
- - **`js/main.js`** β€” Orchestration: loads JSON data files, wires form events, triggers analysis, handles PDF export.
46
- - **`js/ui.js`** β€” Tab navigation (8 panels, 4 exam sub-tabs), swipe gestures, mobile/desktop field sync, collapsible panels.
47
- - **`js/pdf-parser.js`** β€” Client-side PDF extraction using PDF.js. 47 regex patterns to identify analytes in Spanish/English. Runs fully in the browser.
48
- - **`api/hf_proxy.php`** β€” PHP proxy that reads `api/.env`, forwards requests to HugginFace Space (`blackmistcode-morphos-medgemma.hf.space/gradio_api`), handles SSE polling, and returns `{text: ...}`.
49
- - **`data/valores_referencia.json`** β€” Reference ranges for 34 analytes per species.
50
- - **`data/alteraciones.json`** β€” 100+ clinical entities used to enrich AI prompts with etiologic context.
51
-
52
- ### AI Backend Configuration
53
-
54
- Stored in `localStorage`:
55
- - `mx-ia-backend`: `"hf"` (default) or `"local"`
56
- - `mx-ia-ollama-url`: custom Ollama endpoint
57
- - `mx-ia-ollama-model`: custom model name (default `medgemma:latest`)
58
-
59
- The HF route supports up to 4 images (vision model). The local route uses Ollama's OpenAI-compatible chat completions API, also with vision support.
60
-
61
- ### Pattern Detection Logic (`analisis.js`)
62
-
63
- Severity thresholds are based on deviation from the reference range. Reference ranges are dynamically adjusted for:
64
- - **Age**: puppies, adults, seniors, geriatric (age in months)
65
- - **Breed**: Greyhounds (lower platelets normal), Akita/Shiba (different RBC ranges), etc.
66
- - **Sex**: Male felines have a higher creatinine tolerance
67
-
68
- The `analizarResultados()` function is called on every `input` event and returns flagged findings + matched clinical patterns.
69
-
70
- ### CSS Notes
71
-
72
- Do not use `!important` β€” use specificity or cascade ordering instead. The stylesheet is `css/styles.css` (1796 lines). The desktop grid breakpoint is `>1100px`.
73
-
74
- ### Coding notes
75
-
76
- All variables should be named in spanish unless they're referencing common technical names like tab, input, output, etc.
77
- Always use descriptive names for variables and functions keeping legibility as a priority.
78
- Don't use aligment spaces.