Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e48d951
chore: testando esteira CI/CD
brndnaxr Sep 12, 2025
1ca9f9d
chore: teste de integracao
brndnaxr Sep 12, 2025
1472e59
chore
brndnaxr Sep 12, 2025
1d26e31
chore
brndnaxr Sep 12, 2025
bfe1d4b
chore
brndnaxr Sep 12, 2025
929453e
chore
brndnaxr Sep 12, 2025
6816f71
feature: add login
brndnaxr Sep 12, 2025
e78d757
feature: add new pages and style
brndnaxr Sep 12, 2025
c2ca4aa
sec: add style login form
brndnaxr Sep 12, 2025
a02bbb1
chore
brndnaxr Sep 12, 2025
57eb762
feature: new updates
brndnaxr Sep 13, 2025
9d7568e
page: Aprovacao completa
brndnaxr Sep 13, 2025
fd91bd6
chore
brndnaxr Sep 13, 2025
386f670
feature: batch of updates
brndnaxr Sep 13, 2025
5db7c5f
chore
brndnaxr Sep 13, 2025
204884e
chore
brndnaxr Sep 15, 2025
264a2cc
feature: db functionality with n8n
brndnaxr Sep 21, 2025
b799621
features
brndnaxr Sep 21, 2025
36c1183
update: libs
brndnaxr Sep 21, 2025
498de9e
upgrade: python to 3.12
brndnaxr Sep 21, 2025
9cca054
chore
brndnaxr Sep 21, 2025
a17ddbc
chore: many modifications
brndnaxr Oct 2, 2025
b1e7a2b
chore
brndnaxr Oct 4, 2025
cacb83a
feature: envio de mensagens em massa v0
brndnaxr Oct 13, 2025
ae90c7d
chore
brndnaxr Oct 13, 2025
41dc5ef
chore
brndnaxr Oct 13, 2025
0a22d37
update pages
brndnaxr Oct 13, 2025
acac9e8
update pages
brndnaxr Oct 13, 2025
d3ff107
update pages
brndnaxr Oct 13, 2025
42eb4eb
update pages
brndnaxr Oct 13, 2025
643a45e
update pages
brndnaxr Oct 13, 2025
cca986f
update pages
brndnaxr Oct 13, 2025
e393e72
update pages
brndnaxr Oct 13, 2025
de7e751
update pages
brndnaxr Oct 13, 2025
bdb0782
webhook disparo em massa de producao
brndnaxr Oct 13, 2025
ba955e8
pagina confirmacao melhorada
brndnaxr Oct 13, 2025
da7f617
pagina confirmacao melhorada
brndnaxr Oct 13, 2025
6b797cf
pagina confirmacao melhorada
brndnaxr Oct 13, 2025
6735e5b
feature: extrair PDF acupuntura
brndnaxr Oct 15, 2025
5a5907e
(page) update agenda do dia e confirmacao
brndnaxr Oct 22, 2025
51f2f5f
Removendo pasta scripts do controle de versão
brndnaxr Oct 25, 2025
6d88b4d
update main
brndnaxr Oct 25, 2025
f4e3097
sumarized version
brndnaxr Oct 30, 2025
7d1b425
chore: main
brndnaxr Oct 30, 2025
1cd077c
feature: new version published
brndnaxr Nov 17, 2025
084f74b
chore
brndnaxr Nov 17, 2025
3b407e4
new attempt
brndnaxr Nov 18, 2025
874713c
agora o menu ta funcionando
brndnaxr Nov 18, 2025
54f62dd
chore
brndnaxr Nov 18, 2025
8feddb2
chore
brndnaxr Nov 24, 2025
0958375
feature: adicionado confirmacoes de acupuntura e rpg
brndnaxr Dec 8, 2025
f1bf03d
feat: add temporary editing and save functionality for patient select…
brndnaxr Feb 27, 2026
ac855a1
feat: add process_and_clean_autorizacao function and update confirmat…
brndnaxr Feb 27, 2026
4aa43ab
chore: push previous changes to prod
brndnaxr Feb 27, 2026
9de69ae
chore: ensure openpyxl is included in requirements.txt
brndnaxr Feb 27, 2026
f498c09
feat: enhance process_and_clean_autorizacao to dynamically identify p…
brndnaxr Mar 2, 2026
182c9d6
feat: refactor process_and_clean_autorizacao to improve data processi…
brndnaxr Mar 4, 2026
f302e5b
feat: add test_baserow_connection function to validate Baserow API in…
brndnaxr Mar 9, 2026
c99527a
feat: update format_first_name to format_full_name for improved name …
brndnaxr Mar 9, 2026
8789aca
Adiciona categorias de cancelamento & Melhora nome dos seletores para…
brndnaxr Mar 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ ipython_config.py
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
Expand All @@ -132,6 +133,9 @@ ENV/
env.bak/
venv.bak/

# Folders
script/

# Spyder project settings
.spyderproject
.spyproject
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10
3.12.4
7 changes: 7 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[theme]
base="light"
primaryColor="#08b13c"
backgroundColor="#fafafaff"
secondaryBackgroundColor="#ffffff"
textColor="#262730"
font="sans serif"
16 changes: 16 additions & 0 deletions .streamlit/secrets.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[credentials]
usernames = [
"jsmith",
"rbriggs",
"karine@cofrat.com.br"
]
passwords = [
"senha123",
"abc@123",
"Geladeira123!"
]

[supabase]
url = "https://mytbufiwnfsphvimvvvu.supabase.co"
service_key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im15dGJ1Zml3bmZzcGh2aW12dnZ1Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1Nzc4NDQ2NywiZXhwIjoyMDczMzYwNDY3fQ.tbe31KF4eWkotTs0sx-pXcCGEVwLrxfvd5Wd9WtSW-Q"
access_key_id = '2709775cce628ea71bf4f8753cc1509a'
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python-envs.defaultEnvManager": "ms-python.python:conda",
"python-envs.defaultPackageManager": "ms-python.python:conda"
}
50 changes: 0 additions & 50 deletions Hello.py

This file was deleted.

10 changes: 10 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
credentials:
usernames:
jsmith:
email: jsmith@gmail.com
name: John Smith
password: '$2b$12$E9/VSm92ZHg3a1aX2f.2d.u523u2u.iP2.iP2.iP2.iP2.iP2' # Hash para senha123
rbriggs:
email: rbriggs@gmail.com
name: Rebecca Briggs
password: '$2b$12$L5/Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf.Qf' # Hash para abc@123
8 changes: 8 additions & 0 deletions data/message_templates.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
area,message
Ortopedia,"Olá, {$primeiro_nome}!

Sua consulta está agendada para o dia {$data}, às {$horario}, com {$profissional} (Ortopedista).
Caso não possa comparecer, solicitamos a gentileza de avisar com antecedência.

Atenciosamente,
Equipe COFRAT."
157 changes: 157 additions & 0 deletions delete.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"headers": {
"host": "webhook.erudieto.com.br",
"user-agent": "rest-client/2.1.0 (linux-musl x86_64) ruby/3.4.4p34",
"content-length": "5264",
"accept": "application/json",
"accept-encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
"content-type": "application/json",
"x-forwarded-for": "161.35.227.157",
"x-forwarded-host": "webhook.erudieto.com.br",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-forwarded-server": "traefik_traefik.1",
"x-real-ip": "161.35.227.157"
},
"params": {},
"query": {},
"body": {
"account": {
"id": 2,
"name": "Cofrat Atendimento"
},
"additional_attributes": {},
"content_attributes": {},
"content_type": "text",
"content": "oi",
"conversation": {
"additional_attributes": {},
"can_reply": true,
"channel": "Channel::Api",
"contact_inbox": {
"id": 17,
"contact_id": 9,
"inbox_id": 1,
"source_id": "f1a2daf2-5d0f-4068-be18-b640f49185b3",
"created_at": "2025-09-18T01:03:45.474Z",
"updated_at": "2025-09-18T01:03:45.474Z",
"hmac_verified": false,
"pubsub_token": "9yN8LhFgBC58GGeciKzGANHm"
},
"id": 10,
"inbox_id": 1,
"messages": [
{
"id": 458,
"content": "oi",
"account_id": 2,
"inbox_id": 1,
"conversation_id": 10,
"message_type": 0,
"created_at": 1758493861,
"updated_at": "2025-09-21T22:31:01.262Z",
"private": false,
"status": "sent",
"source_id": "WAID:3F6DCDFA3DECC78B0A7B",
"content_type": "text",
"content_attributes": {},
"sender_type": "Contact",
"sender_id": 9,
"external_source_ids": {},
"additional_attributes": {},
"processed_message_content": "oi",
"sentiment": {},
"conversation": {
"assignee_id": 2,
"unread_count": 1,
"last_activity_at": 1758493861,
"contact_inbox": {
"source_id": "f1a2daf2-5d0f-4068-be18-b640f49185b3"
}
},
"sender": {
"additional_attributes": {},
"custom_attributes": {},
"email": null,
"id": 9,
"identifier": null,
"name": "Brandon A.",
"phone_number": "+5511959044561",
"thumbnail": "https://dev-chatwoot.vldzc8.easypanel.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBHdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3db807a3307ea4546e92ec979251e6aaaaff1929/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--323aceeaa90542a5a906abdbeac3933c19539aa0/409452621_6687922161337028_8898827240265742964_n.jpg",
"blocked": false,
"type": "contact"
}
}
],
"labels": [
"agendamento_fluxo_por_convenio"
],
"meta": {
"sender": {
"additional_attributes": {},
"custom_attributes": {},
"email": null,
"id": 9,
"identifier": null,
"name": "Brandon A.",
"phone_number": "+5511959044561",
"thumbnail": "https://dev-chatwoot.vldzc8.easypanel.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBHdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3db807a3307ea4546e92ec979251e6aaaaff1929/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--323aceeaa90542a5a906abdbeac3933c19539aa0/409452621_6687922161337028_8898827240265742964_n.jpg",
"blocked": false,
"type": "contact"
},
"assignee": {
"id": 2,
"name": "Ada Lovelace",
"available_name": "Julia",
"avatar_url": "https://dev-chatwoot.vldzc8.easypanel.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBDZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--8dabf3ce7bf4300482c7b62172d6bf61d83df9c1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lKYW5CbFp3WTZCa1ZVT2hOeVpYTnBlbVZmZEc5ZlptbHNiRnNIYVFINk1BPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--9650be2ccb8166f0f8e58ad2fc29c5e1bc2c8847/222Generated%20Image%20September%2007,%202025%20-%204_57PM.jpeg",
"type": "user",
"availability_status": null,
"thumbnail": "https://dev-chatwoot.vldzc8.easypanel.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBDZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--8dabf3ce7bf4300482c7b62172d6bf61d83df9c1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lKYW5CbFp3WTZCa1ZVT2hOeVpYTnBlbVZmZEc5ZlptbHNiRnNIYVFINk1BPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--9650be2ccb8166f0f8e58ad2fc29c5e1bc2c8847/222Generated%20Image%20September%2007,%202025%20-%204_57PM.jpeg"
},
"team": null,
"hmac_verified": false
},
"status": "open",
"custom_attributes": {},
"snoozed_until": null,
"unread_count": 1,
"first_reply_created_at": "2025-09-18T01:04:09.639Z",
"priority": null,
"waiting_since": 1758493861,
"agent_last_seen_at": 1758250904,
"contact_last_seen_at": 1758250746,
"last_activity_at": 1758493861,
"timestamp": 1758493861,
"created_at": 1758157425,
"updated_at": 1758493861.316716
},
"created_at": "2025-09-21T22:31:01.262Z",
"id": 458,
"inbox": {
"id": 1,
"name": "Agendamento"
},
"message_type": "incoming",
"private": false,
"sender": {
"account": {
"id": 2,
"name": "Cofrat Atendimento"
},
"additional_attributes": {},
"avatar": "https://dev-chatwoot.vldzc8.easypanel.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBHdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3db807a3307ea4546e92ec979251e6aaaaff1929/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--323aceeaa90542a5a906abdbeac3933c19539aa0/409452621_6687922161337028_8898827240265742964_n.jpg",
"custom_attributes": {},
"email": null,
"id": 9,
"identifier": null,
"name": "Brandon A.",
"phone_number": "+5511959044561",
"thumbnail": "https://dev-chatwoot.vldzc8.easypanel.host/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBHdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3db807a3307ea4546e92ec979251e6aaaaff1929/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--323aceeaa90542a5a906abdbeac3933c19539aa0/409452621_6687922161337028_8898827240265742964_n.jpg",
"blocked": false
},
"source_id": "WAID:3F6DCDFA3DECC78B0A7B",
"event": "message_created"
},
"webhookUrl": "https://webhook.erudieto.com.br/webhook/chat",
"executionMode": "production"
}
Binary file added images/cofrat-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/cofrat-logotipo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# main.py
import streamlit as st
from utils import login_form, main_app
import os

# --- CAMINHOS ABSOLUTOS (BOA PRÁTICA) ---
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
LOGO_SYMBOL_PATH = os.path.join(BASE_DIR, "images", "cofrat-logo.png")
LOGO_EXTENDED_PATH = os.path.join(BASE_DIR, "images", "cofrat-logotipo.png")
CSS_PATH = os.path.join(BASE_DIR, "style.css")

# --- CONFIGURAÇÃO DA PÁGINA ---
st.set_page_config(
page_title="Plataforma de Gestão dos Atendimentos",
page_icon=LOGO_SYMBOL_PATH,
layout="wide",
initial_sidebar_state="expanded"
)

# --- FUNÇÃO PARA CARREGAR CSS ---
def load_css(file_name):
"""Carrega um arquivo CSS externo para dentro do app Streamlit."""
try:
with open(file_name, encoding="utf-8") as f:
st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
except FileNotFoundError:
st.warning(f"Arquivo CSS não encontrado em: {file_name}")

# Carrega o nosso arquivo de estilos
load_css(CSS_PATH)

# --- GATEKEEPER PRINCIPAL ---
# Inicializa o estado de autenticação se ele não existir
if "authentication_status" not in st.session_state:
st.session_state["authentication_status"] = False

# Verifica o estado de autenticação para decidir o que mostrar
if not st.session_state["authentication_status"]:
# Se não estiver logado, mostra o formulário de login
login_form(logo_path=LOGO_EXTENDED_PATH)
else:
# Se estiver logado, renderiza o aplicativo principal
main_app(logo_path=LOGO_EXTENDED_PATH)
55 changes: 55 additions & 0 deletions notebooks/transform.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "be241e8f",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"df = pd.read_clipboard()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1d7949bc",
"metadata": {},
"outputs": [],
"source": [
"\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bed618e4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "cofrat-app",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading