Ir para o conteúdo

Predefinição:Tabela3: mudanças entre as edições

De Normas Regulamentadoras
Sem resumo de edição
Sem resumo de edição
 
(16 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
# Definição das cores baseadas na legenda da NR 03
<!--  NR 03 Origem 0 Item 3.4.4-->
cor_n = "#cccccc" # Nenhum (Cinza)
{| class="wikitable" style="width: 100%; text-align: center;"
cor_p = "#38761d" # Pequeno (Verde)
|-
cor_m = "#ffff00" # Moderado (Amarelo)
| rowspan="11" style="vertical-align: middle; writing-mode: vertical-rl; transform: rotate(180deg);" | Classificação do risco atual <br> (situação encontrada)
cor_s = "#e67e22" # Substancial (Laranja)
! Consequência
cor_e = "#ff0000" # Extremo (Vermelho)
! Probabilidade
! colspan="13" |
|-
| Nenhuma
| Rara
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
|-
| rowspan="3"| Leve
| Remota
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #38761d;" | P
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #38761d;" | P
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #38761d;" | P
|-


# Função auxiliar para criar célula colorida
| Possível
def celula(valor, cor, cor_texto="#000000"):
| style="background-color: #cccccc;" | N
    return f'<td style="border: 1px solid #000000; padding: 4px; background-color: {cor}; color: {cor_texto}; font-weight: bold;">{valor}</td>'
| style="background-color: #cccccc;" | N
| style="background-color: #38761d;" | P
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #38761d;" | P
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #38761d;" | P
| style="background-color: #38761d;" | P
|-


# Estrutura dos dados da tabela (linhas de conteúdo)
| Provável
# Formato: [Consequência, Probabilidade, [Lista de 12 células de valores]]
| style="background-color: #cccccc;" | N
dados = [
| style="background-color: #cccccc;" | N
    ["Nenhuma", "Rara", ["N", "N", "N", "N", "N", "N", "N", "P", "N", "N", "N", "P"]],
| style="background-color: #ffff00;" | M
    ["Leve", "Remota", ["N", "N", "P", "N", "N", "N", "P", "N", "N", "N", "P", "P"]],
|
    ["Leve", "Possível", ["N", "N", "P", "N", "N", "N", "P", "N", "N", "P", "P", "P"]],
| style="background-color: #cccccc;" | N
    ["Leve", "Provável", ["N", "N", "M", "N", "N", "N", "M", "N", "P", "M", "M", "M"]],
| style="background-color: #cccccc;" | N
    ["Significativa", "Remota", ["N", "N", "M", "N", "N", "N", "M", "P", "M", "M", "M", "M"]],
| style="background-color: #cccccc;" | N
    ["Significativa", "Possível", ["N", "N", "M", "N", "N", "M", "M", "M", "M", "M", "M", "M"]],
| style="background-color: #ffff00;" | M
    ["Significativa", "Provável", ["N", "N", "S", "N", "M", "M", "S", "M", "M", "M", "S", "S"]],
|
    ["Morte/Severa", "Remota", ["N", "N", "S", "M", "M", "M", "S", "M", "M", "S", "S", "S"]],
| style="background-color: #cccccc;" | N
    ["Morte/Severa", "Possível", ["N", "M", "E", "M", "S", "S", "E", "S", "S", "S", "E", "E"]],
| style="background-color: #cccccc;" | N
    ["Morte/Severa", "Provável", ["S", "S", "E", "S", "S", "S", "E", "S", "S", "E", "E", "E"]]
| style="background-color: #ffff00;" | M
]
| style="background-color: #ffff00;" | M
|-
| rowspan="3"|Significativa
| Remota
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #ffff00;" | M
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #ffff00;" | M
|
| style="background-color: #38761d;" | P
| style="background-color: #38761d;" | P
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
|-
| Possível
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #ffff00;" | M
|
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
|
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
|-
| Provável
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #e67e22;" | S
|
| style="background-color: #cccccc;" | N
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #e67e22;" | S
|
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #e67e22;" | S
|-
| rowspan="3"|Morte/Severa
| Remota
| style="background-color: #cccccc;" | N
| style="background-color: #cccccc;" | N
| style="background-color: #e67e22;" | S
|
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #e67e22;" | S
|
| style="background-color: #ffff00;" | M
| style="background-color: #ffff00;" | M
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
|-
| Possível
| style="background-color: #cccccc;" | N
| style="background-color: #ffff00;" | M
| style="background-color: #ff0000;" | E
|
| style="background-color: #ffff00;" | M
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #ff0000;" | E
|
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #ff0000;" | E
|-
| Provável
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #ff0000;" | E
|
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #ff0000;" | E
|
| style="background-color: #e67e22;" | S
| style="background-color: #e67e22;" | S
| style="background-color: #ff0000;" | E
| style="background-color: #ff0000;" | E
|-
| style="border: none;" |
| colspan="2" | Probabilidade de referência
| style="writing-mode: vertical-lr;" | Possível
| style="writing-mode: vertical-lr;" | Remota
| style="writing-mode: vertical-lr;" | Rara
|
| style="writing-mode: vertical-lr;" | Provável
| style="writing-mode: vertical-lr;" | Possível
| style="writing-mode: vertical-lr;" | Remota
| style="writing-mode: vertical-lr;" | Rara
|
| style="writing-mode: vertical-lr;" | Provável
| style="writing-mode: vertical-lr;" | Possível
| style="writing-mode: vertical-lr;" | Remota
| style="writing-mode: vertical-lr;" | Rara
|-
| style="border: none;" |
| colspan="2" | Consequência de referência
| colspan="3" | Morte/Severa
|
| colspan="4" | Significativa
|
| colspan="4" | Leve/Nenhuma
|-
| style="border: none;" |
| colspan="15" | Classificação do risco de referência <br> (situação objetivo)


# Mapeamento de cores para os valores
|}
mapa_cores = {"N": cor_n, "P": cor_p, "M": cor_m, "S": cor_s, "E": cor_e}
mapa_texto = {"P": "#ffffff", "E": "#ffffff"} # Cores de fonte para melhor contraste
 
# Início do HTML
html = ['<table class="wikitable" style="width: 100%; border-collapse: collapse; font-family: sans-serif; font-size: 11px; text-align: center;">']
 
# Cabeçalhos Complexos
html.append('<tr><th rowspan="2" colspan="2" style="border: 1px solid #000000;">Consequência / Probabilidade</th><th colspan="4" style="border: 1px solid #000000;">Rara</th><th colspan="4" style="border: 1px solid #000000;">Remota</th><th colspan="4" style="border: 1px solid #000000;">Possível</th></tr>')
html.append('<tr>')
for _ in range(3): # Repete 3 vezes o cabeçalho de probabilidade
    html.append('<th style="border: 1px solid #000000;">Provável</th><th style="border: 1px solid #000000;">Possível</th><th style="border: 1px solid #000000;">Remota</th><th style="border: 1px solid #000000;">Rara</th>')
html.append('</tr>')
 
# Linhas de Dados
for linha in dados:
    html.append('<tr>')
    html.append(f'<td style="border: 1px solid #000000; font-weight: bold;">{linha[0]}</td>')
    html.append(f'<td style="border: 1px solid #000000;">{linha[1]}</td>')
    for val in linha[2]:
        c = mapa_cores.get(val, "#ffffff")
        ct = mapa_texto.get(val, "#000000")
        html.append(celula(val, c, ct))
    html.append('</tr>')
 
html.append('</table>')
 
with open("tabela_nr03_completa.txt", "w", encoding="utf-8") as f:
    f.write("\n".join(html))

Edição atual tal como às 09h47min de 28 de julho de 2026

Classificação do risco atual
(situação encontrada)
Consequência Probabilidade
Nenhuma Rara N N N N N N N N N N N
Leve Remota N N P N N N P N N N P
Possível N N P N N N P N N P P
Provável N N M N N N M N N M M
Significativa Remota N N M N N N M P P M M
Possível N N M N N M M M M M M
Provável N N S N M M S M M M S
Morte/Severa Remota N N S M M M S M M S S
Possível N M E M S S E S S S E
Provável S S E S S S E S S E E
Probabilidade de referência Possível Remota Rara Provável Possível Remota Rara Provável Possível Remota Rara
Consequência de referência Morte/Severa Significativa Leve/Nenhuma
Classificação do risco de referência
(situação objetivo)