spr migrated books, and tester
This commit is contained in:
245
atlas/book/arch-model/index.html
Normal file
245
atlas/book/arch-model/index.html
Normal file
@@ -0,0 +1,245 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AMAR Mascotas - Architecture & Data Models</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>AMAR Mascotas</h1>
|
||||
<p class="subtitle">Architecture & Data Model Documentation</p>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<!-- Graph Sections -->
|
||||
<section class="graph-section" id="data-model-simple">
|
||||
<div class="graph-header-row">
|
||||
<h2>Data Model Overview</h2>
|
||||
<a href="graph.html?g=04-data-model-simple" class="view-btn">View Full</a>
|
||||
</div>
|
||||
<a href="graph.html?g=04-data-model-simple" class="graph-preview">
|
||||
<img src="04-data-model-simple.svg" alt="Data Model Overview">
|
||||
</a>
|
||||
<div class="graph-details">
|
||||
<p>High-level entity relationships without field details. Shows the main actors, workflow, and data flow.</p>
|
||||
<h4>Clusters</h4>
|
||||
<ul>
|
||||
<li><strong>Users & Auth</strong>: Django auth.User as central identity</li>
|
||||
<li><strong>Pet Owners & Pets</strong>: Clients, their pets, vaccines, studies</li>
|
||||
<li><strong>Veterinarians</strong>: Vets with availability, specialties, coverage areas</li>
|
||||
<li><strong>Services & Pricing</strong>: Service catalog with dynamic pricing</li>
|
||||
<li><strong>Cart & Checkout</strong>: Shopping cart workflow</li>
|
||||
<li><strong>Service Requests</strong>: Order lifecycle with state machine</li>
|
||||
<li><strong>Veterinary Visits</strong>: Scheduled visits, reports, AFIP invoicing</li>
|
||||
<li><strong>Reference Data</strong>: Lookups (specialties, neighborhoods, vaccines, etc.)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="graph-section" id="backend">
|
||||
<div class="graph-header-row">
|
||||
<h2>Backend Architecture</h2>
|
||||
<a href="graph.html?g=01-backend-architecture" class="view-btn">View Full</a>
|
||||
</div>
|
||||
<a href="graph.html?g=01-backend-architecture" class="graph-preview">
|
||||
<img src="01-backend-architecture.svg" alt="Backend Architecture">
|
||||
</a>
|
||||
<div class="graph-details">
|
||||
<p>Django apps structure: mascotas, productos, solicitudes, common, payments, and external integrations.</p>
|
||||
|
||||
<h4>Celery Tasks</h4>
|
||||
<table class="details-table">
|
||||
<thead>
|
||||
<tr><th>Task</th><th>App</th><th>Purpose</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>send_veterinarian_followup</code></td>
|
||||
<td>solicitudes</td>
|
||||
<td>Re-sends availability request to vet if still pending</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>run_payment_reminder_cron</code></td>
|
||||
<td>solicitudes</td>
|
||||
<td>Cron job to send payment reminders</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>create_vetvisit_in_sheet</code></td>
|
||||
<td>mascotas</td>
|
||||
<td>Creates row in Google Sheets for visit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>update_vetvisit_in_sheet</code></td>
|
||||
<td>mascotas</td>
|
||||
<td>Updates Google Sheets row</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>create_event_calendar_vetvisit</code></td>
|
||||
<td>mascotas</td>
|
||||
<td>Creates Google Calendar event</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>update_event_calendar_vetvisit</code></td>
|
||||
<td>mascotas</td>
|
||||
<td>Updates Google Calendar event</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>create_user_owner</code></td>
|
||||
<td>mascotas</td>
|
||||
<td>Creates Django user for PetOwner + welcome email</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>generate_vetvisit_invoice</code></td>
|
||||
<td>mascotas</td>
|
||||
<td>Generates AFIP invoice and PDF</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>fetch_mp_notification_details</code></td>
|
||||
<td>payments</td>
|
||||
<td>Fetches MercadoPago webhook details</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="note">Celery handles async operations: external APIs (Google, MercadoPago, AFIP), scheduled reminders, and heavy processing (invoices, emails).</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="graph-section" id="frontend">
|
||||
<div class="graph-header-row">
|
||||
<h2>Frontend Architecture</h2>
|
||||
<a href="graph.html?g=02-frontend-architecture" class="view-btn">View Full</a>
|
||||
</div>
|
||||
<a href="graph.html?g=02-frontend-architecture" class="graph-preview">
|
||||
<img src="02-frontend-architecture.svg" alt="Frontend Architecture">
|
||||
</a>
|
||||
<div class="graph-details">
|
||||
<p>Next.js 13+ App Router structure with public pages, backoffice, shared components, and services layer.</p>
|
||||
<h4>Key Areas</h4>
|
||||
<ul>
|
||||
<li><strong>Public Pages</strong>: Landing, service catalog, booking flow</li>
|
||||
<li><strong>Backoffice</strong>: Role-based dashboards (admin, vet, petowner)</li>
|
||||
<li><strong>Services Layer</strong>: API clients for backend communication</li>
|
||||
<li><strong>State Management</strong>: Redux store for cart, auth, UI state</li>
|
||||
<li><strong>Shared Components</strong>: Forms, tables, modals, navigation</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="graph-section" id="data-model-detailed">
|
||||
<div class="graph-header-row">
|
||||
<h2>Detailed Data Model</h2>
|
||||
<a href="graph.html?g=03-data-model" class="view-btn">View Full</a>
|
||||
</div>
|
||||
<a href="graph.html?g=03-data-model" class="graph-preview">
|
||||
<img src="03-data-model.svg" alt="Detailed Data Model">
|
||||
</a>
|
||||
<div class="graph-details">
|
||||
<p>Complete entity-relationship diagram with all fields, types, and relationships.</p>
|
||||
<h4>Data Patterns</h4>
|
||||
<ul>
|
||||
<li><strong>Soft delete</strong>: <code>deleted</code> flag on most models</li>
|
||||
<li><strong>Audit trail</strong>: <code>StateHistory</code> for service requests</li>
|
||||
<li><strong>Geographic</strong>: PostGIS polygons for coverage areas</li>
|
||||
<li><strong>Versioned pricing</strong>: Date ranges on <code>Prices</code></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Findings Section -->
|
||||
<section class="findings-section">
|
||||
<h2>Key Findings</h2>
|
||||
|
||||
<div class="findings-grid">
|
||||
<article class="finding-card">
|
||||
<h3>User Types</h3>
|
||||
<p>All users connect to <code>auth.User</code>:</p>
|
||||
<ul>
|
||||
<li><strong>PetOwner</strong>: Optional 1:1 link (created lazily)</li>
|
||||
<li><strong>Veterinarian</strong>: Required 1:1 link to User</li>
|
||||
<li><strong>Staff</strong>: Direct Django users with <code>is_staff=True</code></li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<article class="finding-card">
|
||||
<h3>Core Workflow</h3>
|
||||
<div class="workflow-diagram">
|
||||
<code>PetOwner → Cart → ServiceRequest → VeterinarianAsked → VetVisit → Report</code>
|
||||
</div>
|
||||
<p><strong>State Machine:</strong></p>
|
||||
<div class="state-flow">
|
||||
pending → vet_asked → vet_accepted → coordinated → payed → Confirmado
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="finding-card">
|
||||
<h3>Pricing Logic</h3>
|
||||
<ul>
|
||||
<li>Base price × <code>neighborhood.distance_coefficient</code></li>
|
||||
<li>Optional vet-specific pricing via <code>Prices.veterinarian_id</code></li>
|
||||
<li>Turn fee surcharge via <code>IndividualTurnFeeGroup</code></li>
|
||||
<li>Time-based discounts via <code>Discounts</code> model</li>
|
||||
</ul>
|
||||
</article>
|
||||
|
||||
<article class="finding-card">
|
||||
<h3>External Integrations</h3>
|
||||
<ul>
|
||||
<li><strong>MercadoPago</strong>: Payment processing</li>
|
||||
<li><strong>Google Calendar</strong>: Visit synchronization</li>
|
||||
<li><strong>Google Sheets</strong>: Visit tracking spreadsheet</li>
|
||||
<li><strong>Mercately</strong>: WhatsApp notifications</li>
|
||||
<li><strong>AFIP</strong>: Argentine tax invoicing</li>
|
||||
</ul>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Tech Stack Section -->
|
||||
<section class="tech-section">
|
||||
<h2>Technology Stack</h2>
|
||||
<div class="tech-grid">
|
||||
<div class="tech-column">
|
||||
<h3>Backend</h3>
|
||||
<ul>
|
||||
<li>Django 4.x</li>
|
||||
<li>Django REST Framework</li>
|
||||
<li>PostgreSQL + PostGIS</li>
|
||||
<li>Celery (Redis)</li>
|
||||
<li>JWT Authentication</li>
|
||||
<li>django-afip</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tech-column">
|
||||
<h3>Frontend</h3>
|
||||
<ul>
|
||||
<li>Next.js 13+ (App Router)</li>
|
||||
<li>React 18+</li>
|
||||
<li>TypeScript</li>
|
||||
<li>Redux</li>
|
||||
<li>Axios</li>
|
||||
<li>Tailwind CSS</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tech-column">
|
||||
<h3>Infrastructure</h3>
|
||||
<ul>
|
||||
<li>Docker</li>
|
||||
<li>Nginx</li>
|
||||
<li>AWS S3 (storage)</li>
|
||||
<li>MercadoPago API</li>
|
||||
<li>Google APIs</li>
|
||||
<li>WhatsApp Business</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>AMAR Mascotas Architecture Documentation</p>
|
||||
<p class="date">Generated: <time datetime="2024-12-14">December 2024</time></p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user