major restructure
This commit is contained in:
178
cfg/amar/station/tools/databrowse/depot/views.json
Normal file
178
cfg/amar/station/tools/databrowse/depot/views.json
Normal file
@@ -0,0 +1,178 @@
|
||||
{
|
||||
"views": [
|
||||
{
|
||||
"name": "users_by_role",
|
||||
"title": "Users by Role",
|
||||
"slug": "users-by-role",
|
||||
"description": "All users grouped by role (USER/VET/ADMIN) for quick login selection",
|
||||
"mode": "sql",
|
||||
"entity": "User",
|
||||
"group_by": "role",
|
||||
"order_by": "username ASC",
|
||||
"fields": ["id", "username", "email", "first_name", "last_name", "is_staff", "is_active", "date_joined"],
|
||||
"display_fields": {
|
||||
"id": {"label": "ID", "width": "60px"},
|
||||
"username": {"label": "Username", "width": "150px", "primary": true},
|
||||
"email": {"label": "Email", "width": "200px"},
|
||||
"first_name": {"label": "First Name", "width": "120px"},
|
||||
"last_name": {"label": "Last Name", "width": "120px"},
|
||||
"is_active": {"label": "Active", "width": "80px", "type": "boolean"}
|
||||
},
|
||||
"actions": {
|
||||
"login_as": {
|
||||
"label": "Login as this user",
|
||||
"type": "command",
|
||||
"command": "echo 'Login as {{username}}' | pbcopy"
|
||||
},
|
||||
"copy_credentials": {
|
||||
"label": "Copy credentials",
|
||||
"type": "copy",
|
||||
"template": "{{username}} / Amar2025!"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "petowners_by_state",
|
||||
"title": "Pet Owners by Data State",
|
||||
"slug": "petowners-by-state",
|
||||
"description": "Pet owners grouped by data state (has_pets, has_coverage, has_requests, has_turnos)",
|
||||
"mode": "sql",
|
||||
"entity": "PetOwner",
|
||||
"group_by": "state_category",
|
||||
"order_by": "created_at DESC",
|
||||
"fields": ["id", "user_id", "first_name", "last_name", "email", "phone", "has_pets", "has_coverage", "has_requests", "has_turnos"],
|
||||
"computed_group": {
|
||||
"state_category": {
|
||||
"sql": "CASE WHEN has_turnos THEN 'with_turnos' WHEN has_requests THEN 'with_requests' WHEN has_pets THEN 'with_pets' WHEN has_coverage THEN 'with_coverage' ELSE 'new' END",
|
||||
"labels": {
|
||||
"new": "New Users (Empty)",
|
||||
"with_coverage": "With Coverage Only",
|
||||
"with_pets": "With Pets Only",
|
||||
"with_requests": "With Requests",
|
||||
"with_turnos": "With Scheduled Turnos"
|
||||
}
|
||||
}
|
||||
},
|
||||
"display_fields": {
|
||||
"id": {"label": "ID", "width": "60px"},
|
||||
"first_name": {"label": "First Name", "width": "120px"},
|
||||
"last_name": {"label": "Last Name", "width": "120px", "primary": true},
|
||||
"email": {"label": "Email", "width": "200px"},
|
||||
"phone": {"label": "Phone", "width": "120px"},
|
||||
"has_pets": {"label": "Pets", "width": "60px", "type": "icon"},
|
||||
"has_coverage": {"label": "Coverage", "width": "80px", "type": "icon"},
|
||||
"has_requests": {"label": "Requests", "width": "80px", "type": "icon"},
|
||||
"has_turnos": {"label": "Turnos", "width": "70px", "type": "icon"}
|
||||
},
|
||||
"actions": {
|
||||
"login_as": {
|
||||
"label": "Login as petowner",
|
||||
"type": "link",
|
||||
"template": "/login?user_id={{user_id}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vets_by_availability",
|
||||
"title": "Veterinarians by Availability",
|
||||
"slug": "vets-by-availability",
|
||||
"description": "Vets grouped by availability and active work status",
|
||||
"mode": "sql",
|
||||
"entity": "Veterinarian",
|
||||
"group_by": "availability_status",
|
||||
"order_by": "active_requests DESC, completed_visits DESC",
|
||||
"fields": ["id", "user_id", "first_name", "last_name", "email", "phone", "matricula", "has_availability", "has_specialties", "has_coverage_areas", "active_requests", "completed_visits"],
|
||||
"computed_group": {
|
||||
"availability_status": {
|
||||
"sql": "CASE WHEN NOT has_availability THEN 'no_availability' WHEN active_requests > 3 THEN 'very_busy' WHEN active_requests > 0 THEN 'busy' ELSE 'available' END",
|
||||
"labels": {
|
||||
"no_availability": "No Availability Configured",
|
||||
"available": "Available (No Active Requests)",
|
||||
"busy": "Busy (1-3 Active Requests)",
|
||||
"very_busy": "Very Busy (4+ Active Requests)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"display_fields": {
|
||||
"id": {"label": "ID", "width": "60px"},
|
||||
"first_name": {"label": "First Name", "width": "120px"},
|
||||
"last_name": {"label": "Last Name", "width": "120px", "primary": true},
|
||||
"matricula": {"label": "Matricula", "width": "100px"},
|
||||
"phone": {"label": "Phone", "width": "120px"},
|
||||
"has_availability": {"label": "Avail", "width": "60px", "type": "icon"},
|
||||
"has_specialties": {"label": "Spec", "width": "60px", "type": "icon"},
|
||||
"has_coverage_areas": {"label": "Areas", "width": "60px", "type": "icon"},
|
||||
"active_requests": {"label": "Active", "width": "70px", "type": "number"},
|
||||
"completed_visits": {"label": "Completed", "width": "90px", "type": "number"}
|
||||
},
|
||||
"actions": {
|
||||
"login_as": {
|
||||
"label": "Login as vet",
|
||||
"type": "link",
|
||||
"template": "/login?user_id={{user_id}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "requests_pipeline",
|
||||
"title": "Service Requests Pipeline",
|
||||
"slug": "requests-pipeline",
|
||||
"description": "Active service requests grouped by state (like turnos monitor)",
|
||||
"mode": "sql",
|
||||
"entity": "ServiceRequest",
|
||||
"group_by": "state",
|
||||
"order_by": "created_at DESC",
|
||||
"fields": ["id", "petowner_id", "veterinarian_id", "state", "pay_number", "date_coordinated", "hour_coordinated", "has_cart", "has_payment", "has_turno", "age_hours", "created_at"],
|
||||
"filter": {
|
||||
"state": ["pending", "in_progress_vet", "vet_asked", "vet_accepted", "in_progress_pay", "payed", "coordinated", "not_coordinated"]
|
||||
},
|
||||
"display_fields": {
|
||||
"id": {"label": "ID", "width": "60px", "primary": true},
|
||||
"petowner_id": {"label": "Owner", "width": "70px", "type": "link"},
|
||||
"veterinarian_id": {"label": "Vet", "width": "60px", "type": "link"},
|
||||
"state": {"label": "State", "width": "120px", "type": "badge"},
|
||||
"has_cart": {"label": "Cart", "width": "50px", "type": "icon"},
|
||||
"has_payment": {"label": "Pay", "width": "50px", "type": "icon"},
|
||||
"has_turno": {"label": "Turno", "width": "50px", "type": "icon"},
|
||||
"age_hours": {"label": "Age (h)", "width": "70px", "type": "number"}
|
||||
},
|
||||
"state_colors": {
|
||||
"pending": "#fbbf24",
|
||||
"in_progress_vet": "#f97316",
|
||||
"vet_asked": "#fb923c",
|
||||
"vet_accepted": "#4ade80",
|
||||
"in_progress_pay": "#60a5fa",
|
||||
"payed": "#2dd4bf",
|
||||
"coordinated": "#22c55e",
|
||||
"not_coordinated": "#facc15"
|
||||
},
|
||||
"actions": {
|
||||
"view_details": {
|
||||
"label": "View request",
|
||||
"type": "link",
|
||||
"template": "/admin/solicitudes/servicerequest/{{id}}/change/"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "full_graph",
|
||||
"title": "Full Data Graph",
|
||||
"slug": "full-graph",
|
||||
"description": "Complete data model graph showing all entities and relationships",
|
||||
"mode": "graph",
|
||||
"graph_type": "erd",
|
||||
"entities": ["User", "PetOwner", "Veterinarian", "Pet", "ServiceRequest", "VetVisit"],
|
||||
"relationships": [
|
||||
{"from": "User", "to": "PetOwner", "type": "1:1", "via": "user_id"},
|
||||
{"from": "User", "to": "Veterinarian", "type": "1:1", "via": "user_id"},
|
||||
{"from": "PetOwner", "to": "Pet", "type": "1:N", "via": "petowner_id"},
|
||||
{"from": "PetOwner", "to": "ServiceRequest", "type": "1:N", "via": "petowner_id"},
|
||||
{"from": "Veterinarian", "to": "ServiceRequest", "type": "1:N", "via": "veterinarian_id"},
|
||||
{"from": "ServiceRequest", "to": "VetVisit", "type": "1:1", "via": "service_request_id"},
|
||||
{"from": "Veterinarian", "to": "VetVisit", "type": "1:N", "via": "veterinarian_id"}
|
||||
},
|
||||
"layout": "hierarchical",
|
||||
"generators": ["graphviz", "mermaid", "d3"]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user