Skip to main content

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.

Three models handle the inspection lifecycle: Inspeccion records a single inspection session with its location, timing, and SAP integration data; InspeccionTecnico holds each checklist line item answered during that session; and AsignacionInspeccion schedules which technician is responsible for which equipment in a given week.

Inspeccion

Inspeccion is the top-level record for a single inspection session. It links to the equipment and location inspected, captures the technician’s LDAP username, and stores SAP reference fields used for cross-system traceability.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
fechadaterequiredDate the inspection was performed
hora_iniciotimerequiredInspection start time
hora_fintimerequiredInspection end time
divisionFK → Divisionrequired, CASCADEDivision where the inspection took place
areaFK → Arearequired, CASCADEArea where the inspection took place
zonaFK → Zonarequired, CASCADEZone where the inspection took place
equipoFK → Equiporequired, CASCADEEquipment that was inspected
observacionestextoptional, blank allowedGeneral observations or notes for the session
ownerstring (50)optional, nullableLDAP username of the technician who performed the inspection (e.g. ac17157)
owner on Inspeccion is a plain CharField, not a foreign key to Django’s User model. It stores the LDAP sAMAccountName string directly. This decouples inspection records from the local user table — an inspection is preserved even if the corresponding User record is deleted.

SAP integration fields

These fields are populated when the inspection is linked to an equipment record in SAP. They are all optional and nullable.
FieldTypeSAP termDescription
sap_equnrstring (50)EQUNRSAP equipment code — the unique identifier for the equipment object in SAP
sap_equnr_descstring (150)Human-readable name of the equipment as it appears in SAP
sap_tplnrstring (50)TPLNRSAP technical location — the functional location code in the plant maintenance hierarchy
sap_puesto_trabajostring (50)Puesto de trabajoSAP work center — the organizational unit responsible for the maintenance task
comentario_hallazgotextFinding comment submitted back to SAP after the inspection
When submitting an inspection via the API, include the SAP fields if the equipment record has a corresponding SAP entry. Leaving them blank is valid — the inspection will still be saved and appear in the dashboard, but cross-referencing with SAP reports will not be possible.

Reverse relation

Inspeccion exposes a revisiones reverse relation that returns all InspeccionTecnico line items for the session. The dashboard endpoint returns these inline as a tecnicos array in each inspection object.

InspeccionTecnico

InspeccionTecnico records a single checklist answer within an Inspeccion. One record is created per PreguntaTecnica answered during the session.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
inspeccionFK → Inspeccionrequired, CASCADEThe parent inspection session
descripciontextrequiredThe question text as answered (copied from PreguntaTecnica.descripcion at submission time)
estadostring (10)required, choicesInspection result for this item — see status values below
comentariotextoptional, nullableFree-text comment for this line item
es_criticobooleandefault FalseWhether this finding is flagged as critical

Estado choices

ValueLabelMeaning
OKOKThe item passed inspection
NOKNOKThe item failed inspection (non-conformant)
NANo AplicaThe item does not apply to this equipment or situation
descripcion on InspeccionTecnico is stored as a plain text copy of the question at the time of submission. It is not a foreign key to PreguntaTecnica. This means inspection records remain accurate even if questions are later edited or deleted in the admin.

AsignacionInspeccion

AsignacionInspeccion represents a weekly work assignment — it records which technician (asociado) is scheduled to inspect which equipment (equipo) during a given week. Unlike Equipo and Inspeccion, the asociado, equipo, and zona fields are plain strings, not foreign keys. This keeps the assignment table independent of the equipment table and allows assignments to reference equipment names directly.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
fechadaterequiredMonday that starts the assignment week
asociadostring (150)requiredTechnician name or identifier
equipostring (150)requiredEquipment name
zonastring (150)optional, nullableZone name
asignado_porstring (100)default AdminName or role of the person who created the assignment
creado_endatetimeauto, set on createTimestamp when the record was created

Uniqueness constraint

The combination of (fecha, asociado, equipo) is enforced as unique. A technician cannot be assigned the same equipment item more than once in the same week.
The assignment API replaces all assignments for a given week in a single request — it deletes existing records for the fecha value and bulk-inserts the new set. There is no partial update; every POST to the assignments endpoint is a full week replacement.

Default ordering

AsignacionInspeccion records are returned ordered by asociado, then zona, then equipo.

Build docs developers (and LLMs) love