# adefrutoscasado/recist-app architecture

> Architecture diagram of the GitHub repository adefrutoscasado/recist-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adefrutoscasado/recist-app
- Repository: https://github.com/adefrutoscasado/recist-app

## Overview

##### Project type & purpose
- Recist-App is a single-page full-stack web application (SPA) for interactive tumor measurement in medical images, following RECIST standards.
- The front end is built with Polymer Web Components and the AMI medical-imaging JS toolkit. The back end is a minimal Node.js/Express server for static file hosting.

##### File-structure analysis
- Top-level:
- app.js & bin/www – Express HTTP server entrypoint
- public/ – all client assets (HTML, Web Components, Polymer/Bower dependencies, AMI examples)
- package.json – Node and build dependencies
- public/ contains:
- ami-app.html – main SPA shell
- bower_components/ – Polymer library & AMI toolkit & auxiliary components
- components/ – custom Polymer elements (ami-loader2.html, ami-viewer2.html, ami-widget2.html)

##### Key README insights
- The app imports DICOM images from remote URLs or local storage, processes them client-side with AMI, and overlays lesion measurements in a Polymer-based UI.
- No database or REST API is mentioned, so all image parsing and analysis runs in the browser.

a. Main components
- Client Browser (SPA)
– Polymer Web Components (custom elements)
– AMI Toolkit (DICOM/NIfTI loader, viewer, renderer, measurement widgets)
- Static File Server
– Node.js + Express (app.js)
- External Data Sources
– Remote DICOM servers (HTTP URLs)
– User’s local filesystem (File API)
b. Relationships & interactions
1. User → Browser SPA UI
2. SPA → Express Server (HTTP GET static assets)
3. User action “Import” → Browser fetches DICOM via HTTP from remote URL or reads local file
4. AMI in browser parses & renders DICOM, provides image stacks to viewer components
5. User marks lesions; measurement data flows from viewer components to SPA logic
6. SPA outputs final RECIST evaluation (JSON/report) or displays on UI
c. Architectural patterns & principles
- Client-heavy architecture (thin server)
- Modular component design (Polymer elements + AMI modules)
- Separation of concerns: data parsing/rendering in AMI, UI/interaction in Polymer
d. Key technologies
- Node.js, Express (static hosting)
- Polymer (Web Components)
- AMI JavaScript Toolkit (dicom/nifti loaders, volume rendering, measurement helpers)
- Bower for front-end package management

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Data Sources
    subgraph "External Data Sources"
        Remote["Remote DICOM Server"]:::external
        LocalFS["Local File System"]:::external
    end

    %% Server Tier
    subgraph "Server Tier"
        Express["Express Static Server"]:::server
    end

    %% Client Tier
    subgraph "Client Tier"
        Browser["Browser (SPA)"]:::client
        subgraph "Front-end Modules"
            Shell["SPA Shell\n(ami-app.html)"]:::client
            subgraph "Polymer Components"
                Loader["ami-loader2.html"]:::client
                Viewer["ami-viewer2.html"]:::client
                Widget["ami-widget2.html"]:::client
            end
            subgraph "AMI Toolkit"
                AMIJS["ami.js"]:::client
                AMIImport["ami-import"]:::client
            end
            subgraph "Polymer Library & Bower"
                PolymerLib["polymer"]:::client
                Bower["bower_components"]:::client
            end
        end
    end

    %% User
    User["User"]:::external

    %% Connections
    User --> Browser
    Browser -->|"HTTP GET assets"| Express
    Express --> Shell
    Express --> Loader
    Express --> Viewer
    Express --> Widget
    Express --> AMIJS
    Express --> AMIImport
    Express --> PolymerLib
    Express --> Bower

    Browser -->|"Fetch DICOM via HTTP"| Remote
    Browser -->|"Read via File API"| LocalFS

    Shell --> Loader
    Shell --> Viewer
    Shell --> Widget
    Shell --> AMIJS
    Shell --> AMIImport

    Loader --> AMIJS
    Viewer --> AMIJS
    Viewer --> AMIImport
    Widget --> AMIImport

    Viewer -->|"renders images"| Widget
    Widget -->|"captures measurements"| Shell
    Shell -->|"outputs RECIST report"| Browser

    %% Click Events
    click Express "https://github.com/adefrutoscasado/recist-app/blob/master/app.js"
    click Express "https://github.com/adefrutoscasado/recist-app/tree/master/bin/www"
    click Shell "https://github.com/adefrutoscasado/recist-app/blob/master/public/ami-app.html"
    click Loader "https://github.com/adefrutoscasado/recist-app/blob/master/public/components/ami-loader2.html"
    click Viewer "https://github.com/adefrutoscasado/recist-app/blob/master/public/components/ami-viewer2.html"
    click Widget "https://github.com/adefrutoscasado/recist-app/blob/master/public/components/ami-widget2.html"
    click AMIJS "https://github.com/adefrutoscasado/recist-app/blob/master/public/bower_components/ami.js"
    click AMIImport "https://github.com/adefrutoscasado/recist-app/tree/master/public/bower_components/ami-import"
    click PolymerLib "https://github.com/adefrutoscasado/recist-app/tree/master/public/bower_components/polymer"
    click Bower "https://github.com/adefrutoscasado/recist-app/tree/master/public/bower_components"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef server fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#FFA500,stroke:#333,stroke-width:1px
```
