|
|
import streamlit as st
|
|
|
import streamlit.components.v1 as components
|
|
|
from banco import SessionLocal
|
|
|
from models import LogAcesso
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def registrar_auditoria(acao):
|
|
|
db = SessionLocal()
|
|
|
try:
|
|
|
db.add(LogAcesso(
|
|
|
usuario=st.session_state.get("usuario", "desconhecido"),
|
|
|
acao=acao,
|
|
|
tabela="bi",
|
|
|
data_hora=datetime.now()
|
|
|
))
|
|
|
db.commit()
|
|
|
finally:
|
|
|
db.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
st.title("π Business Intelligence")
|
|
|
|
|
|
st.caption("Indicadores e dashboards oficiais")
|
|
|
|
|
|
|
|
|
registrar_auditoria("ACESSO_BI")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dashboards = {
|
|
|
"π Performance Operacional": {
|
|
|
"url": "https://app.powerbi.com/view?r=SEU_LINK_AQUI",
|
|
|
"height": 800
|
|
|
},
|
|
|
"π Qualidade e Erros": {
|
|
|
"url": "https://app.powerbi.com/view?r=SEU_LINK_AQUI",
|
|
|
"height": 800
|
|
|
},
|
|
|
"π¦ Produtividade FPSO": {
|
|
|
"url": "https://app.powerbi.com/view?r=SEU_LINK_AQUI",
|
|
|
"height": 900
|
|
|
}
|
|
|
}
|
|
|
|
|
|
opcao = st.selectbox("Selecione o Dashboard", dashboards.keys())
|
|
|
|
|
|
dash = dashboards[opcao]
|
|
|
|
|
|
st.divider()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
components.html(
|
|
|
f"""
|
|
|
<iframe
|
|
|
width="100%"
|
|
|
height="{dash['height']}"
|
|
|
src="{dash['url']}"
|
|
|
frameborder="0"
|
|
|
allowfullscreen="true">
|
|
|
</iframe>
|
|
|
""",
|
|
|
height=dash["height"] + 20
|
|
|
)
|
|
|
|