All diagrams //15 of 15

Open LegalTec - Marco Normativo-V2Fredy
⭐
LegalTec - Marco Normativo-V2Fredy
15 Aug, 2026
%% ───────────────────────────────────────────────────────────────────────────────
%% MODULO de union entre Region y los codigos a utilizar
%% Define el tipo de codigo bajo el cual se realizara el proceso legal y por ende las etapas del ERD LegalTech
%% ───────────────────────────────────────────────────────────────────────────────

erDiagram    

CODIGOS {
        int codigo_id PK "Identificador unico del codigo"

        string denominacion_oficial "Nombre oficial del ordenamiento"

        string clave "Abreviatura o nombre corto"

        string materia_juridica "Civil, Familiar, Mercantil, Penal, Laboral"

        string ambito_aplicacion "Federal, Estatal o Local"

        int ef_estado_id FK "Estado donde resulta aplicable"

        date vigencia_desde "Fecha de inicio de vigencia"

        date vigencia_hasta "Fecha de fin de vigencia; null si continua vigente"

        date fecha_ultima_reforma "Ultima reforma considerada por el sistema"

        text criterio_procesal "Sintesis de las disposiciones relevantes para el proceso"

        string fuente_oficial "Referencia o enlace de consulta oficial"

        string estado_vigencia "Vigente, Abrogado, Sustituido o En revision"
    }
 EF_REGION ||--o{ CODIGOS : "Aplica en"
Open Proceso completo fredy
πŸ¦‹
Proceso completo fredy
11 Aug, 2026
erDiagram

%% ═══════════════════════════════════════════════════════════════════════════════
%% SISTEMA LEGAL - MODELO BASE
%% Incluye:
%% 1. Entidades Federativas
%% 2. Marco Normativo
%% 3. Taxonomia Juridica
%% 4. Rutas y Etapas Procesales
%% ═══════════════════════════════════════════════════════════════════════════════


%% ───────────────────────────────────────────────────────────────────────────────
%% MODULO 1: ENTIDADES FEDERATIVAS
%% Define la estructura territorial y genera una referencia unica mediante
%% EF_REGION para ser utilizada por otros modulos.
%% ───────────────────────────────────────────────────────────────────────────────

EF_PAIS {
    int ef_pais_id PK
    string ef_nombre
    string ef_codigo_iso_alfa_3
}

EF_ESTADO {
    int ef_estado_id PK
    string ef_nombre
    bool ef_es_capital
    string ef_clave_inegi
    int ef_pais_id FK
}

EF_MUNICIPIO {
    int ef_municipio_id PK
    string ef_nombre
    bool ef_es_capital
    string ef_clave_inegi
    int ef_estado_id FK
}

EF_REGION {
    int ef_region_id PK
    string ef_tipo_region "Pais, Estado o Municipio"
    int ef_pais_id FK
    int ef_estado_id FK
    int ef_municipio_id FK
}


%% ───────────────────────────────────────────────────────────────────────────────
%% MODULO 2: MARCO NORMATIVO
%% Contiene los codigos y ordenamientos juridicos utilizados por el sistema.
%% Cada codigo se relaciona con una region de aplicacion.
%% ───────────────────────────────────────────────────────────────────────────────

MN_CODIGOS {
    int mn_codigo_id PK
    string mn_denominacion_oficial
    string mn_clave
    string mn_tipo_ordenamiento "Codigo, Ley, Reglamento, Constitucion"
    string mn_materia_juridica "Civil, Familiar, Mercantil, Penal, Laboral"
    int ef_region_id FK
    date mn_vigencia_desde
    date mn_vigencia_hasta
    date mn_fecha_ultima_reforma
    text mn_criterio_procesal
    string mn_fuente_oficial
    string mn_estado_vigencia "Vigente, Abrogado, Sustituido o En revision"
}


%% ───────────────────────────────────────────────────────────────────────────────
%% MODULO 3: TAXONOMIA JURIDICA
%% Contiene todo el arbol de clasificacion legal mediante una estructura
%% jerarquica recursiva.
%% ───────────────────────────────────────────────────────────────────────────────

TJ_NODOS {
    int tj_nodo_id PK
    int tj_nodo_padre_id FK
    string tj_nivel "Rama, Area, Subarea, Categoria, Tipo o Modalidad"
    string tj_nombre
    bool tj_activo
}


%% ───────────────────────────────────────────────────────────────────────────────
%% MODULO 4: RUTAS PROCESALES
%% Une el tipo de asunto con el marco normativo aplicable y determina
%% que etapas corresponden a cada procedimiento.
%% ───────────────────────────────────────────────────────────────────────────────

PR_RUTAS {
    int pr_ruta_id PK
    string pr_nombre
    int tj_nodo_id FK
    int mn_codigo_id FK
    bool pr_vigente
}

PR_ETAPAS {
    int pr_etapa_id PK
    string pr_nombre
    string pr_descripcion
}

PR_RUTA_ETAPA {
    int pr_ruta_etapa_id PK
    int pr_ruta_id FK
    int pr_etapa_id FK
    int pr_orden
    bool pr_obligatoria
}


%% ═══════════════════════════════════════════════════════════════════════════════
%% RELACIONES
%% ═══════════════════════════════════════════════════════════════════════════════


%% Entidades Federativas

EF_PAIS ||--o{ EF_ESTADO : "Tiene"

EF_ESTADO ||--o{ EF_MUNICIPIO : "Tiene"

EF_PAIS ||--o{ EF_REGION : "Representa"

EF_ESTADO ||--o{ EF_REGION : "Representa"

EF_MUNICIPIO ||--o{ EF_REGION : "Representa"


%% Marco Normativo

EF_REGION ||--o{ MN_CODIGOS : "Aplica en"


%% Taxonomia Juridica

TJ_NODOS ||--o{ TJ_NODOS : "Contiene"


%% Definicion de Ruta Procesal

TJ_NODOS ||--o{ PR_RUTAS : "Define asunto"

MN_CODIGOS ||--o{ PR_RUTAS : "Fundamenta"


%% Asignacion de Etapas

PR_RUTAS ||--o{ PR_RUTA_ETAPA : "Contiene"

PR_ETAPAS ||--o{ PR_RUTA_ETAPA : "Se asigna"
Open Legaltech - Rutas & Etapas
πŸ”²
Legaltech - Rutas & Etapas
11 Aug, 2026
erDiagram

    PR_ETAPAS {
        int pr_etapa_id PK
        string pr_nombre
        string pr_descripcion
    }

    PR_RUTAS ||--o{ PR_RUTA_ETAPA : "Contiene"
    PR_ETAPAS ||--o{ PR_RUTA_ETAPA : "Se asigna"

    PR_RUTAS {
        int pr_ruta_id PK
    }

    PR_ETAPAS {
        int pr_etapa_id PK
    }

    PR_RUTA_ETAPA {
        int pr_ruta_etapa_id PK
        int pr_ruta_id FK
        int pr_etapa_id FK
        int pr_orden
        bool pr_obligatoria
    }
Open 29/07/2026 - LegalTech - ERD - V2.0
🌐
29/07/2026 - LegalTech - ERD - V2.0
11 Aug, 2026v6

Diagrama de la base de datos despues de feedback de 6 abogados distintos.

erDiagram
    %% ═══════════════════════════════════════════════════════════════
    %% MOTOR DE REGLAS PROCESALES
    %% Con el objetivo de sintetizar las reglas vigentes y las etapas que seran 
    %% usadas en cada uno de los expedientes.
    %% ═══════════════════════════════════════════════════════════════
ΒΏ
   LF_REGLA_PROCESAL {
        int id PK
        char name "calculado: modalidad + entidad + via"
        int tipo_asunto_id FK "lf.tipo.asunto restriccion nivel=modalidad"
        int state_id FK "res.country.state, nulo = federal o nacional"
        int via_procesal_id FK "lf.via.procesal ondelete restrict"
        char fundamento_legal "requerido, articulo y codigo"
        date vigente_desde "requerido"
        date vigente_hasta "nulo = vigente"
        boolean es_federal
        boolean cnpcf_aplicable
        int calendar_id FK "resource.calendar, sustituye al calendario estatal"
        text notas
        boolean active
        int company_id FK "res.company"
    }    

    LF_TAXONOMIA_JURIDICA {
        int id PK
        char name "requerido, indice trigram"
        char complete_name "calculado almacenado recursivo, rec_name"
        int parent_id FK "lf.tipo.asunto ondelete cascade"
        char parent_path "parent_store"
        selection nivel "rama|area|categoria|tipo|modalidad calculado almacenado"
        text descripcion
        int color
        boolean active
    }

    LF_MEDIO_IMPUGNACION {
        int id PK
        char name "requerido, indice trigram"
        char complete_name "calculado almacenado recursivo, rec_name"
        int parent_id FK "lf.medio.impugnacion ondelete cascade"
        char parent_path "parent_store"
        selection nivel "genero|especie|tipo|modalidad calculado almacenado"
        text descripcion
        int color
        boolean active
        boolean genera_expediente_propio "true si requiere cuaderno o expediente separado"
        selection organo_resuelve "mismo_organo|tribunal_alzada|tribunal_colegiado|juzgado_distrito"
        boolean suspende_procedimiento "aplica principalmente a incidentes"
    }

    LF_VIA_PROCESAL {
        int id PK
        char name "requerido, traducible"
        char code "unico"
        text descripcion
        boolean active
    }

    LF_JUZGADO {
        int id PK
        char name "requerido"
        char code "Clave"
        int state_id FK "res.country.state MX"
        boolean lf_es_federal "auto populado"
        char direccion
        char phone
        char email
        text notas
        boolean active
        int company_id FK "res.company"
    }

    LF_ETAPA_PROCESAL {
        int id PK
        int regla_procesal_id FK "lf.regla.procesal requerido ondelete cascade"
        char name "requerido, ej. Contestacion de demanda"
        int sequence "orden legal dentro de la via"
        int plazo_dias "plazo por defecto"
        boolean dias_habiles "predeterminado Verdadero"
        boolean genera_termino "si crea lf.termino.legal automatico"
        char fundamento_legal
        text descripcion
        boolean active
    }

    %% ═══════════════════════════════════════════════════════════════
    %% ASUNTOS LEGALES
    %% ═══════════════════════════════════════════════════════════════

    LF_ASUNTO {
        int lf_asunto_id PK
        char lf_folio_asunto "A00001"
        char lf_asunto_nombre "Nombre en formato libre"
        int lf_contacto_id FK "res.partner, para cliente ($) / a quien se reporta"
        string lf_user_id FK "multiples responsables internos"
        text lf_litis_asunto "Resumen del conflicto, hecho por IA"
        int sequence
        int lf_asunto_etapa_id FK
        int lf_expediente_id FK "Folio juzgado|Folio expediente|Actore/s|Demandado/s|juzgado|Entidad federativa|Taxonomia Juridica|Sig. Termino|Fecha de vencimiento, etiquetas de taxonomia de segundo nivel los actores y demandados con y otros si mas de uno"
    }

    LF_ASUNTO_ETAPA {
        int id PK
        char name "requerido, traducible"
        text descripcion
        int sequence
        boolean fold
        boolean is_closed
        boolean active
    }

    LF_EXPEDIENTE { 
%% agregar litis por expediente
%% agregar taxonomia
        int lf_expediente_id PK "antes id a secas"
        char lf_nombre_expediente "antes name a secas"
        char lf_asunto_id FK "trae lf_folio_asunto"
        char lf_folio_juzgado "1234, antes numero_folio_juzgado"
        char lf_folio_expediente "456/2026 antes numero_juzgado"
        int lf_regla_procesal_id FK "lista de etapas con vigencia de la regla"
        char lf_via_procesal_id FK "hash"
        char lf_taxonomia_juridica_id FK "hash"
        char lf_medio_impugnacion_id FK "hash, etapas paralelas o que detienen el asunto principal"
        int lf_juzgado_id FK 
        date lf_fecha_radicacion
        boolean es_federal "relacionado juzgado almacenado"
        int sequence "etapa actual del expediente (?)"
        int lf_expediente_id FK "Actore/s|Demandado/s|juzgado|Entidad federativa|Taxonomia Juridica|Sig. Termino|Fecha de vencimiento, etiquetas de taxonomia de segundo nivel los actores y demandados con y otros si mas de uno"
        %%aqui vamos, reslviento como manejar multiples actores u demandados, quiza uso de tabla rol procesal

        int company_id FK "res.company"
        int cliente_id FK "[REFACTOR] lf.cliente β€” mover a asunto"
        int cliente_partner_id FK "[REFACTOR] relacionado β€” mover a asunto"
        date date_deadline "[REFACTOR] redundante con lf.termino.legal"
        char actor_nombre "[REFACTOR] calcular desde asunto.lf_parte_ids"
        char demandado_nombre "[REFACTOR] calcular desde asunto.lf_parte_ids"
    }

    LF_EXPEDIENTE_ETAPA_TABLERO {
        int id PK
        char name "requerido, traducible"
        text descripcion
        int sequence
        boolean fold
        boolean is_closed
        boolean active
    }

    LF_TERMINO_LEGAL {
        int id PK
        char name "Referencia TRM- ir.sequence"
        char descripcion "requerido"
        int etapa_procesal_id FK "[+campo] lf.etapa.procesal β€” autollena dias_habiles"
        int asunto_id FK "lf.asunto requerido ondelete cascade"
        int expediente_id FK "[REFACTOR] ya no puede ser relacionado via asunto"
        int acuerdo_id FK "lf.acuerdo ondelete set null"
        date fecha_inicio "requerido"
        int dias_habiles
        date fecha_limite "requerido"
        int calendar_id FK "resource.calendar calculado almacenado, escritura permitida"
        selection state "vigente|vencido|cumplido|cancelado"
        text notas
        boolean active
        int company_id FK "relacionado asunto_id.company_id almacenado"
    }

    %% ═══════════════════════════════════════════════════════════════
    %% PARTES, FUNCIONARIOS Y CONTACTOS
    %% ═══════════════════════════════════════════════════════════════

    LF_CLIENTE {
        int id PK
        int contacto_id FK "res.partner unico por compania"
        char name "relacionado almacenado"
        char email "relacionado"
        char phone "relacionado"
        text notas
        boolean active
        int company_id FK "res.company"
    }

    LF_PARTE_PROCESAL {
        int id PK
        int asunto_id FK "lf.asunto requerido ondelete cascade"
        int contacto_id FK "res.partner requerido ondelete restrict"
        selection rol_procesal "actor|demandado|tercero|testigo requerido"
        int abogado_id FK "[REFACTOR] res.partner con lf_es_abogado=true, antes lf.abogado"
        text notas
        boolean active
        int company_id FK "relacionado asunto_id.company_id almacenado"
    }

    LF_ROL_PROCESAL {
        int id PK
        char name "requerido"
        char code "unico"
        selection grupo "parte_principal|tercero_interes|auxiliar_prueba|representante|interviniente_institucional|funcionario_judicial"
        boolean es_parte_procesal "false para funcionario_judicial - no aplica en lf.parte.procesal"
        text descripcion
        boolean active
    }

    LF_FUNCIONARIO_JUDICIAL {
        int id PK
        int juzgado_id FK "lf.juzgado requerido ondelete cascade"
        int contacto_id FK "res.partner opcional, si se requiere correo/telefono"
        char name "requerido"
        selection cargo "juez|magistrado|secretario_acuerdos|actuario|notificador"
        char cedula_profesional
        date fecha_adscripcion
        boolean active
    }

    %% ═══════════════════════════════════════════════════════════════
    %% TRANSCRIPCIONES
    %% ═══════════════════════════════════════════════════════════════

   TRANSCRIPCION_TRABAJO {
        int id PK
        char name "Referencia TRX- ir.sequence"
        boolean active
        int company_id FK "res.company requerido"
        int enviado_por_id FK "res.users"
        int expediente_id FK "lf.expediente ondelete set null"
        int folio_expediente_id FK "proxy relacionado a expediente_id"
        int numero_expediente_id FK "proxy relacionado a expediente_id"
        date documento_fecha_inicio "Fecha de inicio"
        text documento_resumen "Resumen del documento"
        selection state "pendiente|en_proceso|listo_para_verificar|verificado|error"
        selection trabajo_tipo "pdf_ocr|odt_extraccion|audio_transcripcion|audio_diarizacion"
        selection medio_tipo "pdf|odt|audio|video|desconocido"
        binary archivo_carga "auxiliar transitorio"
        char archivo_carga_nombre
        int attachment_id FK "ir.attachment ondelete restrict"
        binary attachment_datas "relacionado"
        char attachment_name "relacionado"
        char mime_type
        int file_size
        html reproductor_html "calculado"
        html vista_previa_editable_html "calculado markdown"
        html vista_previa_resultado_html "calculado markdown"
        char transcripcion_idioma "predeterminado es"
        int num_hablantes
        int min_hablantes
        int max_hablantes
        int reintentos
        text resultado_texto "salida del motor, solo lectura"
        text texto_editable "copia para revision humana"
        text texto_verificado "solo lectura"
        datetime verificado_en
        int verificado_por_id FK "res.users"
        text resultado_incierto_json
        text resultado_hablantes_json
        text resultado_segmentos_json
        text error_mensaje
        char kestra_ejecucion_id
        datetime procesado_en
        int adjunto_normalizado_id FK "ir.attachment salida de ffmpeg"
        char mime_type_normalizado
        text normalizacion_log
    }

    TRANSCRIPCION_HABLANTE {
        int id PK
        int trabajo_id FK "transcripcion.trabajo requerido ondelete cascade"
        char code "requerido, unico por trabajo"
        char name
        int sequence
    }

    TRANSCRIPCION_SEGMENTO {
        int id PK
        int trabajo_id FK "transcripcion.trabajo requerido ondelete cascade"
        int hablante_id FK "transcripcion.hablante ondelete set null"
        char hablante_clave
        float segundo_inicio
        float segundo_fin
        text texto
        int sequence
    }

    LF_TIPO_DOCUMENTO {
        int id PK
        char name "requerido, traducible"
        char code "unico por compania"
        int sequence
        text descripcion
        boolean active
        int company_id FK "res.company"
    }

    IR_ATTACHMENT {
        int id PK
        char name
        char res_model "modelo propietario polimorfico"
        int res_id "id propietario polimorfico"
        char type "url|binary"
        binary datas
        char store_fname "ruta en filestore"
        char checksum
        char mimetype
        int file_size
        boolean public
        int company_id FK "res.company"
        int lf_tipo_documento_id FK "lf.tipo.documento"
        char lf_folio "Folio documento"
        int lf_expediente_id FK "lf.expediente"
    }

    %% ═══════════════════════════════════════════════════════════════
    %% PRUEBAS (?)
    %% ═══════════════════════════════════════════════════════════════

    LF_PRUEBA {
        int id PK
        char name "requerido"
        int asunto_id FK "lf.asunto requerido ondelete cascade"
        int expediente_id FK "[REFACTOR] el asunto ya no tiene un solo expediente"
        int ofrecimiento_contacto_id FK "res.partner"
        int admision_contacto_id FK "res.partner"
        int desahogo_contacto_id FK "res.partner"
        date fecha_ofrecimiento
        date fecha_admision
        date fecha_desahogo
        selection state "pendiente|ofrecida|admitida|desahogada|desechada"
        html notas
        boolean active
        int company_id FK "relacionado asunto_id.company_id almacenado"
    }

    %% ═══════════════════════════════════════════════════════════════
    %% BUSQUEDA DE ACUERDOS
    %% ═══════════════════════════════════════════════════════════════
    
    LF_ACUERDO {
        int id PK
        char name "Referencia ACU- ir.sequence"
        selection tipo_actuacion "[+campo] acuerdo|promocion|audiencia|notificacion|sentencia|recurso"
        int transcripcion_trabajo_id FK "[+campo] transcripcion.trabajo β€” origen OCR"
        int etapa_procesal_id FK "[+campo] lf.etapa.procesal que corresponde"
        int expediente_id FK "lf.expediente ondelete restrict"
        int asunto_id FK "lf.asunto ondelete set null"
        text sintesis "requerido"
        html contenido
        date fecha_acuerdo "requerido"
        date fecha_publicacion
        datetime fecha_subida
        boolean genera_termino
        int termino_id FK "lf.termino.legal principal ondelete set null"
        date termino_fecha_inicio
        int termino_dias_habiles
        date termino_fecha_limite
        selection termino_state "relacionado termino_id.state"
        int termino_conteo "calculado"
        boolean active
        int company_id FK "calculado almacenado"
    }

    LF_BITACORA_REGISTRO {
        int id PK
        int expediente_id FK "lf.expediente requerido ondelete cascade"
        int asunto_id FK "lf.asunto ondelete set null"
        int user_id FK "res.users requerido"
        datetime fecha "requerido"
        boolean hubo_publicacion
        text notas "requerido"
        int acuerdo_id FK "lf.acuerdo ondelete set null"
        boolean active
        int company_id FK "relacionado expediente_id.company_id almacenado"
    }

    %% ═══════════════════════════════════════════════════════════════
    %% ODOO CORE
    %% ═══════════════════════════════════════════════════════════════
    RES_PARTNER {
        int id PK
        char name
        boolean is_company
        char email
        char phone
        char lf_razon_social
        boolean lf_es_abogado "[NUEVO] true si el contacto ejerce como abogado"
        char lf_cedula_profesional "[NUEVO]"
        selection lf_nivel_abogado "[NUEVO] jr|ssr|sr|socio"
        selection lf_relacion_abogado "[NUEVO] interno|externo"
        int lf_user_id FK "[NUEVO] res.users, solo si es abogado interno con acceso"
    }
    RES_PARTNER_CATEGORY {
        int id PK
        char name
        selection lf_rol_tipo "especialidad_perito|etiqueta_parte"
    }
    RES_COUNTRY_STATE {
        int id PK
        char name
        char code
        int country_id FK "res.country"
        int lf_calendario_judicial_id FK "resource.calendar"
    }
 
    RES_USERS {
        int id PK
        int partner_id FK "res.partner"
        char login
    }
    RES_COMPANY {
        int id PK "company_id"
        char name
    }

    %% ── [NUEVA] Motor de reglas ─────────────────────────────────────
    LF_TAXONOMIA_JURIDICA    ||--o{ LF_REGLA_PROCESAL : "modalidad (nivel=modalidad)"
    RES_COUNTRY_STATE ||--o{ LF_REGLA_PROCESAL : "state_id"
    LF_VIA_PROCESAL   ||--o{ LF_REGLA_PROCESAL : "via_procesal_id"
    LF_REGLA_PROCESAL ||--o{ LF_ETAPA_PROCESAL : "etapa_ids"
    RES_COMPANY       ||--o{ LF_REGLA_PROCESAL : posee

    LF_REGLA_PROCESAL ||--o{ LF_ASUNTO : "regla_procesal_id resuelta"
    LF_ETAPA_PROCESAL ||--o{ LF_ASUNTO : "etapa_procesal_id actual"
    LF_ETAPA_PROCESAL ||--o{ LF_EXPEDIENTE : "etapa_procesal_id actual"
    LF_ETAPA_PROCESAL ||--o{ LF_ACUERDO : "etapa_procesal_id"
    LF_ETAPA_PROCESAL ||--o{ LF_TERMINO_LEGAL : "etapa_procesal_id autollena plazo"

    %% ── [REFACTOR] Asunto padre de expedientes ──────────────────────
    LF_ASUNTO ||--o{ LF_EXPEDIENTE : "expediente_ids (1 asunto -> N expedientes)"

    %% ── Expediente / Asunto ─────────────────────────────────────────
    LF_EXPEDIENTE_ETAPA_TABLERO ||--o{ LF_EXPEDIENTE : "stage_id"
    LF_ASUNTO_ETAPA     ||--o{ LF_ASUNTO : "stage_id"
    LF_TAXONOMIA_JURIDICA ||--o{ LF_ASUNTO : "LF_TAXONOMIA_JURIDICA_id"
    LF_TAXONOMIA_JURIDICA ||--o{ LF_TAXONOMIA_JURIDICA : "parent_id (arbol 5 niveles)"
    LF_JUZGADO     ||--o{ LF_EXPEDIENTE : "juzgado_id"
    LF_JUZGADO     ||--o{ LF_FUNCIONARIO_JUDICIAL : adscribe
    RES_COUNTRY_STATE ||--o{ LF_JUZGADO : "state_id"
    RES_COUNTRY_STATE ||--o{ LF_ASUNTO : "lf_state_id"
    RES_COUNTRY_STATE ||--o{ LF_EXPEDIENTE : "state_id"

    %% ── Partes procesales ───────────────────────────────────────────
    LF_ASUNTO   ||--o{ LF_PARTE_PROCESAL : "lf_parte_ids"
    RES_PARTNER ||--o{ LF_PARTE_PROCESAL : "contacto_id"
    RES_PARTNER ||--o{ LF_PARTE_PROCESAL : "[REFACTOR] abogado_id representa, antes via LF_ABOGADO"
    RES_PARTNER ||--o{ LF_ASUNTO : "lf_contacto_id / lf_empresa_id / lf_cliente_id"

    %% ── Envoltorios de rol ──────────────────────────────────────────
    RES_PARTNER ||--o{ LF_CLIENTE : "lf_cliente_ids"
    RES_USERS   ||--o{ RES_PARTNER : "[REFACTOR] lf_user_id, abogado interno, antes en LF_ABOGADO"
    LF_CLIENTE  ||--o{ LF_EXPEDIENTE : "cliente_id (mover a asunto)"
    RES_PARTNER ||--o{ LF_EXPEDIENTE : "[REFACTOR] abogado_responsable_id, antes via LF_ABOGADO"

    %% ── Pruebas ─────────────────────────────────────────────────────
    LF_ASUNTO     ||--o{ LF_PRUEBA : "lf_prueba_ids"
    LF_EXPEDIENTE ||--o{ LF_PRUEBA : "expediente_id"
    RES_PARTNER   ||--o{ LF_PRUEBA : "ofrecida / admitida / desahogada por"

    %% ── Judicial ────────────────────────────────────────────────────
    LF_EXPEDIENTE ||--o{ LF_ACUERDO : "expediente_id"
    LF_ASUNTO     ||--o{ LF_ACUERDO : "lf_acuerdo_ids"
    LF_ASUNTO     ||--o{ LF_TERMINO_LEGAL : "lf_termino_ids"
    LF_EXPEDIENTE ||--o{ LF_TERMINO_LEGAL : "expediente_id"
    LF_ACUERDO    ||--o{ LF_TERMINO_LEGAL : "termino_ids (acuerdo_id)"
    LF_ACUERDO    ||--o| LF_TERMINO_LEGAL : "termino_id principal"
    LF_EXPEDIENTE ||--o{ LF_BITACORA_REGISTRO : "expediente_id"
    LF_ASUNTO     ||--o{ LF_BITACORA_REGISTRO : "asunto_id"
    LF_ACUERDO    ||--o{ LF_BITACORA_REGISTRO : "acuerdo_id"
    RES_USERS     ||--o{ LF_BITACORA_REGISTRO : "user_id"

    %% ── Documentos ──────────────────────────────────────────────────
    LF_TIPO_DOCUMENTO ||--o{ IR_ATTACHMENT : "lf_tipo_documento_id"
    LF_EXPEDIENTE     ||--o{ IR_ATTACHMENT : "lf_expediente_id"

    %% ── Transcripciones / Expediente Virtual ────────────────────────
    IR_ATTACHMENT ||--o{ TRANSCRIPCION_TRABAJO : "attachment_id original"
    IR_ATTACHMENT ||--o{ TRANSCRIPCION_TRABAJO : "adjunto_normalizado_id ffmpeg"
    TRANSCRIPCION_TRABAJO ||--o{ IR_ATTACHMENT : "res_model / res_id retro-puntero"
    LF_EXPEDIENTE ||--o{ TRANSCRIPCION_TRABAJO : "transcripcion_trabajo_ids = Expediente Virtual"
    TRANSCRIPCION_TRABAJO ||--o{ LF_ACUERDO : "[NUEVO] acuerdo_ids β€” cierra el circuito"
    TRANSCRIPCION_TRABAJO ||--o{ TRANSCRIPCION_HABLANTE : "hablante_ids"
    TRANSCRIPCION_TRABAJO ||--o{ TRANSCRIPCION_SEGMENTO : "segmento_ids"
    TRANSCRIPCION_HABLANTE ||--o{ TRANSCRIPCION_SEGMENTO : "hablante_id"
    RES_USERS ||--o{ TRANSCRIPCION_TRABAJO : "enviado_por_id / verificado_por_id"

    %% ── Users ──────────────────────────────────────────────
    RES_USERS   }o--|| RES_PARTNER : "partner_id"

%%task 1: taxonomia y via conectan a reglas procesales que conectan a su vez con expediente,  taxonomia y via conectan directo con expediente, la conexion de reglas procesales con el expediente se hacen mediante hash
%%task 2: Verificar todos los tipos de dato, verificar todas las PK y FK, revisar todas las notas agregando los campos previos y para que sirve el campo, revisar todas las relaciones
%%task 3: Decidir si las pruebas merecen un espacio adicional, sabiendo que el expediente virtual y las etapas procesales las incluyen, quiza sea necesaria mayor precision o detalle
%%task 4: Verificar que todas las tablas tengan todos los datos y relaciones correctas
%%task 5: ASegurarme de incluir una tabla con los roles procesales conectada a los expedientes
Open LegalTec - Rutas Procesales
☁️
LegalTec - Rutas Procesales
10 Aug, 2026
erDiagram

    TJ_NODOS ||--o{ PR_RUTAS : "Define asunto"
    CODIGOS ||--o{ PR_RUTAS : "Fundamenta"

    TJ_NODOS {
        int tj_nodo_id PK
    }

    CODIGOS {
        int mn_codigo_id PK
    }

    PR_RUTAS {
        int pr_ruta_id PK
        string pr_nombre
        int tj_nodo_id FK
        int mn_codigo_id FK
        bool pr_vigente
    }
Open LegalTec - Nodos
🦞
LegalTec - Nodos
10 Aug, 2026
erDiagram

    TJ_NODOS ||--o{ TJ_NODOS : "Contiene"

    TJ_NODOS {
        int tj_nodo_id PK
        int tj_nodo_padre_id FK
        string tj_nivel
        string tj_nombre
        bool tj_activo
    }
Open LegalTec Marco Legal VF2
🌐
LegalTec Marco Legal VF2
05 Aug, 2026
erDiagram

%% ============================================================================
%% MODELO MAESTRO V1
%% Repositorio normativo + taxonomia juridica + motor de reglas
%% + plantillas procesales + operacion del CRM + auditoria
%% ============================================================================

%% ----------------------------------------------------------------------------
%% 01. CATALOGOS TERRITORIALES, JUDICIALES Y PUBLICACIONES OFICIALES
%% ----------------------------------------------------------------------------

TERRITORIO {
    bigint territorio_id PK "Identificador interno"
    bigint territorio_padre_id FK "Null para la raiz nacional"
    string tipo_territorio "PAIS, ENTIDAD, MUNICIPIO, DEMARCACION"
    string clave_oficial "INEGI u otra clave oficial"
    string nombre "Nombre oficial"
    date vigencia_desde "Inicio de existencia o configuracion"
    date vigencia_hasta "Null si continua vigente"
}

CIRCUNSCRIPCION_JUDICIAL {
    bigint circunscripcion_id PK "Identificador interno"
    string tipo_circunscripcion "CIRCUITO, DISTRITO, REGION, PARTIDO"
    string clave "Clave oficial o interna"
    string nombre "Nombre oficial"
    string fuero "FEDERAL o LOCAL"
    date vigencia_desde "Fecha inicial"
    date vigencia_hasta "Null si vigente"
}

CIRCUNSCRIPCION_TERRITORIO {
    bigint circunscripcion_territorio_id PK
    bigint circunscripcion_id FK
    bigint territorio_id FK
    date vigencia_desde "Inicio de cobertura"
    date vigencia_hasta "Fin de cobertura"
}

AUTORIDAD {
    bigint autoridad_id PK
    bigint territorio_id FK "Ambito territorial principal"
    bigint autoridad_padre_id FK "Dependencia superior"
    string tipo_autoridad "LEGISLATIVA, EJECUTIVA, JUDICIAL, AUTONOMA"
    string nivel_gobierno "FEDERAL, ESTATAL, MUNICIPAL"
    string nombre_oficial
    string siglas
    date vigencia_desde
    date vigencia_hasta
}

ORGANO_JURISDICCIONAL {
    bigint organo_id PK
    bigint autoridad_id FK "Poder u organismo al que pertenece"
    bigint circunscripcion_id FK "Competencia territorial"
    string tipo_organo "JUZGADO, SALA, TRIBUNAL, JUNTA"
    string materia_principal "Civil, familiar, mercantil, etc."
    string nombre_oficial
    string clave_oficial
    string instancia "PRIMERA, SEGUNDA, REVISION"
    date vigencia_desde
    date vigencia_hasta
}

MEDIO_OFICIAL {
    bigint medio_id PK
    bigint territorio_id FK
    string nombre "DOF o periodico oficial estatal"
    string nivel "FEDERAL, ESTATAL, MUNICIPAL"
    string url_portal
}

PUBLICACION_OFICIAL {
    bigint publicacion_id PK
    bigint medio_id FK
    date fecha_publicacion
    string numero
    string edicion
    string seccion
    string tomo
    string url_oficial
    string hash_documento "Huella del archivo consultado"
}

CALENDARIO_JUDICIAL {
    bigint calendario_id PK
    bigint organo_id FK "Puede ser null si aplica a una circunscripcion"
    bigint circunscripcion_id FK "Puede ser null si aplica a un organo"
    string nombre
    int anio
    string zona_horaria
    string estado "BORRADOR, VALIDADO, PUBLICADO"
}

DIA_INHABIL {
    bigint dia_inhabil_id PK
    bigint calendario_id FK
    date fecha
    string motivo
    string fuente
}

SUSPENSION_TERMINOS {
    bigint suspension_id PK
    bigint calendario_id FK
    date fecha_desde
    date fecha_hasta
    string motivo
    string fundamento
}

%% ----------------------------------------------------------------------------
%% 02. REPOSITORIO NORMATIVO, VERSIONES Y VIGENCIAS
%% ----------------------------------------------------------------------------

ORDENAMIENTO {
    bigint ordenamiento_id PK
    string nombre_oficial
    string nombre_corto
    string siglas
    string tipo_ordenamiento "CONSTITUCION, CODIGO, LEY, REGLAMENTO"
    string ambito "FEDERAL, ESTATAL, MUNICIPAL"
    bigint autoridad_emisora_id FK
    date fecha_expedicion
    date fecha_publicacion_original
    string estado_documental "VIGENTE, ABROGADO, PARCIAL, HISTORICO"
    string identificador_oficial
}

UNIDAD_NORMATIVA {
    bigint unidad_id PK
    bigint ordenamiento_id FK
    bigint unidad_padre_id FK "Jerarquia recursiva"
    string tipo_unidad "LIBRO, TITULO, CAPITULO, ARTICULO, FRACCION"
    string clave_visible "Ej. 47 Bis, II, a)"
    string denominacion "Titulo o rubro de la unidad"
    decimal secuencia "Orden tecnico, no numero juridico"
    bool es_transitoria
    bool admite_texto
}

UNIDAD_VERSION {
    bigint unidad_version_id PK
    bigint unidad_id FK
    bigint instrumento_origen_id FK "Instrumento que origina esta version"
    int numero_version
    string encabezado
    text texto
    date vigencia_desde
    date vigencia_hasta
    string estado_juridico "VIGENTE, DEROGADA, INVALIDADA, HISTORICA"
    string hash_texto
}

INSTRUMENTO_JURIDICO {
    bigint instrumento_id PK
    bigint autoridad_id FK
    string tipo_instrumento "EXPEDICION, REFORMA, ACUERDO, SENTENCIA"
    string numero
    string titulo
    date fecha_emision
    date fecha_efectos_general
    string estado
}

INSTRUMENTO_PUBLICACION {
    bigint instrumento_publicacion_id PK
    bigint instrumento_id FK
    bigint publicacion_id FK
    string tipo_aparicion "PRINCIPAL, ERRATA, ACLARACION, ANEXO"
    string pagina_inicio
    string pagina_fin
}

AFECTACION_NORMATIVA {
    bigint afectacion_id PK
    bigint instrumento_id FK
    bigint ordenamiento_id FK
    bigint unidad_id FK "Null si afecta al ordenamiento completo"
    bigint version_anterior_id FK
    bigint version_nueva_id FK
    string tipo_cambio "EXPIDE, ADICIONA, REFORMA, DEROGA, INVALIDA"
    text descripcion_cambio
    string alcance "TOTAL, PARCIAL, PORCION_NORMATIVA"
}

RELACION_NORMATIVA {
    bigint relacion_normativa_id PK
    bigint ordenamiento_origen_id FK
    bigint ordenamiento_destino_id FK
    bigint unidad_origen_id FK
    bigint unidad_destino_id FK
    string tipo_relacion "SUSTITUYE, REGLAMENTA, SUPLE, COMPLEMENTA"
    date vigencia_desde
    date vigencia_hasta
    text observaciones
}

VIGENCIA_APLICABILIDAD {
    bigint vigencia_id PK
    bigint ordenamiento_id FK
    bigint unidad_id FK "Null si aplica al ordenamiento completo"
    bigint instrumento_id FK "Fuente de la regla de vigencia"
    string fuero "FEDERAL, LOCAL, CONCURRENTE"
    string supuesto_aplicacion "Descripcion juridica del supuesto"
    date vigencia_desde
    date vigencia_hasta
    string evento_inicio "PUBLICACION, DECLARATORIA, FECHA_FIJA"
    bool aplica_asuntos_iniciados_antes
    text regla_transitoria
    string estado_validacion "CAPTURADO, REVISADO, VALIDADO, PUBLICADO"
}

VIGENCIA_TERRITORIO {
    bigint vigencia_territorio_id PK
    bigint vigencia_id FK
    bigint territorio_id FK
    bool incluye_descendientes "Incluye municipios o demarcaciones inferiores"
}

VIGENCIA_CIRCUNSCRIPCION {
    bigint vigencia_circunscripcion_id PK
    bigint vigencia_id FK
    bigint circunscripcion_id FK
}

%% ----------------------------------------------------------------------------
%% 03. TAXONOMIAS POLIJERARQUICAS Y TIPOS DE ASUNTO
%% ----------------------------------------------------------------------------

TAXONOMIA {
    bigint taxonomia_id PK
    string clave "AREA, MATERIA, PRETENSION, VIA, FUERO, INSTANCIA"
    string nombre
    string descripcion
    bool permite_multiples_padres
    string estado
}

TAXONOMIA_NODO {
    bigint nodo_id PK
    bigint taxonomia_id FK
    string clave
    string nombre
    string descripcion
    decimal orden_visual
    date vigencia_desde
    date vigencia_hasta
    string estado
}

TAXONOMIA_RELACION {
    bigint relacion_id PK
    bigint nodo_padre_id FK
    bigint nodo_hijo_id FK
    string tipo_relacion "ES_SUBTIPO_DE, RELACIONADO_CON, EQUIVALENTE_A"
    int prioridad
    date vigencia_desde
    date vigencia_hasta
}

TIPO_ASUNTO {
    bigint tipo_asunto_id PK
    string clave
    string nombre
    string descripcion
    bool admite_procedimientos_multiples
    date vigencia_desde
    date vigencia_hasta
    string estado
}

TIPO_ASUNTO_RELACION {
    bigint tipo_asunto_relacion_id PK
    bigint tipo_asunto_origen_id FK
    bigint tipo_asunto_destino_id FK
    string tipo_relacion "SUBTIPO, VARIANTE, DERIVADO, COMPATIBLE"
}

TIPO_ASUNTO_CLASIFICACION {
    bigint clasificacion_id PK
    bigint tipo_asunto_id FK
    bigint nodo_id FK
    bool es_principal
    string origen_clasificacion "MANUAL, REGLA, IMPORTACION"
}

ORDENAMIENTO_CLASIFICACION {
    bigint ordenamiento_clasificacion_id PK
    bigint ordenamiento_id FK
    bigint nodo_id FK
    string alcance "PRINCIPAL, SECUNDARIO, SUPLETORIO"
}

VIGENCIA_CLASIFICACION {
    bigint vigencia_clasificacion_id PK
    bigint vigencia_id FK
    bigint nodo_id FK
}
%% ----------------------------------------------------------------------------
%% 04. VARIABLES Y FORMULARIOS DINAMICOS DEL ASUNTO
%% ----------------------------------------------------------------------------

VARIABLE_JURIDICA {
    bigint variable_id PK
    string clave
    string nombre
    string descripcion
    string tipo_dato "BOOLEAN, TEXTO, ENTERO, DECIMAL, FECHA, CATALOGO"
    string entidad_referencia "TERRITORIO, ORGANO, TAXONOMIA_NODO, etc."
    bool permite_multiple
    bool contiene_dato_sensible
    string estado
}

VARIABLE_OPCION {
    bigint opcion_id PK
    bigint variable_id FK
    string valor
    string etiqueta
    decimal orden_visual
    date vigencia_desde
    date vigencia_hasta
}

TIPO_ASUNTO_VARIABLE {
    bigint tipo_asunto_variable_id PK
    bigint tipo_asunto_id FK
    bigint variable_id FK
    bool requerida
    bool visible_inicialmente
    decimal orden_formulario
    string ayuda_usuario
    bigint regla_version_visibilidad_id FK
}

%% ----------------------------------------------------------------------------
%% 05. MOTOR VERSIONADO DE REGLAS Y PERFILES PROCEDIMENTALES
%% ----------------------------------------------------------------------------

REGLA_NEGOCIO {
    bigint regla_id PK
    bigint tipo_asunto_id FK "Null para reglas reutilizables"
    string clave
    string nombre
    string tipo_regla "APLICABILIDAD, TRANSICION, DOCUMENTO, PLAZO, MODULO"
    string descripcion
}

REGLA_VERSION {
    bigint regla_version_id PK
    bigint regla_id FK
    int numero_version
    int prioridad
    date vigencia_desde
    date vigencia_hasta
    string estado_validacion "BORRADOR, REVISION, VALIDADA, PUBLICADA, OBSOLETA"
    bigint aprobada_por_usuario_id FK
    datetime fecha_aprobacion
}

REGLA_GRUPO {
    bigint grupo_id PK
    bigint regla_version_id FK
    bigint grupo_padre_id FK
    string operador_logico "AND, OR, NOT"
    decimal orden_evaluacion
}

REGLA_CONDICION {
    bigint condicion_id PK
    bigint grupo_id FK
    bigint variable_id FK
    string operador "EQ, NEQ, GT, LT, IN, EXISTS, BETWEEN"
    string tipo_valor "LITERAL, VARIABLE, FECHA_SISTEMA, REFERENCIA"
    string valor_texto
    decimal valor_numero
    date valor_fecha
    bigint valor_referencia_id
    decimal orden_evaluacion
}

REGLA_FUNDAMENTO {
    bigint fundamento_id PK
    bigint regla_version_id FK
    bigint unidad_version_id FK
    string tipo_fundamento "DIRECTO, SUPLETORIO, TRANSITORIO, INTERPRETATIVO"
    text justificacion
}

PERFIL_PROCEDIMENTAL {
    bigint perfil_id PK
    string clave
    string nombre
    string descripcion
}

PERFIL_VERSION {
    bigint perfil_version_id PK
    bigint perfil_id FK
    int numero_version
    date vigencia_desde
    date vigencia_hasta
    string estado_validacion
    bigint aprobada_por_usuario_id FK
}

REGLA_RESULTADO {
    bigint resultado_id PK
    bigint regla_version_id FK
    bigint perfil_version_id FK
    string tipo_resultado "SELECCIONAR_PERFIL, DESCARTAR_PERFIL, SOLICITAR_REVISION"
    int puntuacion
    text explicacion
}

%% ----------------------------------------------------------------------------
%% 06. DISENADOR DE FLUJOS BASE Y MODULOS REUTILIZABLES
%% ----------------------------------------------------------------------------

COMPONENTE_FLUJO {
    bigint componente_id PK
    string clave
    string nombre
    string tipo_componente "FLUJO_BASE, MODULO"
    string descripcion
}

COMPONENTE_VERSION {
    bigint componente_version_id PK
    bigint componente_id FK
    int numero_version
    date vigencia_desde
    date vigencia_hasta
    string estado_validacion
    bigint aprobada_por_usuario_id FK
}

PERFIL_COMPONENTE {
    bigint perfil_componente_id PK
    bigint perfil_version_id FK
    bigint componente_version_id FK
    bigint regla_version_id FK "Null si siempre se incluye"
    bigint etapa_ancla_id FK "Null para el flujo base"
    string modo_insercion "BASE, ANTES, DESPUES, PARALELO, REEMPLAZA"
    decimal orden_composicion
    bool obligatorio
}

ETAPA_PLANTILLA {
    bigint etapa_id PK
    bigint componente_version_id FK
    string clave
    string nombre
    string descripcion
    decimal orden_visual
    bool permite_paralelo
    bool es_inicial
    bool es_final
    string color_referencia
}

TRANSICION_PLANTILLA {
    bigint transicion_id PK
    bigint etapa_origen_id FK
    bigint etapa_destino_id FK
    bigint regla_version_id FK "Condicion opcional"
    string evento_disparador
    string nombre
    int prioridad
    bool automatica
}

ROL_OPERATIVO {
    bigint rol_operativo_id PK
    string clave
    string nombre
    string descripcion
}

ACTIVIDAD_PLANTILLA {
    bigint actividad_id PK
    bigint etapa_id FK
    bigint rol_operativo_id FK
    string clave
    string nombre
    text descripcion
    bool obligatoria
    decimal orden_ejecucion
    int duracion_estimada_minutos
    bool genera_tarea
}

REQUISITO_DOD {
    bigint requisito_id PK
    bigint etapa_id FK
    string descripcion
    string tipo_validacion "CHECK, DOCUMENTO, CAMPO, APROBACION, EVENTO"
    bigint variable_id FK
    bigint tipo_documento_id FK
    bool obligatorio
    decimal orden_validacion
}

TIPO_DOCUMENTO {
    bigint tipo_documento_id PK
    string clave
    string nombre
    string descripcion
    bool requiere_firma
    bool requiere_versiones
}

DOCUMENTO_REQUERIDO {
    bigint documento_requerido_id PK
    bigint etapa_id FK
    bigint actividad_id FK
    bigint tipo_documento_id FK
    bigint regla_version_id FK "Condicion opcional"
    bool obligatorio
    string momento "ENTRADA, DURANTE, SALIDA"
    int cantidad_minima
}

REGLA_PLAZO {
    bigint regla_plazo_id PK
    bigint etapa_id FK
    bigint actividad_id FK
    bigint regla_version_id FK "Condicion opcional"
    string evento_inicio "RADICACION, NOTIFICACION, ACUERDO, AUDIENCIA"
    int cantidad
    string unidad "HORAS, DIAS, MESES"
    bool dias_habiles
    string regla_inicio_computo "MISMO_DIA, DIA_SIGUIENTE, HORA_SIGUIENTE"
    string regla_vencimiento
}

ETAPA_FUNDAMENTO {
    bigint etapa_fundamento_id PK
    bigint etapa_id FK
    bigint unidad_version_id FK
    string tipo_fundamento
    text justificacion
}

ACTIVIDAD_FUNDAMENTO {
    bigint actividad_fundamento_id PK
    bigint actividad_id FK
    bigint unidad_version_id FK
    string tipo_fundamento
    text justificacion
}

PLAZO_FUNDAMENTO {
    bigint plazo_fundamento_id PK
    bigint regla_plazo_id FK
    bigint unidad_version_id FK
    text justificacion
}

%% ----------------------------------------------------------------------------
%% 07. OPERACION DEL DESPACHO Y EJECUCION DEL CRM
%% ----------------------------------------------------------------------------

PERSONA {
    bigint persona_id PK
    string tipo_persona "FISICA, MORAL"
    string nombre_o_razon_social
    string identificador_fiscal
    string correo
    string telefono
    string estado
}

ASUNTO {
    bigint asunto_id PK
    bigint tipo_asunto_id FK
    string numero_interno
    string nombre_corto
    date fecha_apertura
    date fecha_cierre
    string estado "PROSPECTO, ACTIVO, SUSPENDIDO, CERRADO"
    string descripcion
}

ASUNTO_PARTE {
    bigint asunto_parte_id PK
    bigint asunto_id FK
    bigint persona_id FK
    string tipo_parte "CLIENTE, ACTOR, DEMANDADO, TERCERO, REPRESENTANTE"
    bool es_cliente
    date vigencia_desde
    date vigencia_hasta
}

ASUNTO_VALOR {
    bigint asunto_valor_id PK
    bigint asunto_id FK
    bigint variable_id FK
    string valor_texto
    decimal valor_numero
    date valor_fecha
    bool valor_booleano
    bigint valor_referencia_id
    datetime capturado_en
    bigint capturado_por_usuario_id FK
}

PROCEDIMIENTO {
    bigint procedimiento_id PK
    bigint asunto_id FK
    bigint procedimiento_padre_id FK "Incidente, recurso o derivado"
    string tipo_procedimiento
    string naturaleza "JUDICIAL, ADMINISTRATIVO, EXTRAJUDICIAL"
    date fecha_inicio
    date fecha_fin
    string estado
}

PROCEDIMIENTO_VALOR {
    bigint procedimiento_valor_id PK
    bigint procedimiento_id FK
    bigint variable_id FK
    string valor_texto
    decimal valor_numero
    date valor_fecha
    bool valor_booleano
    bigint valor_referencia_id
    datetime capturado_en
    bigint capturado_por_usuario_id FK
}

EXPEDIENTE {
    bigint expediente_id PK
    bigint procedimiento_id FK
    bigint organo_id FK
    string numero_expediente
    string folio
    date fecha_presentacion
    date fecha_radicacion
    string estado
}

MARCO_APLICABLE {
    bigint marco_id PK
    bigint procedimiento_id FK
    date fecha_resolucion
    date fecha_juridica_corte
    string estado_validacion "PROPUESTO, REVISADO, VALIDADO, IMPUGNADO"
    bigint validado_por_usuario_id FK
    text explicacion_resultado
}

MARCO_APLICABLE_FUENTE {
    bigint marco_fuente_id PK
    bigint marco_id FK
    bigint unidad_version_id FK
    bigint vigencia_id FK
    bigint regla_version_id FK
    string tipo_aplicacion "DIRECTA, SUPLETORIA, TRANSITORIA, INTERPRETATIVA"
    text justificacion
}

PROCEDIMIENTO_FLUJO {
    bigint procedimiento_flujo_id PK
    bigint procedimiento_id FK
    bigint perfil_version_id FK
    bigint marco_id FK
    datetime fecha_instanciacion
    string estado "ACTIVO, COMPLETADO, CANCELADO, MIGRADO"
    bigint sustituye_flujo_id FK
}

ETAPA_INSTANCIA {
    bigint etapa_instancia_id PK
    bigint procedimiento_flujo_id FK
    bigint etapa_plantilla_id FK
    string nombre_congelado
    decimal orden_congelado
    string estado "PENDIENTE, ACTIVA, BLOQUEADA, COMPLETADA, OMITIDA"
    datetime fecha_inicio
    datetime fecha_fin
}

ETAPA_HISTORIAL {
    bigint etapa_historial_id PK
    bigint etapa_instancia_id FK
    string estado_anterior
    string estado_nuevo
    datetime fecha_cambio
    bigint usuario_id FK
    string motivo
}
TAREA_ASUNTO {
    bigint tarea_id PK
    bigint procedimiento_id FK
    bigint etapa_instancia_id FK
    bigint actividad_plantilla_id FK
    bigint responsable_usuario_id FK
    string nombre_congelado
    text descripcion_congelada
    string estado "PENDIENTE, EN_PROCESO, BLOQUEADA, COMPLETADA, CANCELADA"
    datetime fecha_asignacion
    datetime fecha_limite
    datetime fecha_completada
}

EVENTO_PROCESAL {
    bigint evento_id PK
    bigint procedimiento_id FK
    bigint etapa_instancia_id FK
    string tipo_evento "PRESENTACION, ACUERDO, AUDIENCIA, SENTENCIA, NOTIFICACION"
    string titulo
    text descripcion
    datetime fecha_evento
    bigint registrado_por_usuario_id FK
}

NOTIFICACION_PROCESAL {
    bigint notificacion_id PK
    bigint procedimiento_id FK
    bigint evento_id FK
    bigint persona_destinataria_id FK
    string tipo_notificacion
    datetime fecha_practica
    datetime fecha_efectos
    string medio
    string estado
}

DOCUMENTO_ASUNTO {
    bigint documento_asunto_id PK
    bigint procedimiento_id FK
    bigint etapa_instancia_id FK
    bigint tarea_id FK
    bigint tipo_documento_id FK
    string nombre
    string estado "BORRADOR, REVISION, FIRMADO, PRESENTADO, ADMITIDO"
    datetime fecha_documento
}

DOCUMENTO_VERSION {
    bigint documento_version_id PK
    bigint documento_asunto_id FK
    int numero_version
    string ubicacion_archivo
    string hash_archivo
    bigint cargado_por_usuario_id FK
    datetime fecha_carga
    string observaciones
}

PLAZO_ASUNTO {
    bigint plazo_asunto_id PK
    bigint procedimiento_id FK
    bigint etapa_instancia_id FK
    bigint regla_plazo_id FK
    bigint evento_inicio_id FK
    bigint notificacion_id FK
    bigint calendario_id FK
    datetime fecha_inicio_computo
    datetime fecha_vencimiento_calculada
    datetime fecha_vencimiento_validada
    string estado "PENDIENTE, ATENDIDO, VENCIDO, SUSPENDIDO, CANCELADO"
    bigint validado_por_usuario_id FK
}

%% ----------------------------------------------------------------------------
%% 08. USUARIOS, REVISION JURIDICA, AUDITORIA Y ALERTAS
%% ----------------------------------------------------------------------------

USUARIO {
    bigint usuario_id PK
    string nombre
    string correo
    string estado
}

ROL_SISTEMA {
    bigint rol_sistema_id PK
    string clave
    string nombre
    string descripcion
}

USUARIO_ROL {
    bigint usuario_rol_id PK
    bigint usuario_id FK
    bigint rol_sistema_id FK
    date vigencia_desde
    date vigencia_hasta
}

REVISION_JURIDICA {
    bigint revision_id PK
    string objeto_tipo "ORDENAMIENTO, VIGENCIA, REGLA, PERFIL, COMPONENTE"
    bigint objeto_id
    bigint version_objeto_id
    bigint revisor_usuario_id FK
    string resultado "APROBADO, OBSERVADO, RECHAZADO"
    text comentarios
    datetime fecha_revision
}

BITACORA_CAMBIO {
    bigint bitacora_id PK
    string tabla_afectada
    bigint registro_id
    string operacion "INSERT, UPDATE, DELETE, PUBLICAR, MIGRAR"
    text valor_anterior
    text valor_nuevo
    bigint usuario_id FK
    datetime fecha_cambio
    string motivo
}

ALERTA_NORMATIVA {
    bigint alerta_id PK
    bigint ordenamiento_id FK
    bigint instrumento_id FK
    string tipo_alerta "NUEVA_PUBLICACION, REFORMA, ABROGACION, INVALIDACION"
    string severidad "BAJA, MEDIA, ALTA, CRITICA"
    datetime fecha_deteccion
    string estado "NUEVA, EN_ANALISIS, IMPACTO_CONFIRMADO, CERRADA"
    text resumen
}

ALERTA_IMPACTO {
    bigint alerta_impacto_id PK
    bigint alerta_id FK
    bigint regla_version_id FK
    bigint perfil_version_id FK
    bigint componente_version_id FK
    bigint procedimiento_id FK
    string tipo_impacto "REVISAR, NUEVA_VERSION, MIGRACION_OPCIONAL, MIGRACION_OBLIGATORIA"
    string estado
    text observaciones
}

%% ----------------------------------------------------------------------------
%% RELACIONES: CATALOGOS
%% ----------------------------------------------------------------------------

TERRITORIO ||--o{ TERRITORIO : contiene
TERRITORIO ||--o{ CIRCUNSCRIPCION_TERRITORIO : integra
CIRCUNSCRIPCION_JUDICIAL ||--o{ CIRCUNSCRIPCION_TERRITORIO : cubre
TERRITORIO ||--o{ AUTORIDAD : corresponde_a
AUTORIDAD ||--o{ AUTORIDAD : depende_de
AUTORIDAD ||--o{ ORGANO_JURISDICCIONAL : administra
CIRCUNSCRIPCION_JUDICIAL ||--o{ ORGANO_JURISDICCIONAL : delimita
TERRITORIO ||--o{ MEDIO_OFICIAL : posee
MEDIO_OFICIAL ||--o{ PUBLICACION_OFICIAL : emite
ORGANO_JURISDICCIONAL ||--o{ CALENDARIO_JUDICIAL : utiliza
CIRCUNSCRIPCION_JUDICIAL ||--o{ CALENDARIO_JUDICIAL : comparte
CALENDARIO_JUDICIAL ||--o{ DIA_INHABIL : contiene
CALENDARIO_JUDICIAL ||--o{ SUSPENSION_TERMINOS : registra

%% ----------------------------------------------------------------------------
%% RELACIONES: REPOSITORIO NORMATIVO
%% ----------------------------------------------------------------------------

AUTORIDAD ||--o{ ORDENAMIENTO : expide
ORDENAMIENTO ||--o{ UNIDAD_NORMATIVA : contiene
UNIDAD_NORMATIVA ||--o{ UNIDAD_NORMATIVA : contiene
UNIDAD_NORMATIVA ||--o{ UNIDAD_VERSION : versiona
AUTORIDAD ||--o{ INSTRUMENTO_JURIDICO : emite
INSTRUMENTO_JURIDICO ||--o{ INSTRUMENTO_PUBLICACION : aparece_en
PUBLICACION_OFICIAL ||--o{ INSTRUMENTO_PUBLICACION : contiene
INSTRUMENTO_JURIDICO ||--o{ UNIDAD_VERSION : origina
INSTRUMENTO_JURIDICO ||--o{ AFECTACION_NORMATIVA : produce
ORDENAMIENTO ||--o{ AFECTACION_NORMATIVA : recibe
UNIDAD_NORMATIVA ||--o{ AFECTACION_NORMATIVA : detalla
UNIDAD_VERSION ||--o{ AFECTACION_NORMATIVA : version_anterior
UNIDAD_VERSION ||--o{ AFECTACION_NORMATIVA : version_nueva
ORDENAMIENTO ||--o{ RELACION_NORMATIVA : relacion_origen
ORDENAMIENTO ||--o{ RELACION_NORMATIVA : relacion_destino
UNIDAD_NORMATIVA ||--o{ RELACION_NORMATIVA : unidad_origen
UNIDAD_NORMATIVA ||--o{ RELACION_NORMATIVA : unidad_destino
ORDENAMIENTO ||--o{ VIGENCIA_APLICABILIDAD : posee
UNIDAD_NORMATIVA ||--o{ VIGENCIA_APLICABILIDAD : restringe
INSTRUMENTO_JURIDICO ||--o{ VIGENCIA_APLICABILIDAD : fundamenta
VIGENCIA_APLICABILIDAD ||--o{ VIGENCIA_TERRITORIO : aplica_en
TERRITORIO ||--o{ VIGENCIA_TERRITORIO : delimita
VIGENCIA_APLICABILIDAD ||--o{ VIGENCIA_CIRCUNSCRIPCION : aplica_en
CIRCUNSCRIPCION_JUDICIAL ||--o{ VIGENCIA_CIRCUNSCRIPCION : delimita

%% ----------------------------------------------------------------------------
%% RELACIONES: TAXONOMIAS
%% ----------------------------------------------------------------------------

TAXONOMIA ||--o{ TAXONOMIA_NODO : contiene
TAXONOMIA_NODO ||--o{ TAXONOMIA_RELACION : es_padre
TAXONOMIA_NODO ||--o{ TAXONOMIA_RELACION : es_hijo
TIPO_ASUNTO ||--o{ TIPO_ASUNTO_RELACION : relacion_origen
TIPO_ASUNTO ||--o{ TIPO_ASUNTO_RELACION : relacion_destino
TIPO_ASUNTO ||--o{ TIPO_ASUNTO_CLASIFICACION : clasifica
TAXONOMIA_NODO ||--o{ TIPO_ASUNTO_CLASIFICACION : etiqueta
ORDENAMIENTO ||--o{ ORDENAMIENTO_CLASIFICACION : clasifica
TAXONOMIA_NODO ||--o{ ORDENAMIENTO_CLASIFICACION : etiqueta
VIGENCIA_APLICABILIDAD ||--o{ VIGENCIA_CLASIFICACION : clasifica
TAXONOMIA_NODO ||--o{ VIGENCIA_CLASIFICACION : etiqueta

%% ----------------------------------------------------------------------------
%% RELACIONES: VARIABLES Y MOTOR DE REGLAS
%% ----------------------------------------------------------------------------

VARIABLE_JURIDICA ||--o{ VARIABLE_OPCION : ofrece
TIPO_ASUNTO ||--o{ TIPO_ASUNTO_VARIABLE : solicita
VARIABLE_JURIDICA ||--o{ TIPO_ASUNTO_VARIABLE : configura
REGLA_VERSION ||--o{ TIPO_ASUNTO_VARIABLE : controla_visibilidad
TIPO_ASUNTO ||--o{ REGLA_NEGOCIO : posee
REGLA_NEGOCIO ||--o{ REGLA_VERSION : versiona
REGLA_VERSION ||--o{ REGLA_GRUPO : contiene
REGLA_GRUPO ||--o{ REGLA_GRUPO : anida
REGLA_GRUPO ||--o{ REGLA_CONDICION : evalua
VARIABLE_JURIDICA ||--o{ REGLA_CONDICION : consulta
REGLA_VERSION ||--o{ REGLA_FUNDAMENTO : se_fundamenta
UNIDAD_VERSION ||--o{ REGLA_FUNDAMENTO : sustenta
PERFIL_PROCEDIMENTAL ||--o{ PERFIL_VERSION : versiona
REGLA_VERSION ||--o{ REGLA_RESULTADO : produce
PERFIL_VERSION ||--o{ REGLA_RESULTADO : selecciona
USUARIO ||--o{ REGLA_VERSION : aprueba
USUARIO ||--o{ PERFIL_VERSION : aprueba

%% ----------------------------------------------------------------------------
%% RELACIONES: PLANTILLAS PROCESALES Y COMPONENTES
%% ----------------------------------------------------------------------------

COMPONENTE_FLUJO ||--o{ COMPONENTE_VERSION : versiona
USUARIO ||--o{ COMPONENTE_VERSION : aprueba
PERFIL_VERSION ||--o{ PERFIL_COMPONENTE : compone
COMPONENTE_VERSION ||--o{ PERFIL_COMPONENTE : integra
REGLA_VERSION ||--o{ PERFIL_COMPONENTE : condiciona
ETAPA_PLANTILLA ||--o{ PERFIL_COMPONENTE : sirve_de_ancla
COMPONENTE_VERSION ||--o{ ETAPA_PLANTILLA : contiene
ETAPA_PLANTILLA ||--o{ TRANSICION_PLANTILLA : origen
ETAPA_PLANTILLA ||--o{ TRANSICION_PLANTILLA : destino
REGLA_VERSION ||--o{ TRANSICION_PLANTILLA : condiciona
ETAPA_PLANTILLA ||--o{ ACTIVIDAD_PLANTILLA : contiene
ROL_OPERATIVO ||--o{ ACTIVIDAD_PLANTILLA : responsabiliza
ETAPA_PLANTILLA ||--o{ REQUISITO_DOD : exige
VARIABLE_JURIDICA ||--o{ REQUISITO_DOD : valida_campo
TIPO_DOCUMENTO ||--o{ REQUISITO_DOD : valida_documento
ETAPA_PLANTILLA ||--o{ DOCUMENTO_REQUERIDO : requiere
ACTIVIDAD_PLANTILLA ||--o{ DOCUMENTO_REQUERIDO : genera
TIPO_DOCUMENTO ||--o{ DOCUMENTO_REQUERIDO : tipifica
REGLA_VERSION ||--o{ DOCUMENTO_REQUERIDO : condiciona
ETAPA_PLANTILLA ||--o{ REGLA_PLAZO : define
ACTIVIDAD_PLANTILLA ||--o{ REGLA_PLAZO : dispara
REGLA_VERSION ||--o{ REGLA_PLAZO : condiciona
ETAPA_PLANTILLA ||--o{ ETAPA_FUNDAMENTO : se_fundamenta
ACTIVIDAD_PLANTILLA ||--o{ ACTIVIDAD_FUNDAMENTO : se_fundamenta
REGLA_PLAZO ||--o{ PLAZO_FUNDAMENTO : se_fundamenta
UNIDAD_VERSION ||--o{ ETAPA_FUNDAMENTO : sustenta
UNIDAD_VERSION ||--o{ ACTIVIDAD_FUNDAMENTO : sustenta
UNIDAD_VERSION ||--o{ PLAZO_FUNDAMENTO : sustenta

%% ----------------------------------------------------------------------------
%% RELACIONES: OPERACION DEL CRM
%% ----------------------------------------------------------------------------

TIPO_ASUNTO ||--o{ ASUNTO : tipifica
ASUNTO ||--o{ ASUNTO_PARTE : integra
PERSONA ||--o{ ASUNTO_PARTE : participa
ASUNTO ||--o{ ASUNTO_VALOR : captura
VARIABLE_JURIDICA ||--o{ ASUNTO_VALOR : responde
USUARIO ||--o{ ASUNTO_VALOR : registra
ASUNTO ||--o{ PROCEDIMIENTO : comprende
PROCEDIMIENTO ||--o{ PROCEDIMIENTO_VALOR : captura
VARIABLE_JURIDICA ||--o{ PROCEDIMIENTO_VALOR : responde
USUARIO ||--o{ PROCEDIMIENTO_VALOR : registra
PROCEDIMIENTO ||--o{ PROCEDIMIENTO : deriva_en
PROCEDIMIENTO ||--o{ EXPEDIENTE : identifica
ORGANO_JURISDICCIONAL ||--o{ EXPEDIENTE : conoce
PROCEDIMIENTO ||--o{ MARCO_APLICABLE : resuelve
USUARIO ||--o{ MARCO_APLICABLE : valida
MARCO_APLICABLE ||--o{ MARCO_APLICABLE_FUENTE : contiene
UNIDAD_VERSION ||--o{ MARCO_APLICABLE_FUENTE : aplica
VIGENCIA_APLICABILIDAD ||--o{ MARCO_APLICABLE_FUENTE : delimita
REGLA_VERSION ||--o{ MARCO_APLICABLE_FUENTE : explica
PROCEDIMIENTO ||--o{ PROCEDIMIENTO_FLUJO : ejecuta
PERFIL_VERSION ||--o{ PROCEDIMIENTO_FLUJO : instancia
MARCO_APLICABLE ||--o{ PROCEDIMIENTO_FLUJO : fundamenta
PROCEDIMIENTO_FLUJO ||--o{ PROCEDIMIENTO_FLUJO : sustituye
PROCEDIMIENTO_FLUJO ||--o{ ETAPA_INSTANCIA : genera
ETAPA_PLANTILLA ||--o{ ETAPA_INSTANCIA : origina
ETAPA_INSTANCIA ||--o{ ETAPA_HISTORIAL : registra
USUARIO ||--o{ ETAPA_HISTORIAL : modifica
PROCEDIMIENTO ||--o{ TAREA_ASUNTO : genera
ETAPA_INSTANCIA ||--o{ TAREA_ASUNTO : agrupa
ACTIVIDAD_PLANTILLA ||--o{ TAREA_ASUNTO : origina
USUARIO ||--o{ TAREA_ASUNTO : atiende
PROCEDIMIENTO ||--o{ EVENTO_PROCESAL : registra
ETAPA_INSTANCIA ||--o{ EVENTO_PROCESAL : ocurre_en
USUARIO ||--o{ EVENTO_PROCESAL : registra
PROCEDIMIENTO ||--o{ NOTIFICACION_PROCESAL : recibe
EVENTO_PROCESAL ||--o{ NOTIFICACION_PROCESAL : documenta
PERSONA ||--o{ NOTIFICACION_PROCESAL : destinataria
PROCEDIMIENTO ||--o{ DOCUMENTO_ASUNTO : contiene
ETAPA_INSTANCIA ||--o{ DOCUMENTO_ASUNTO : produce
TAREA_ASUNTO ||--o{ DOCUMENTO_ASUNTO : genera
TIPO_DOCUMENTO ||--o{ DOCUMENTO_ASUNTO : tipifica
DOCUMENTO_ASUNTO ||--o{ DOCUMENTO_VERSION : versiona
USUARIO ||--o{ DOCUMENTO_VERSION : carga
PROCEDIMIENTO ||--o{ PLAZO_ASUNTO : controla
ETAPA_INSTANCIA ||--o{ PLAZO_ASUNTO : contextualiza
REGLA_PLAZO ||--o{ PLAZO_ASUNTO : calcula
EVENTO_PROCESAL ||--o{ PLAZO_ASUNTO : inicia
NOTIFICACION_PROCESAL ||--o{ PLAZO_ASUNTO : produce_efectos
CALENDARIO_JUDICIAL ||--o{ PLAZO_ASUNTO : computa
USUARIO ||--o{ PLAZO_ASUNTO : valida

%% ----------------------------------------------------------------------------
%% RELACIONES: SEGURIDAD, REVISION Y ALERTAS
%% ----------------------------------------------------------------------------

USUARIO ||--o{ USUARIO_ROL : posee
ROL_SISTEMA ||--o{ USUARIO_ROL : asigna
USUARIO ||--o{ REVISION_JURIDICA : realiza
USUARIO ||--o{ BITACORA_CAMBIO : ejecuta
ORDENAMIENTO ||--o{ ALERTA_NORMATIVA : genera
INSTRUMENTO_JURIDICO ||--o{ ALERTA_NORMATIVA : origina
ALERTA_NORMATIVA ||--o{ ALERTA_IMPACTO : produce
REGLA_VERSION ||--o{ ALERTA_IMPACTO : afecta
PERFIL_VERSION ||--o{ ALERTA_IMPACTO : afecta
COMPONENTE_VERSION ||--o{ ALERTA_IMPACTO : afecta
PROCEDIMIENTO ||--o{ ALERTA_IMPACTO : puede_afectar
Open LegalTech - Medios de impugnacion
β˜€οΈ
LegalTech - Medios de impugnacion
04 Aug, 2026v2
erDiagram
%% ═══════════════════════════════════════════════════════════════════════════════
%% Modulo: Medios de ImpugnaciΓ³n
%% Descripcion: CatΓ‘logo jerΓ‘rquico y de profundidad variable de los medios de impugnaciΓ³n reconocidos en la legislaciΓ³n procesal mexicana (civil-familiar, mercantil, penal y constitucional/amparo). A diferencia de la TaxonomΓ­a JurΓ­dica, la profundidad del Γ‘rbol no es uniforme entre ramas, por lo que se modela como estructura autorreferenciada.
%% ═══════════════════════════════════════════════════════════════════════════════

%% Medios de impugnaciΓ³n

MI_MEDIO_IMPUGNACION {
    int mi_medio_impugnacion_id PK
    string mi_nombre "ej. ApelaciΓ³n, Queja, RevisiΓ³n en amparo indirecto"
    string mi_ruta_ids "parent_store, para consultas de ancestros/descendientes"
    int mi_nivel "calculado, profundidad del nodo (0=raΓ­z)"
    int mi_medio_impugnacion_id_padre FK "ondelete restrict"
  }

  MI_MEDIO_IMPUGNACION ||--o{ MI_MEDIO_IMPUGNACION : "Tiene"
Open LegalTech - Marco legal
✏️
LegalTech - Marco legal
04 Aug, 2026v2
erDiagram
%% ═══════════════════════════════════════════════════════════════════════════════
%% Modulo: Marco legal
%% Descripcion: Repositorio estructurado de leyes, cΓ³digos y reglamentos vigentes en MΓ©xico, tanto federales como estatales, con su jerarquΓ­a interna (libros, tΓ­tulos, capΓ­tulos, artΓ­culos), clasificaciΓ³n por materia y su historial de reformas publicadas en el Diario Oficial de la FederaciΓ³n o periΓ³dicos oficiales estatales
%% ═══════════════════════════════════════════════════════════════════════════════

%% Ordenamiento 

  ORDENAMIENTO {
    int ml_ordenamiento_id PK "ej. 1042"
    string ml_nombre "ej. Codigo Civil Federal"
    string ml_siglas "ej. CCF, LFT"
    string ml_tipo "ej. Constitucion, Codigo, Ley, Reglamento"
    string ml_ambito "ej. Federal, Estatal, Municipal"
    int ml_entidad_id FK "null si Federal, ej. 5 o 30"
    date ml_fecha_publicacion "ej. 1928-05-26"
    date ml_fecha_entrada_vigor "puede diferir, ej. 1932-10-01"
    date ml_fecha_abrogacion "null si vigente, ej. 2019-06-14"
    int ml_ordenamiento_sustituto_id FK "ej. null, 1050"
    string ml_dependencia_emisora "ej. Congreso de la Union"
    string ml_url_fuente_oficial "ej. https://dof.gob.mx/..."
  }
  ORDENAMIENTO ||--o| ORDENAMIENTO : sustituido_por
  ORDENAMIENTO ||--o{ DIVISIONES : estructura
  ORDENAMIENTO ||--o{ ARTICULOS : contiene
  ORDENAMIENTO ||--o{ DECRETOS : afectado_por

  DECRETOS {
    int decreto_id PK "ej. 4001"
    int ordenamiento_id FK "ej. 1042"
    string tipo "ej. Expedicion, Reforma, Abrogacion"
    string numero "ej. Decreto 210/2023"
    string medio_publicacion "ej. DOF, Periodico Oficial de Coahuila"
    date fecha_publicacion "ej. 2023-11-14"
    date fecha_entrada_vigor "ej. 2023-11-15"
    string url_publicacion "ej. https://dof.gob.mx/nota_detalle..."
  }
  DECRETOS ||--o{ REFORMAS : detalla
  DECRETOS ||--o{ ARTICULO_VERSIONES : origina

  REFORMAS {
    int reforma_id PK "ej. 3001"
    int decreto_id FK "ej. 4001"
    int division_id FK "null, o 88 si afecto una division"
    int articulo_id FK "null, o 9001 si afecto un articulo"
    string tipo_cambio "ej. Adicion, Modificacion, Derogacion"
    string referencia_especifica "null, ej. fraccion II, parrafo tercero"
    text descripcion_cambio "ej. Se reforma la fraccion II del articulo 47"
  }
Open LegalTech - Entidades federativas
πŸ”·
LegalTech - Entidades federativas
04 Aug, 2026
erDiagram
%% ═══════════════════════════════════════════════════════════════════════════════
%% Modulo: Entidades federativas
%% Descripcion: MΓ³dulo que contiene todas las entidades federativas del pais utilizando normativas internacionales y nacionales para su definicion
%% ═══════════════════════════════════════════════════════════════════════════════

%% Entidades federativas

  EF_PAIS {
    int ef_pais_id PK
    string ef_nombre
    string ef_codigo_iso_alfa_3 "ej. MEX, USA, ESP"
  }

  EF_ESTADO {
        int ef_estado_id PK
        string ef_nombre
        bool ef_es_capital "Capital del pais"
        string ef_clave_inegi "ej. 01, 02, 03"
        int ef_pais_id FK
  }

  EF_MUNICIPIO {
    int ef_municipio_id PK
    string ef_nombre
    bool ef_es_capital "Capital del estado"
    string ef_clave_inegi "ej. 001, 002, 003"
    int ef_estado_id FK
  }

  EF_PAIS ||--o{ EF_ESTADO : "Tiene"
  EF_ESTADO ||--o{ EF_MUNICIPIO : "Tiene"
Open LegalTech - Taxonomia Juridica
πŸ—‚οΈ
LegalTech - Taxonomia Juridica
04 Aug, 2026
erDiagram
%% ═══════════════════════════════════════════════════════════════════════════════
%% Modulo: TaxonomΓ­a JurΓ­dica
%% Descripcion: Módulo que contiene la clasificación jerÑrquica de la materia jurídica en 5 niveles: Rama > Área > Categoría > Tipo > Modalidad. Ej. Derecho Privado / Civil (Familiar) / Relaciones Conyugales y Pareja / Divorcio / Divorcio Voluntario
%% ═══════════════════════════════════════════════════════════════════════════════

%% TaxonomΓ­a jurΓ­dica

  TJ_RAMA {
    int tj_rama_id PK
    string tj_nombre "ej. PΓΊblico, Privado, Social"
  }

  TJ_AREA {
    int tj_area_id PK
    string tj_nombre "ej. Civil (Familiar), Mercantil, Comercial"
    int tj_rama_id FK
  }

  TJ_CATEGORIA {
    int tj_categoria_id PK
    string tj_nombre "ej. Relaciones Conyugales y Pareja"
    int tj_area_id FK
  }

  TJ_TIPO {
    int tj_tipo_id PK
    string tj_nombre "ej. Divorcio, Matrimonio"
    int tj_categoria_id FK
  }

  TJ_MODALIDAD {
    int tj_modalidad_id PK
    string tj_nombre "ej. Divorcio Voluntario, Divorcio Incausado, Divorcio Administrativo"
    int tj_tipo_id FK
  }

  TJ_RAMA ||--o{ TJ_AREA : "Tiene"
  TJ_AREA ||--o{ TJ_CATEGORIA : "Tiene"
  TJ_CATEGORIA ||--o{ TJ_TIPO : "Tiene"
  TJ_TIPO ||--o{ TJ_MODALIDAD : "Tiene"
Open LegalTech - Entidades de contacto
✨
LegalTech - Entidades de contacto
04 Aug, 2026
erDiagram
%% ═══════════════════════════════════════════════════════════════════════════════
%% Modulo: EC - Entidades de Contacto
%% Descripcion: Modulo que centraliza personas, empresas e instituciones con datos
%% de contacto (clientes, abogados, juzgados, funcionarios judiciales).    
%% res.partner es la entidad central; las tablas satelite EC_ solo agregan campos %% estructurales propios, nunca duplican datos de contacto ya existentes en 
%% res.partner. Los datos especificos de abogado viven en EC_ABOGADO (1:1 con
%% partner_id), no en res.partner, para mantener el modulo nativo de Odoo lo mas %% intacto posible.
%% ═══════════════════════════════════════════════════════════════════════════════

  RES_PARTNER {
    int id PK
    int parent_id
    int asuntos_id
    string name
    bool is_company "Persona, Empresa"
    string email
    string phone
    string vat "(RFC)"
  }

  EC_ABOGADO {
    int ec_abogado_id PK
    int partner_id FK "res.partner requerido, unico - 1 registro por abogado"
    string ec_cedula_profesional
    selection ec_nivel_abogado "jr|ssr|sr|socio"
    selection ec_relacion_abogado "interno|externo"
    int ec_user_id FK "res.users, solo si es abogado interno con acceso al sistema"
    bool active
  }

  EC_JUZGADO {
    int ec_juzgado_id PK
    int partner_id FK "res.partner requerido. Ej: 'Juzgado Primero de lo Familiar de Saltillo'"
    string ec_code "Clave interna. Ej: 'JZDF-SAL-01'"
    int state_id FK "res.country.state MX"
    bool ec_es_federal "auto populado segun tipo de juzgado"
    text ec_notas
    bool active
    int company_id FK "res.company"
  }

  EC_FUNCIONARIO_JUDICIAL {
    int ec_funcionario_judicial_id PK
    int ec_juzgado_id FK "ec.juzgado requerido ondelete cascade"
    int partner_id FK "res.partner requerido"
    selection ec_cargo "juez|magistrado|secretario_acuerdos|actuario|notificador"
    string ec_cedula_profesional "override local, solo si difiere de la del abogado (si aplica)"
    date ec_fecha_adscripcion
    bool active
  }

  RES_PARTNER_CATEGORY {
    int id PK
    string name "Ej: 'Perito Valuador', 'Aseguradora GNP', 'Notaria Publica 12'"
    selection ec_rol_tipo "especialidad_perito|etiqueta_parte|tipo_institucion"
  }

  RES_COUNTRY_STATE {
    int id PK
    string name
    string code
    int country_id FK "res.country"
    int lf_calendario_judicial_id FK "resource.calendar - pertenece a LF, no EC"
  }

  RES_USERS {
    int id PK
    int partner_id FK "res.partner"
    string login
  }

  RES_COMPANY {
    int id PK
    string name
  }

  %% ---- Referencia externa (modulo LF, fuera de alcance EC) ----
  LF_PARTE_PROCESAL

  EC_ABOGADO }o--|| RES_PARTNER : "Es"
  EC_ABOGADO }o--o| RES_USERS : "Vinculado a"
  RES_PARTNER }o--|| RES_COMPANY : "Pertenece a"
  RES_PARTNER }o--o{ RES_PARTNER_CATEGORY : "Clasificado en"
  EC_JUZGADO }o--|| RES_PARTNER : "Es"
  EC_JUZGADO }o--|| RES_COUNTRY_STATE : "Ubicado en"
  EC_JUZGADO }o--|| RES_COMPANY : "Pertenece a"
  EC_FUNCIONARIO_JUDICIAL }o--|| EC_JUZGADO : "Adscrito a"
  EC_FUNCIONARIO_JUDICIAL }o--|| RES_PARTNER : "Es"
  LF_PARTE_PROCESAL }o--|| RES_PARTNER : "Participa como (contacto_id, definicion en modulo LF)"
  LF_PARTE_PROCESAL }o--o| EC_ABOGADO : "Representado por (abogado_id, definicion en modulo LF)"

%%task 1: Mantener la relacion con asuntos
Open LegalTec CRM (Etapas)
πŸŽͺ
LegalTec CRM (Etapas)
22 Jul, 2026
flowchart TD
    START([Prospecto llega: referido, bΓΊsqueda o marketing]) --> R1[Registrar datos de contacto]

    R1 --> D1{"ΒΏDatos completos, motivo\nidentificado y Γ‘rea coincide?"}
    D1 -- No --> P1[Perdido: datos insuficientes / no aplica]
    D1 -- SΓ­ --> E1([Etapa: Consulta agendada])

    E1 --> R2[Realizar consulta inicial]
    R2 --> D2{"ΒΏConsulta realizada, documentos\nrecibidos y sin conflicto de interΓ©s?"}
    D2 -- No --> P2[Perdido: conflicto de interΓ©s / sin info]
    D2 -- SΓ­ --> E2([Etapa: AnΓ‘lisis de viabilidad])

    E2 --> R3[Evaluar el caso internamente]
    R3 --> D3{"ΒΏCaso viable, honorarios\ndefinidos y plazos revisados?"}
    D3 -- No --> P3[Perdido: caso no procede legalmente]
    D3 -- SΓ­ --> E3([Etapa: Propuesta enviada])

    E3 --> R4[Enviar propuesta formal]
    R4 --> D4{"ΒΏPropuesta enviada y cliente\nacepto condiciones?"}
    D4 -- No --> P4[Perdido: no acepto honorarios / sin respuesta]
    D4 -- SΓ­ --> E4([Etapa: Firma de contrato])

    E4 --> R5[Preparar y enviar contrato]
    R5 --> D5{"ΒΏContrato firmado y\npago inicial recibido?"}
    D5 -- No --> P5[Perdido: no firmo / no pago anticipo]
    D5 -- SΓ­ --> WIN([Ganado: se convierte en cliente])

    P1 --> END_LOST([Fin: registrar motivo de pΓ©rdida])
    P2 --> END_LOST
    P3 --> END_LOST
    P4 --> END_LOST
    P5 --> END_LOST

    WIN --> END_WIN([Fin: alta de expediente])

    style WIN fill:#a8e6a1,stroke:#2f7a2f
    style END_WIN fill:#a8e6a1,stroke:#2f7a2f
    style P1 fill:#f5a1a1,stroke:#8a1f1f
    style P2 fill:#f5a1a1,stroke:#8a1f1f
    style P3 fill:#f5a1a1,stroke:#8a1f1f
    style P4 fill:#f5a1a1,stroke:#8a1f1f
    style P5 fill:#f5a1a1,stroke:#8a1f1f
    style END_LOST fill:#f5a1a1,stroke:#8a1f1f
Open Untitled Diagram
✨
Untitled Diagram
12 Jun, 2026
erDiagram
    VENTA_ODOO ||--o| CUENTA_POR_CLIENTE : "origina"
    CLIENTE    ||--o{ CUENTA_POR_CLIENTE : "tiene"
    ASUNTO     ||--|| CUENTA_POR_CLIENTE : "corresponde a"
    MODALIDAD_COBRO ||--o{ CUENTA_POR_CLIENTE : "define plan de"
    RES_USERS ||--o{ CUENTA_POR_CLIENTE : "abogado responsable"
    CUENTA_POR_CLIENTE ||--o{ CARGO_CREDITO : "contiene"
    CUENTA_POR_CLIENTE ||--o{ VENCIMIENTO : "programa"
    CUENTA_POR_CLIENTE ||--o{ SALDO_HISTORIAL : "registra"
    CONCEPTO ||--o{ CARGO_CREDITO : "clasifica"
    FORMA_PAGO ||--o{ CARGO_CREDITO : "se paga con"
    CARGO_CREDITO ||--o{ CARGO_CREDITO : "credito aplica a cargo"
    VENCIMIENTO ||--o{ CARGO_CREDITO : "se salda con"
    CARGO_CREDITO ||--o{ SALDO_HISTORIAL : "genera"
    CARGO_CREDITO ||--o{ NOTIFICACION : "dispara"
    CARGO_CREDITO ||--o{ ARCHIVO_ADJUNTO : "tiene comprobante"
    RES_USERS ||--o{ CARGO_CREDITO : "recibe / registra"
    RES_USERS ||--o{ NOTIFICACION : "recibe"

    VENTA_ODOO {
        int id PK
        int partner_id FK
        int asunto_id FK
        decimal total_convenido
        string termino_pago
        boolean requiere_factura
        string moneda
    }

    CLIENTE {
        int id PK
        string nombre
        string apodo
        string telefono
    }

    ASUNTO {
        int id PK
        string nombre
        string actor
        string demandado
        string folio
        int stage_id FK
    }

    CUENTA_POR_CLIENTE {
        int id PK
        int cliente_id FK
        int asunto_id FK
        int venta_odoo_id FK
        int modalidad_id FK
        int abogado_responsable_id FK
        string alias
        decimal saldo_actual
        date fecha_inicio_convenio
        boolean confidencial
        datetime fecha_ultima_actualizacion
    }

    CARGO_CREDITO {
        int id PK
        int cuenta_id FK
        enum tipo
        decimal monto
        date fecha
        int concepto_id FK
        int forma_pago_id FK
        int cargo_relacionado_id FK
        int vencimiento_id FK
        int recibido_por_id FK
        int registrado_por_id FK
        string referencia
    }

    CONCEPTO {
        int id PK
        string nombre
        enum tipo
        string descripcion
    }

    FORMA_PAGO {
        int id PK
        string nombre
    }

    MODALIDAD_COBRO {
        int id PK
        string nombre
        string descripcion
        int num_parcialidades
        boolean requiere_anticipo
        decimal porcentaje_anticipo
    }

    VENCIMIENTO {
        int id PK
        int cuenta_id FK
        int num_etapa
        decimal monto_esperado
        date fecha_vencimiento
        enum estatus
    }

    SALDO_HISTORIAL {
        int id PK
        int cuenta_id FK
        int cargo_credito_id FK
        decimal saldo_anterior
        decimal saldo_nuevo
        datetime fecha
        int usuario_id FK
    }

    NOTIFICACION {
        int id PK
        int cargo_credito_id FK
        int usuario_destino_id FK
        enum tipo
        enum canal
        string mensaje
        datetime fecha
        boolean leida
    }

    ARCHIVO_ADJUNTO {
        int id PK
        int cargo_credito_id FK
        string nombre_archivo
        string tipo_mime
        string ruta_almacenamiento
        datetime fecha_subida
        int subido_por_id FK
    }

    RES_USERS {
        int id PK
        string nombre
        string email
        boolean es_socio
        int rol_id FK
    }

    ROL {
        int id PK
        string nombre
        int nivel_acceso
    }
Open Untitled Diagram
πŸ”Έ
Untitled Diagram
09 Jun, 2026
%%{init: {"themeVariables": {"fontSize": "14px"}}}%%
flowchart TD
  %%{flowchart: {layout: "elk"}}%%

  subgraph Customer["Customer"]
    A["Place Order"]
    B["Receive Order Confirmation"]
  end

  subgraph Amazon_System["Amazon System"]
    C["Start Order Processing"]
    subgraph Parallel_Checks["Parallel Subprocess: Validation & Inventory"]
      direction TB
      C1["Validate Payment"]
      C2["Check Inventory"]
    end
    D{"All Checks Passed?"}
    E["Send Out-of-Stock or Payment Failure Notification"]
    F["Forward Order to Fulfillment Center"]
  end

  subgraph Fulfillment_Center["Fulfillment Center"]
    H["Pick Items from Inventory"]
    I["Pack Items"]
    J["Generate Shipping Label"]
    K["Hand Over Package to Courier"]
  end

  subgraph Courier["Courier / Delivery Partner"]
    L["Transport Package"]
    M["Attempt Delivery"]
    N{"Delivery Successful?"}
    O["Update Tracking: Delivered"]
    P["Update Tracking: Delivery Failed"]
    Q["Return Package to Fulfillment Center"]
  end

  %% Flows
  A --> B
  B --> C
  C --> C1 & C2
  C1 --> D
  C2 --> D
  D -->|No| E
  D -->|Yes| F
  F --> H
  H --> I
  I --> J
  J --> K
  K --> L
  L --> M
  M --> N
  N -->|Yes| O
  N -->|No| P
  P --> Q

  %% Simulate timing dependency
  C1 -. "within 10s" .-> D
  C2 -. "within 5s" .-> D
  H -. "Estimated 15-30 min" .-> I
  L -. "1–2 days" .-> M

  %% Colors
  classDef customer stroke:#818cf8,fill:#eef2ff;
  classDef system stroke:#2dd4bf,fill:#f0fdfa;
  classDef fulfillment stroke:#a78bfa,fill:#f5f3ff;
  classDef courier stroke:#fb923c,fill:#fff7ed;

  class Customer customer;
  class Amazon_System system;
  class Fulfillment_Center fulfillment;
  class Courier courier;