A modern, responsive web application for managing patient records using FHIR (Fast Healthcare Interoperability Resources) standards.
- SPA Architecture: Built as a Single Page Application using Svelte and TypeScript
- Component Structure:
App.svelte
: Root component with routing configurationPatientList.svelte
: Main dashboard with real-time search and paginationPatientCreate.svelte
: Form component with validationPatientEdit.svelte
: Combined form/view with delete capabilitiesPatientView.svelte
: Read-only patient detailsAbout.svelte
: Architecture documentation with Mermaid diagrams
-
FHIR Integration
- Multiple server support (MEDBLOCKS, HAPI, KODJIN)
- RESTful operations using Axios
- Server-side pagination with
_count
and_offset
- Real-time server switching with state persistence
-
Data Management
- Patient search with server-specific query parameters
- Optimistic updates with refresh delays
- Error handling with retry mechanisms
- Session storage for state persistence
-
Form Handling
- Real-time validation with regex patterns
- Phone number formatting (XXX-XXX-XXXX)
- Name capitalization rules
- Gender normalization (M/F/U to male/female/unknown)
-
UI/UX Features
- Responsive Tailwind CSS design
- Loading states with animations
- Error messaging system
- Confirmation dialogs for destructive actions
- Real-time Kolkata time display
- Dynamic age calculation
-
Patient List
// Fetch flow with retry mechanism const fetchPatients = async (page: number) => { let retryCount = 0; while (retryCount < maxRetries) { try { const params = { _sort: '-_lastUpdated', _count: 15, _offset: page * 15, _total: 'accurate' }; const response = await fhirApi.get('/Patient', { params }); return response.data; } catch (err) { retryCount++; await new Promise(resolve => setTimeout(resolve, 1000 * retryCount)); } } };
-
Server Switching
// Server state management const handleServerChange = async (server: string) => { setFhirServer(server); sessionStorage.setItem('selectedServer', server); await fetchTotalCount(); await initializePatients(); };
- Base URLs:
- MEDBLOCKS:
https://fhir-bootcamp.medblocks.com/fhir
- HAPI:
https://hapi.fhir.org/baseR4
- KODJIN:
https://demo.kodjin.com/fhir/
- MEDBLOCKS:
- Headers:
headers: { 'Cache-Control': 'no-cache', 'Accept': 'application/fhir+json', 'Content-Type': 'application/fhir+json' }
- Server selection persisted in SessionStorage
- Patient creation status tracking
- Form validation states
- Loading states for various operations
- Debounced search
- Pagination with fixed page size
- Optimistic updates
- Error retry mechanism
- Cached server selection
- Network request retries
- Form validation feedback
- Server error messages
- Delete confirmation
- Loading state management
Ajay Prashar
This application provides a comprehensive interface for healthcare providers to manage patient records. Built with Svelte and TypeScript, it offers seamless integration with FHIR servers (Medblocks and HAPI) for robust healthcare data management.
- Patient List View: Display paginated list of patients with search capabilities
- Create Patient: Add new patients with validation for:
- Names (capitalization rules)
- Birth dates
- Gender selection
- Phone numbers (formatted input)
- Edit Patient: Modify existing patient records
- Delete Patient: Remove patient records with confirmation
- Server Selection: Toggle between Medblocks and HAPI servers
- Responsive Design: Modern UI with consistent styling
- Frontend Framework: Svelte
- Language: TypeScript
- Styling: Tailwind CSS
- HTTP Client: Axios
- Routing: Svelte Routing
- API: FHIR R4
-
Clone the repository
-
Install dependencies
-
Start the development server
The application provides three main views:
-
Patient List: Main dashboard showing all patients
- Search by last name
- Filter by birth date
- Pagination controls
- Server selection
-
Create Patient: Form to add new patients
- Required fields marked with *
- Real-time validation
- Phone number formatting
-
Edit Patient: Modify existing patient records
- Pre-populated form
- Delete capability
- Validation rules maintained
The application integrates with three FHIR servers:
- Medblocks:
https://fhir-bootcamp.medblocks.com/fhir
- HAPI:
https://hapi.fhir.org/baseR4
- Kodjin:
https://demo.kodjin.com/fhir/
(Note: Total patient count might be limited)
Not copyrighted 2024. All rights are yours.