The Inspecciones Técnicas data model is organized around two primary concerns: equipment and its location within the plant, and the inspections performed on that equipment. All data is stored in a relational MySQL database managed by Django’s ORM. Understanding these entities and their relationships is essential for consuming the API correctly or extending the system.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/AC42027/Backend-produccion/llms.txt
Use this file to discover all available pages before exploring further.
Models at a glance
The system defines eleven models across two logical groups:| Model | Group | Description |
|---|---|---|
Categoria | Reference | Category that groups technical questions and equipment |
PreguntaTecnica | Reference | A technical checklist question, scoped to a Categoria |
Division | Location | Top level of the plant location hierarchy |
Area | Location | A subdivision of a Division |
Zona | Location | A subdivision of an Area |
UbicacionFisica | Location | A freeform physical location description for an equipment item |
Owner | Equipment | The responsible party (team or person) for a piece of equipment |
Equipo | Equipment | A piece of equipment to be inspected |
Inspeccion | Inspection | A single inspection session, linked to one Equipo |
InspeccionTecnico | Inspection | One checklist line item within an Inspeccion |
AsignacionInspeccion | Scheduling | A weekly assignment of a technician to an equipment item |
Location hierarchy
Plant locations follow a strict three-level hierarchy. Each level is a foreign key to the level above:Equipo record carries its own division, area, and zona foreign keys, duplicating the hierarchy directly on the equipment record. This allows the API to filter or display equipment location without traversing the full chain at query time.
UbicacionFisica is a separate, flat model that holds a freeform physical location description (for example, a room or bay name). It is distinct from the Division → Area → Zona hierarchy and is stored on Equipo as an optional foreign key.Equipment and ownership
AnEquipo belongs to:
- A
Categoria— which also governs whichPreguntaTecnicachecklist questions are presented during an inspection - An
Owner— the team or person responsible for the equipment - A location in the
Division → Area → Zonahierarchy - An optional
UbicacionFisicafor a more specific physical description
Inspection structure
AnInspeccion records a single inspection session. It references the Division, Area, Zona, and Equipo that were inspected, and it captures the LDAP username of the technician who performed the inspection in the owner field (a plain CharField, not a relation).
Each Inspeccion has one or more InspeccionTecnico records — one per checklist question answered during the session. These are stored in the revisiones reverse relation on Inspeccion.
Technical questions and categories
PreguntaTecnica records define the reusable checklist questions shown to technicians. Each question belongs to a Categoria and has an orden field that controls the display sequence within that category. The combination of (categoria, orden) is unique, preventing duplicate positions.
Weekly assignments
AsignacionInspeccion records schedule which technician (asociado) should inspect which equipment (equipo) during a given week. The fecha field holds the Monday that starts the week. The triple (fecha, asociado, equipo) is enforced as unique, so no technician can be assigned the same equipment twice in the same week.
Entity relationship summary
| Relationship | Type | Notes |
|---|---|---|
Area → Division | Many-to-one | Cascade delete |
Zona → Area | Many-to-one | Cascade delete |
PreguntaTecnica → Categoria | Many-to-one | Cascade delete |
Equipo → Division, Area, Zona | Many-to-one | SET NULL on delete |
Equipo → UbicacionFisica | Many-to-one | SET NULL on delete |
Equipo → Categoria | Many-to-one | SET NULL on delete |
Equipo → Owner | Many-to-one | SET NULL on delete |
Inspeccion → Division, Area, Zona, Equipo | Many-to-one | Cascade delete |
InspeccionTecnico → Inspeccion | Many-to-one | Cascade delete |