Skip to content

Wellysa CMS

System zarządzania dla medycznych badań diagnostycznych — zarządzanie klientami, lekarzami, wynikami badań, telekonsultacjami i algorytmami analitycznymi.

Wersja: 1.1.0

Główne Funkcjonalności

(unverified — confirm with team)

  • 👥 Zarządzanie Klientami - profile pacjentów, zgody medyczne, identyfikatory zewnętrzne
  • 👨‍⚕️ Panel Lekarzy - zarządzanie lekarzami i uprawnieniami
  • 🧬 Badania Diagnostyczne - import, przetwarzanie i zarządzanie wyników badań genetycznych
  • 📊 Wyniki Badań - wsparcie dla typów: BRCA1, CHEK2, MLPA, NGS, NBN, PALB2, ME-KREW, Onkoparticles
  • 💻 Telekonsultacje - integracja z Calendly (verified: functions/orap/src/calendly/)
  • 🧠 Silnik Algorytmów - analiza wyników i generowanie raportów (verified: functions/orap/src/algorithms/)
  • 📄 Generowanie Raportów PDF - automatyczne tworzenie dokumentów medycznych
  • 🏥 Punkty Poboru - zarządzanie lokalizacjami poboru materiału
  • 📦 Produkty i Zamówienia - system zarządzania produktami
  • 💳 Integracja Płatności - Stripe
  • 📧 Powiadomienia - zarządzanie notyfikacjami email (verified: functions/orap/src/notifications/)
  • 📊 Logi Systemowe - monitorowanie aktywności

Stack Technologiczny

Frontend

  • React 18.3.1 — biblioteka UI
  • TypeScript 5.2.2 — statyczne typowanie
  • Vite 5.2.0 — bundler i dev server
  • React Router 6.22.3 — routing

UI & Styling

  • MUI Joy UI 5.0.0-beta.32 — komponenty UI
  • Emotion 11.11 — CSS-in-JS
  • Lucide React 0.475.0 — ikony

State Management & Forms

  • TanStack Query 5.45.1 — server state management
  • Jotai 2.7.1 — atomic state
  • Formik 2.4.6 + Yup 1.4.0 — formularze i walidacja

Backend & Database

  • Firebase 10.9.0
    • Authentication
    • Firestore Database
    • Cloud Storage
    • Cloud Functions (Node.js functions w functions/orap/)

Integracje Zewnętrzne

  • Stripe 18.1.0 — płatności
  • Calendly API — telekonsultacje
  • Google Maps API (@react-google-maps/api 2.19.3, @vis.gl/react-google-maps 1.3.0)
  • Google reCAPTCHA v3 1.10.1
  • Google Analytics 4 2.1.0

Data Processing & Visualization

  • D3.js 7.9.0 — wizualizacja (genogram)
  • React PDF Renderer 3.4.4 — generowanie PDF
  • PapaParse 5.4.1 — parsowanie CSV
  • XLSX 0.18.5 — Excel
  • relatives-tree 3.2.1 — wizualizacja drzew genealogicznych

Testing

  • Vitest 3.2.4 — test framework
  • React Testing Library 16.3.0
  • MSW 2.11.1 — API mocking
  • Vitest UI + Coverage (v8)

Tooling

  • Volta — Node.js 22.9.0, Yarn 4.5.0
  • ESLint 8.57.0 + TypeScript ESLint 7.2.0
  • Prettier 3.3.3

Rozpoczęcie Pracy

Wymagania

  • Node.js 22.9.0 (zarządzane przez Volta)
  • Yarn 4.5.0 (zarządzane przez Volta)
  • Konto Firebase z konfiguracją projektu

Instalacja

sh
# 1. Sklonuj repozytorium
git clone [email protected]:Wellysa/wellysa-cms.git
cd wellysa-cms

# 2. Zainstaluj zależności
yarn install

# 3. Skonfiguruj zmienne środowiskowe
cp .env.example .env
# Edytuj .env — wymagane klucze:
# - Firebase (ORAP/ORAM): API keys, auth domains, project IDs, storage buckets
# - Google reCAPTCHA site key
# - Stripe API keys
# - Calendly API token
# - Google Maps API key

# 4. Uruchom dev server
yarn dev
# Aplikacja: http://localhost:5173

Dostępne Skrypty

sh
yarn dev              # Dev server z hot-reload
yarn build            # Build produkcyjny (TypeScript + Vite)
yarn preview          # Podgląd production build
yarn lint             # ESLint check
yarn lint:fix         # ESLint auto-fix
yarn test             # Testy (watch mode)
yarn test:ui          # Vitest UI
yarn test:run         # Jednorazowy run testów
yarn test:coverage    # Raport pokrycia

Architektura Projektu

Struktura Folderów

wellysa-cms/
├── functions/
│   ├── orap/                     # Firebase Cloud Functions
│   │   └── src/
│   │       ├── algorithms/       # Silnik algorytmów
│   │       ├── calendly/         # Integracja Calendly
│   │       ├── notifications/    # System powiadomień
│   │       ├── storage/          # Cloud Storage handlers
│   │       ├── teleconsultations/# Telekonsultacje
│   │       └── users/            # User management
│   ├── health.ts
│   └── metrics.ts
├── src/
│   ├── _v2/                      # Nowa architektura (v2)
│   │   ├── components/           # UI components (autocomplete, button, card, chip, dataTable, input, etc.)
│   │   ├── hooks/                # Custom React hooks
│   │   ├── layouts/              # Layout components
│   │   ├── services/             # Serwisy zewnętrzne
│   │   ├── utils/                # Utilities
│   │   └── views/                # Widoki główne
│   ├── features/                 # Feature-based modules (starsza architektura)
│   │   ├── auth/
│   │   ├── clients/
│   │   ├── diagnostics/
│   │   ├── doctors/
│   │   ├── clientAlgorithms/
│   │   ├── collectionPoints/
│   │   ├── firebase/
│   │   └── ...
│   ├── routes/                   # Routing config
│   ├── hooks/                    # Global hooks
│   ├── assets/                   # Static assets
│   └── main.tsx                  # Entry point
├── ___tools/
│   └── synevoResultsTransformer/ # Narzędzie do transformacji wyników Synevo
│       ├── transform-lab-results.js
│       └── quick-transform.sh
├── public/                       # Static files
├── .github/workflows/            # CI/CD (firestore-backup, test)
├── package.json
├── firebase.json
├── firestore.rules
└── vite.config.ts

Kluczowe Koncepcje

Dwuwersyjna Architektura:

  • src/features/ — starsza struktura (v1)
  • src/_v2/ — nowsza architektura z ulepszonymi komponentami

Firebase Cloud Functions:

  • Deployed w functions/orap/
  • TypeScript, moduły: algorithms, calendly, notifications, storage, teleconsultations, users

Path Aliases (unverified — confirm vite.config.ts):

typescript
@/          → src/
@features/  → src/features/
@services/  → src/services/
// (inne aliasy do potwierdzenia w konfiguracji)

Testowanie

Uruchamianie

sh
yarn test             # Watch mode (development)
yarn test:run         # Single run (CI)
yarn test:ui          # Vitest UI
yarn test:coverage    # Coverage report

Rodzaje Testów

  • Unit Tests — walidacja danych, przetwarzanie wyników diagnostycznych
  • Integration Tests — kompletne workflow uploadu i walidacji
  • Component Tests — React Testing Library

CI/CD

GitHub Actions (.github/workflows/test.yml):

  • Trigger: push do main/develop, Pull Requests
  • Test matrix: Node.js 18.x, 20.x, 22.x (unverified — confirm workflow config)

Wspierane Typy Badań Diagnostycznych

(Partially verified z naming conventions w kodzie)

TypOpis
BRCA1Analiza mutacji genu BRCA1
CHEK2Gen supresorowy nowotworów CHEK2
MLPAMultiplex Ligation-dependent Probe Amplification
NGSNext Generation Sequencing (warianty HR, K)
NBNTestowanie genu nibrin
PALB2Partner and Localizer of BRCA2
ME-KREWAnaliza mikroelementów we krwi
OnkoparticlesAnaliza cząstek metalicznych

Role Użytkowników

(Unverified — confirm with team)

  • ADMIN — pełen dostęp
  • DOCTOR — klienci, telekonsultacje, raporty
  • CMS — Content Management System
  • CMP — Client Management Panel
  • RG — ReadGene (laboratoria)
  • SYNEVO — Synevo laboratory

Best Practices

Development

  1. Pisz testyyarn test:run
  2. Sprawdź coverageyarn test:coverage
  3. Linting przed commitemyarn lint:fix
  4. Preferuj src/_v2/components dla nowych feature'ów
  5. TypeScript strict mode — projekt używa ścisłej konfiguracji

Git Workflow

  • Branch główny: main
  • Development: develop
  • Feature branches z develop
  • Pull requesty → develop
  • CI musi być ✅ przed mergem

Commit Conventions

  • feat: nowa funkcjonalność
  • fix: naprawa błędu
  • refactor: refaktoryzacja
  • test: dodanie testów
  • docs: dokumentacja
  • style: formatowanie

Narzędzia Pomocnicze

Synevo Results Transformer

Transformacja wyników z laboratorium Synevo:

sh
cd ___tools/synevoResultsTransformer
./quick-transform.sh        # Quick transform script
node transform-lab-results.js  # Manual transform

Dodatkowe Informacje

  • Monorepo: Frontend (Vite/React) + Backend (Firebase Cloud Functions)
  • Environment: Development / Production (Firebase projects)
  • Monitoring: Firebase Analytics, Google Analytics 4, health/metrics endpoints

Status: Aktywny rozwój
Licencja: Private — Wellysa © 2024–2026
Node.js: 22.9.0 | Yarn: 4.5.0 (Volta)

Wellysa Consigliere — internal use only.