Séries de promptes Pages App Synergie infirmier
Oui — c’est possible, mais PAS en un seul bloc
(car un prompt Agent3 trop long ne sera ni optimal, ni exploitable, ni interprétable).
👉 Solution optimale : découper en 6 prompts structurés, chacun totalement autonome, chacun générant un module complet de l’application.
👉 Puis fournir un MASTER PROMPT que vous collez en premier, et 5 prompts modules que vous collez ensuite pour générer l’architecture et les écrans.
🟦 PLAN IDEAL — 6 PROMPTS POUR AGENT3
(Vous aurez tout le code généré de façon stable, modulaire, maintenable.)
1️⃣ MASTER PROMPT — Architecture complète + fichiers + routing + conventions + UI Kit
→ Configure toute l'app, définit les dossiers, la structure, la navigation, le style, les API Odoo/n8n, le cache offline.
2️⃣ MODULE VISITES — E01 → E09
→ Onboarding, authentification, fiche patient, consentement, enregistrement, traitement IA, validation, historique, détail visite.
3️⃣ MODULE ALERTES — E15 → E18
→ Console d’alertes, coordination de tournée, synthèse médecin, vue multi-patients.
4️⃣ MODULE PARAMÈTRES — E11 → E14 + E16
→ Profil, dictaphone BLE, paramètres IA, mode offline, support.
5️⃣ MODULE SHOP — S01 → S06
→ Catalogue, panier, adresse senior, livraison, commande Odoo e-Shop, logistique tournée.
6️⃣ MODULE PERMISSIONS & ROLES
→ Rôle infirmier / médecin / coordinateur / admin
→ Conditionnal rendering + secure routes.
LE PROMPT #1 — MASTER PROMPT AGENT3
👉 Vous collez ce prompt dans Agent3 AVANT les autres.
Il va préparer automatiquement :
- la structure du code
- la navigation
- les dépendances
- l’architecture offline-first
- la communication Odoo/n8n/Supabase
Voici une version optimisée et prête à coller dans Replit Agent3, en anglais, en gardant toutes tes contraintes et en les rendant ultra explicites pour une app React Native + Expo (et pas web).
Je te donne uniquement le Master Prompt V2, propre, structuré :
------------------------------------------------------------- 🟦 MASTER PROMPT AGENT3 — SYNERGIA SENIOR MOBILE APP (V2) ------------------------------------------------------------- You are Replit Agent3, an expert in building **production-ready React Native mobile apps** with **Expo** and **TypeScript**, using: - Clean, modular folder structure - Offline-first patterns - Professional, clinic-grade UI (clear, readable, touch-friendly) - Safe error handling and type-safety 🎯 GOAL Generate the **full architecture + base code scaffold** for the **Synergia Senior App**, a mobile app used by: - Nurses - Doctors - Coordinators - Admins The app must include: - 18 functional screens (E01 → E18) - 6 shop screens (S01 → S06) - Offline mode (queue + sync) - Alerts & risk scoring - BLE dictaphone connector (for audio notes) - Integration with: - Odoo Online (JSON-RPC) - n8n workflows (webhooks) - Supabase (for logs + vector DB, optional auth) - Role-Based Access Control (RBAC) Your output must be a **complete Expo + TypeScript app skeleton** with all files, imports and navigation wired, that can be refined later. ------------------------------------------------------------- 🟦 1. TECHNOLOGY STACK (MANDATORY) ------------------------------------------------------------- Use **only** this stack: - React Native + Expo - TypeScript - React Navigation (stack + bottom tabs) - Zustand → global state management - React Query → server state, caching, offline queue - SQLite → local offline storage (visits, alerts, pending_sync) - Supabase JS client → logs + vector DB calls (placeholder) - JSON-RPC (HTTP) → Odoo Online backend - BLE-PLX (react-native-ble-plx) → dictaphone pairing - Expo SecureStore → securely store tokens / refresh tokens - Expo FileSystem → local storage of audio files Assume: - Environment variables via `app.config` or `.env` (no secrets hard-coded). - Base URLs as `process.env.EXPO_PUBLIC_*` style constants. ------------------------------------------------------------- 🟦 2. FOLDER STRUCTURE (CREATE ALL FILES) ------------------------------------------------------------- Generate this **exact** folder structure and create all files with minimal but valid code: /app App.tsx /screens E01_Onboarding.tsx E02_Dashboard.tsx E03_PatientCard.tsx E04_VisitList.tsx E05_VisitDetail.tsx E06_NewVisit.tsx E07_VisitSummary.tsx E08_PatientList.tsx E09_PatientTimeline.tsx E10_Messages.tsx E11_Settings.tsx E12_Profile.tsx E13_DeviceManager.tsx E14_Reports.tsx E15_AlertsScoring.tsx E16_OfflineSync.tsx E17_DoctorBoard.tsx E18_Coordination.tsx S01_ShopHome.tsx S02_ShopCategory.tsx S03_ShopProductDetail.tsx S04_ShopCart.tsx S05_ShopCheckout.tsx S06_ShopOrdersHistory.tsx /components SecureScreen.tsx PatientCard.tsx AlertBadge.tsx OfflineBanner.tsx ShopItemCard.tsx /hooks useAuth.ts useNetworkStatus.ts useOfflineQueue.ts /services /odoo client.ts visits.ts alerts.ts shop.ts /n8n audio_upload.ts alert_webhook.ts /supabase client.ts /store user.ts visits.ts alerts.ts shop.ts ble.ts /utils rbac.ts constants.ts types.ts jsonrpc.ts sqlite.ts logger.ts /navigation AppNavigator.tsx AuthNavigator.tsx MainTabs.tsx RootNavigationContainer.tsx Each file must contain **compilable** TypeScript / TSX code, even if with placeholders. ------------------------------------------------------------- 🟦 3. NAVIGATION (DEFINE CLEARLY) ------------------------------------------------------------- Use **React Navigation** with: 1. **AuthNavigator** (stack) - Initial route: `E01_Onboarding` 2. **MainTabs** (bottom tabs) Tabs: - "Tournée" → main screen: `E02_Dashboard` - "Patients" → main screen: `E08_PatientList` (and allow navigation to E03_PatientCard) - "Alertes" → main screen: `E15_AlertsScoring` - "Shop" → main screen: `S01_ShopHome` - "Paramètres" → main screen: `E11_Settings` 3. **AppNavigator** - Wraps Auth + MainTabs logic depending on auth state. - Handles redirect to: - AuthNavigator if not authenticated - MainTabs if authenticated 4. **Stack screens** for editing flows, for example: - From Dashboard (E02) → E04_VisitList → E05_VisitDetail → E06_NewVisit → E07_VisitSummary - From Patients tab → E08_PatientList → E03_PatientCard → E09_PatientTimeline - From "Alertes" tab → E15_AlertsScoring → E03_PatientCard / E09_PatientTimeline - From "Shop" tab → S01_ShopHome → S02_ShopCategory → S03_ShopProductDetail → S04_ShopCart → S05_ShopCheckout → S06_ShopOrdersHistory - Settings (E11) can navigate to E12_Profile, E13_DeviceManager, E16_OfflineSync, E14_Reports. All screens must be **registered** in navigation. ------------------------------------------------------------- 🟦 4. ROLE-BASED ACCESS CONTROL (RBAC) ------------------------------------------------------------- Define roles in `/utils/types.ts`: - `ROLE_NURSE` - `ROLE_DOCTOR` - `ROLE_COORDINATOR` - `ROLE_ADMIN` Implement RBAC rules: - Nurse → can access: E01–E09, E11–E16, S01–S06, alerts (E15), offline sync (E16) - Doctor → can access: E02, E03, E08, E09, E15, E17, E11–E12 - Coordinator → can access: E02, E08, E09, E15, E18, E11–E12 - Admin → full access to all screens (E01–E18, S01–S06) In `/utils/rbac.ts`, implement: - A mapping from `screenId` (e.g. "E15", "S01") to allowed roles. - Function: ```ts export type UserRole = 'ROLE_NURSE' | 'ROLE_DOCTOR' | 'ROLE_COORDINATOR' | 'ROLE_ADMIN'; export function hasAccess(role: UserRole, screenId: string): boolean { // implement with a static config map }
Create /components/SecureScreen.tsx:
- Props: screenId: string, children: React.ReactNode
- Uses useAuth() to get current user role
- Calls hasAccess(role, screenId)
- If access denied → render a simple "Access denied" view.
Usage example (must be used in all screens):
export default function E15_AlertsScoring() { return ( <SecureScreen screenId="E15"> {/* screen content */} </SecureScreen> ); }
🟦 5. OFFLINE MODE (MANDATORY BEHAVIOR)
Implement an offline-first strategy with:
-
useNetworkStatus hook
- Uses Expo NetInfo or equivalent
- Exposes: { isOnline: boolean }
-
SQLite integration (/utils/sqlite.ts)
-
Create a local DB with tables:
- pending_sync (for queued operations)
- visits (basic fields: id, patientId, date, payload JSON)
- alerts (id, patientId, severity, payload JSON)
-
Create a local DB with tables:
-
useOfflineQueue hook
-
Exposes:
- queueRequest(operation: PendingOperation)
- flushQueue() (called when network comes back)
- Uses React Query + SQLite to persist queued operations.
-
Exposes:
-
E16_OfflineSync screen
-
Shows:
- Number of pending operations
- Last sync date
- Button "Force Sync now" → calls flushQueue
- Basic status messages.
-
Shows:
-
Behavior:
-
When isOnline === false, any API call (Odoo/n8n/Supabase) must:
- Be queued in pending_sync instead of failing.
-
When network is restored:
- flushQueue() is automatically triggered.
- Show an <OfflineBanner /> component at the top of screens when offline.
-
When isOnline === false, any API call (Odoo/n8n/Supabase) must:
🟦 6. ODOO JSON-RPC INTEGRATION
In /services/odoo/client.ts:
- Implement a generic jsonRpcCall:
export async function jsonRpcCall<T>( model: string, method: string, args: any[] = [], kwargs: Record<string, any> = {} ): Promise<T> { // POST to `${ODOO_BASE_URL}/jsonrpc` // read URL & credentials from env }
- Use the standard Odoo JSON-RPC body:
{ "jsonrpc": "2.0", "method": "call", "params": { "model": "...", "method": "...", "args": [], "kwargs": {} }, "id": 1 }
Create service modules:
-
/services/odoo/visits.ts
-
Functions:
- fetchVisitsByNurse(nurseId: number)
- createVisit(payload: any)
- updateVisit(id: number, payload: any)
-
Functions:
-
/services/odoo/alerts.ts
-
Functions:
- fetchAlerts(params?: any)
- acknowledgeAlert(id: number)
-
Functions:
-
/services/odoo/shop.ts
-
Functions:
- fetchShopCategories()
- fetchProductsByCategory(categoryId: number)
- createOrder(payload: any)
-
Functions:
Use React Query hooks in /store/visits.ts, /store/alerts.ts, /store/shop.ts to wrap these services, respecting offline queueing logic.
🟦 7. N8N WEBHOOK INTEGRATION
Create in /services/n8n:
-
audio_upload.ts
- Function: uploadAudioNote(fileUri: string, metadata: any)
-
Sends POST multipart/form-data or JSON (placeholder) to:
- ${N8N_BASE_URL}/webhook/audio_upload
-
Intended for:
- Audio notes recorded from BLE dictaphone or device microphone.
- If offline → queue this operation using useOfflineQueue.
-
alert_webhook.ts
- Function: notifyAlertEvent(payload: any)
-
Sends POST to:
- ${N8N_BASE_URL}/webhook/alert_event
-
Used when:
- Local app detects a new critical situation and must notify n8n.
No need to implement full business logic, just correct function signatures and placeholder calls.
🟦 8. BLE DICTAPHONE INTEGRATION
In /store/ble.ts:
-
Use react-native-ble-plx (BLE-PLX) to manage:
- scan devices
- connect to a dictaphone device
- read battery level (characteristic)
- placeholder function for "update firmware" (no real logic, just structure)
Expose minimal API:
export interface BleDevice { id: string; name: string | null; isConnected: boolean; } export const useBleStore = create<{ devices: BleDevice[]; scanForDictaphones: () => Promise<void>; connectToDevice: (id: string) => Promise<void>; readBatteryLevel: (id: string) => Promise<number | null>; triggerFirmwareUpdate: (id: string) => Promise<void>; }>();
In E13_DeviceManager.tsx:
- List discovered devices
- Show connection status
- Button: "Scan", "Connect", "Read Battery", "Update Firmware (placeholder)"
- Use SecureScreen with screenId="E13".
🟦 9. DUMMY UI FOR ALL SCREENS
For each screen (E01 → E18, S01 → S06):
- Export a default functional component.
- Wrap content inside <SecureScreen screenId="EXX"> or "SXX" as appropriate.
- Use simple React Native layout with placeholders.
Example for E02:
import { View, Text, Button } from 'react-native'; import SecureScreen from '../components/SecureScreen'; export default function E02_Dashboard() { return ( <SecureScreen screenId="E02"> <View style={{ flex: 1, padding: 16 }}> <Text>Dashboard — Today’s tour</Text> {/* TODO: list of visits, summary of alerts */} </View> </SecureScreen> ); }
Example for S01:
import { View, Text } from 'react-native'; import SecureScreen from '../components/SecureScreen'; export default function S01_ShopHome() { return ( <SecureScreen screenId="S01"> <View style={{ flex: 1, padding: 16 }}> <Text>Synergia Shop — Home</Text> {/* TODO: categories, featured products */} </View> </SecureScreen> ); }
The UI should be minimal but valid and compilable. No external design system, just basic RN components.
🟦 10. AUTH & TOKENS
In /hooks/useAuth.ts:
-
Manage:
- user
- role
- accessToken
- refreshToken
- Store tokens in Expo SecureStore.
-
Expose:
- login(credentials)
- logout()
- setRole(role: UserRole)
You can stub authentication logic (no real backend needed), but keep the structure realistic.
AppNavigator must use useAuth to decide whether to show AuthNavigator or MainTabs.
🟦 11. SUPABASE CLIENT (LOGS / VECTOR DB)
In /services/supabase/client.ts:
- Initialize a Supabase client using env variables.
-
Export:
- logEvent(event: { type: string; payload?: any }) placeholder.
- queryRag(query: string): Promise<any> placeholder.
These will not be fully used yet, but the structure must exist.
🟦 12. IMPLEMENTATION STYLE
- Use TypeScript everywhere (no any unless absolutely necessary).
-
Add minimal types in /utils/types.ts for:
- Patient
- Visit
- Alert
- ShopProduct
- Order
- Use functional components with hooks.
- Handle basic error states (e.g., try/catch with console.warn).
- Do not implement real business logic or styling — just scaffolding, navigation and structure.
🟦 13. AFTER ARCHITECTURE IS GENERATED
After generating ALL files and wiring navigation:
👉 STOP.
Do not proceed to implement detailed business logic, UI polish or advanced flows.
Next steps will be given in separate prompts (by module).
END OF MASTER PROMPT
--- Si tu veux ensuite, on pourra faire les prompts “Module par module” (visites, alertes, shop, etc.) alignés sur ce Master V2.