feat(lattes): melhorias na integracao Lattes e estilos da secao
- Aprimorar extracao de dados Lattes no backend - Melhorar estilos CSS da secao Lattes - Ajustes no componente ConsultorCard para exibicao do Lattes
This commit is contained in:
@@ -473,7 +473,10 @@ async def obter_lattes(
|
|||||||
):
|
):
|
||||||
docs = await es_client.buscar_por_ids(
|
docs = await es_client.buscar_por_ids(
|
||||||
[id_pessoa],
|
[id_pessoa],
|
||||||
source_fields=["id", "identificadorLattes", "titulacoes"],
|
source_fields=[
|
||||||
|
"id", "dadosPessoais", "identificadorLattes", "titulacoes",
|
||||||
|
"idiomas", "areasConhecimento", "enderecos", "atuacoes"
|
||||||
|
],
|
||||||
)
|
)
|
||||||
if not docs:
|
if not docs:
|
||||||
return {"encontrado": False, "motivo": "Consultor não encontrado"}
|
return {"encontrado": False, "motivo": "Consultor não encontrado"}
|
||||||
@@ -485,31 +488,94 @@ async def obter_lattes(
|
|||||||
return {"encontrado": False, "motivo": "Currículo Lattes não cadastrado"}
|
return {"encontrado": False, "motivo": "Currículo Lattes não cadastrado"}
|
||||||
|
|
||||||
id_lattes = id_lattes_obj.get("descricao")
|
id_lattes = id_lattes_obj.get("descricao")
|
||||||
|
dados_pessoais = doc.get("dadosPessoais", {})
|
||||||
titulacoes_raw = doc.get("titulacoes", [])
|
titulacoes_raw = doc.get("titulacoes", [])
|
||||||
|
idiomas_raw = doc.get("idiomas", [])
|
||||||
|
areas_raw = doc.get("areasConhecimento", [])
|
||||||
|
enderecos_raw = doc.get("enderecos", [])
|
||||||
|
atuacoes_raw = doc.get("atuacoes", [])
|
||||||
|
|
||||||
titulacoes = []
|
titulacoes = []
|
||||||
for t in titulacoes_raw:
|
for t in titulacoes_raw:
|
||||||
grau_obj = t.get("grauAcademico", {})
|
grau_obj = t.get("grauAcademico", {})
|
||||||
ies_obj = t.get("ies", {})
|
ies_obj = t.get("ies", {})
|
||||||
area_obj = t.get("areaConhecimento", {})
|
area_obj = t.get("areaConhecimento", {})
|
||||||
|
programa_obj = t.get("programa", {})
|
||||||
titulacoes.append({
|
titulacoes.append({
|
||||||
"grau": grau_obj.get("nome", ""),
|
"grau": grau_obj.get("nome", ""),
|
||||||
|
"hierarquia": grau_obj.get("hierarquia"),
|
||||||
"ano": t.get("ano"),
|
"ano": t.get("ano"),
|
||||||
"inicio": t.get("inicio"),
|
"inicio": t.get("inicio"),
|
||||||
"fim": t.get("fim"),
|
"fim": t.get("fim"),
|
||||||
"ies_nome": ies_obj.get("nome"),
|
"ies_nome": ies_obj.get("nome"),
|
||||||
"ies_sigla": ies_obj.get("sigla"),
|
"ies_sigla": ies_obj.get("sigla"),
|
||||||
|
"ies_status": ies_obj.get("statusJuridico"),
|
||||||
"area": area_obj.get("nome"),
|
"area": area_obj.get("nome"),
|
||||||
"area_avaliacao": area_obj.get("areaAvaliacao", {}).get("nome") if area_obj.get("areaAvaliacao") else None,
|
"area_avaliacao": area_obj.get("areaAvaliacao", {}).get("nome") if area_obj.get("areaAvaliacao") else None,
|
||||||
"programa": t.get("programa", {}).get("nome") if t.get("programa") else None,
|
"programa": programa_obj.get("nome") if programa_obj else None,
|
||||||
|
"codigo_programa": programa_obj.get("codigo") if programa_obj else None,
|
||||||
|
})
|
||||||
|
titulacoes.sort(key=lambda x: (x.get("hierarquia") or 99, -(x.get("ano") or 0)))
|
||||||
|
|
||||||
|
idiomas = []
|
||||||
|
for i in idiomas_raw:
|
||||||
|
idiomas.append({
|
||||||
|
"idioma": i.get("idioma"),
|
||||||
|
"proficiencia_leitura": i.get("proficienciaLeitura"),
|
||||||
|
"proficiencia_escrita": i.get("proficienciaEscrita"),
|
||||||
|
"proficiencia_fala": i.get("proficienciaFala"),
|
||||||
|
"proficiencia_compreensao": i.get("proficienciaCompreensao"),
|
||||||
|
})
|
||||||
|
|
||||||
|
areas_conhecimento = []
|
||||||
|
for a in areas_raw:
|
||||||
|
areas_conhecimento.append({
|
||||||
|
"nome": a.get("nome"),
|
||||||
|
"area_avaliacao": a.get("areaAvaliacao", {}).get("nome") if a.get("areaAvaliacao") else None,
|
||||||
|
})
|
||||||
|
|
||||||
|
endereco_profissional = None
|
||||||
|
for e in enderecos_raw:
|
||||||
|
if e.get("tipo") == "Profissional" or e.get("principalFinalidade") == "Sim":
|
||||||
|
endereco_profissional = {
|
||||||
|
"logradouro": e.get("endereco"),
|
||||||
|
"numero": e.get("numero"),
|
||||||
|
"complemento": e.get("complemento"),
|
||||||
|
"bairro": e.get("bairro"),
|
||||||
|
"cep": e.get("cep"),
|
||||||
|
"cidade": e.get("cidadeExterior") or e.get("cidade"),
|
||||||
|
"pais": e.get("pais"),
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
orientacoes_concluidas = []
|
||||||
|
for a in atuacoes_raw:
|
||||||
|
tipo = a.get("tipo", "")
|
||||||
|
if "Orientação" in tipo and "Concluída" in tipo:
|
||||||
|
dados = a.get("dadosOrientacao", {})
|
||||||
|
orientacoes_concluidas.append({
|
||||||
|
"tipo": tipo,
|
||||||
|
"titulo": dados.get("titulo"),
|
||||||
|
"ano": dados.get("ano"),
|
||||||
|
"orientando": dados.get("orientando", {}).get("nome") if dados.get("orientando") else None,
|
||||||
|
"programa": dados.get("programa", {}).get("nome") if dados.get("programa") else None,
|
||||||
|
"ies": dados.get("ies", {}).get("sigla") if dados.get("ies") else None,
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"encontrado": True,
|
"encontrado": True,
|
||||||
"id_lattes": id_lattes,
|
"id_lattes": id_lattes,
|
||||||
"url": f"http://lattes.cnpq.br/{id_lattes}",
|
"url": f"http://lattes.cnpq.br/{id_lattes}",
|
||||||
|
"nome": dados_pessoais.get("nome"),
|
||||||
|
"data_nascimento": dados_pessoais.get("nascimento"),
|
||||||
|
"nacionalidade": dados_pessoais.get("nacionalidade"),
|
||||||
"titulacoes": titulacoes,
|
"titulacoes": titulacoes,
|
||||||
"orientacoes_lattes": len([t for t in titulacoes if t.get("grau") in ["Doutorado", "Mestrado"]]),
|
"idiomas": idiomas,
|
||||||
|
"areas_conhecimento": areas_conhecimento,
|
||||||
|
"endereco_profissional": endereco_profissional,
|
||||||
|
"orientacoes_concluidas": orientacoes_concluidas[:20],
|
||||||
|
"total_orientacoes": len(orientacoes_concluidas),
|
||||||
|
"data_atualizacao_lattes": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1335,8 +1335,9 @@
|
|||||||
|
|
||||||
.modal-item {
|
.modal-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-direction: column;
|
||||||
gap: 0.75rem;
|
align-items: flex-start;
|
||||||
|
gap: 0.2rem;
|
||||||
padding: 0.6rem 0.8rem;
|
padding: 0.6rem 0.8rem;
|
||||||
background: rgba(255, 255, 255, 0.03);
|
background: rgba(255, 255, 255, 0.03);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
@@ -1355,6 +1356,42 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-item-detail {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-item-sub {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-section-title {
|
||||||
|
color: var(--accent-2);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
margin: 1.25rem 0 0.5rem;
|
||||||
|
padding-bottom: 0.25rem;
|
||||||
|
border-bottom: 1px solid var(--stroke);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-section-title:first-of-type {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lattes-link-inline {
|
||||||
|
color: var(--accent) !important;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lattes-link-inline:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-summary {
|
.modal-summary {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
|||||||
@@ -765,47 +765,122 @@ const ItemDetalheModal = ({ item, tipo, onClose }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'producoes_lattes': {
|
case 'producoes_lattes': {
|
||||||
const producoes = item.producoes || item.producoes_recentes || [];
|
const titulacoes = item.titulacoes || [];
|
||||||
|
const idiomas = item.idiomas || [];
|
||||||
|
const orientacoes = item.orientacoes_concluidas || [];
|
||||||
|
const endereco = item.endereco_profissional;
|
||||||
return (
|
return (
|
||||||
<div className="modal-detalhe-content">
|
<div className="modal-detalhe-content">
|
||||||
<div className="modal-detalhe-row">
|
<div className="modal-detalhe-row">
|
||||||
<span className="modal-detalhe-label">Total</span>
|
<span className="modal-detalhe-label">ID Lattes</span>
|
||||||
<span className="modal-detalhe-value">{item.total_producoes ?? 0}</span>
|
<a
|
||||||
|
href={item.url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="modal-detalhe-value lattes-link-inline"
|
||||||
|
>
|
||||||
|
{item.id_lattes} ↗
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
{item.nacionalidade && (
|
||||||
<div className="modal-detalhe-row">
|
<div className="modal-detalhe-row">
|
||||||
<span className="modal-detalhe-label">Bibliográfica</span>
|
<span className="modal-detalhe-label">Nacionalidade</span>
|
||||||
<span className="modal-detalhe-value">{item.producao_bibliografica ?? 0}</span>
|
<span className="modal-detalhe-value">{item.nacionalidade}</span>
|
||||||
</div>
|
|
||||||
<div className="modal-detalhe-row">
|
|
||||||
<span className="modal-detalhe-label">Técnica</span>
|
|
||||||
<span className="modal-detalhe-value">{item.producao_tecnica ?? 0}</span>
|
|
||||||
</div>
|
|
||||||
<div className="modal-detalhe-row">
|
|
||||||
<span className="modal-detalhe-label">Orientações</span>
|
|
||||||
<span className="modal-detalhe-value">{item.orientacoes_lattes ?? 0}</span>
|
|
||||||
</div>
|
|
||||||
{item.data_atualizacao_lattes && (
|
|
||||||
<div className="modal-detalhe-row">
|
|
||||||
<span className="modal-detalhe-label">Atualização</span>
|
|
||||||
<span className="modal-detalhe-value">{formatDate(item.data_atualizacao_lattes)}</span>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="modal-detalhe-row">
|
|
||||||
<span className="modal-detalhe-label">Produções recentes</span>
|
{titulacoes.length > 0 && (
|
||||||
<span className="modal-detalhe-value">{producoes.length}</span>
|
<>
|
||||||
</div>
|
<h5 className="modal-section-title">Formação Acadêmica</h5>
|
||||||
{producoes.length > 0 ? (
|
<ul className="modal-list">
|
||||||
<ul className="modal-list" style={{ marginTop: '0.6rem' }}>
|
{titulacoes.map((t, idx) => (
|
||||||
{producoes.map((prod, idx) => (
|
|
||||||
<li key={idx} className="modal-item">
|
<li key={idx} className="modal-item">
|
||||||
<span className="modal-item-main">{prod.titulo || 'Sem título'}</span>
|
<span className="modal-item-main">
|
||||||
<span className="muted">{prod.ano || '-'}</span>
|
<strong>{t.grau}</strong>
|
||||||
{prod.natureza && <span className="badge">{prod.natureza}</span>}
|
{t.area && ` em ${t.area}`}
|
||||||
|
</span>
|
||||||
|
<span className="modal-item-detail">
|
||||||
|
{t.ies_sigla || t.ies_nome}
|
||||||
|
{t.ano && ` (${t.ano})`}
|
||||||
|
</span>
|
||||||
|
{t.programa && (
|
||||||
|
<span className="modal-item-sub muted">Programa: {t.programa}</span>
|
||||||
|
)}
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
</>
|
||||||
<p className="modal-empty">Nenhuma produção encontrada.</p>
|
)}
|
||||||
|
|
||||||
|
{idiomas.length > 0 && (
|
||||||
|
<>
|
||||||
|
<h5 className="modal-section-title">Idiomas</h5>
|
||||||
|
<ul className="modal-list">
|
||||||
|
{idiomas.map((i, idx) => (
|
||||||
|
<li key={idx} className="modal-item">
|
||||||
|
<span className="modal-item-main">{i.idioma}</span>
|
||||||
|
<span className="modal-item-detail muted">
|
||||||
|
{[
|
||||||
|
i.proficiencia_leitura && `Leitura: ${i.proficiencia_leitura}`,
|
||||||
|
i.proficiencia_escrita && `Escrita: ${i.proficiencia_escrita}`,
|
||||||
|
i.proficiencia_fala && `Fala: ${i.proficiencia_fala}`,
|
||||||
|
].filter(Boolean).join(' | ')}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{orientacoes.length > 0 && (
|
||||||
|
<>
|
||||||
|
<h5 className="modal-section-title">
|
||||||
|
Orientações Concluídas ({item.total_orientacoes})
|
||||||
|
</h5>
|
||||||
|
<ul className="modal-list">
|
||||||
|
{orientacoes.slice(0, 10).map((o, idx) => (
|
||||||
|
<li key={idx} className="modal-item">
|
||||||
|
<span className="modal-item-main">{o.orientando || 'Orientando não informado'}</span>
|
||||||
|
<span className="modal-item-detail">
|
||||||
|
{o.tipo?.replace('Orientação ', '').replace(' Concluída', '')}
|
||||||
|
{o.ano && ` (${o.ano})`}
|
||||||
|
{o.ies && ` - ${o.ies}`}
|
||||||
|
</span>
|
||||||
|
{o.titulo && (
|
||||||
|
<span className="modal-item-sub muted" style={{ fontSize: '0.75rem' }}>
|
||||||
|
{o.titulo.length > 80 ? o.titulo.substring(0, 80) + '...' : o.titulo}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
{item.total_orientacoes > 10 && (
|
||||||
|
<li className="modal-item muted">
|
||||||
|
... e mais {item.total_orientacoes - 10} orientações
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{endereco && (
|
||||||
|
<>
|
||||||
|
<h5 className="modal-section-title">Endereço Profissional</h5>
|
||||||
|
<div className="modal-detalhe-row">
|
||||||
|
<span className="modal-detalhe-value">
|
||||||
|
{[
|
||||||
|
endereco.logradouro,
|
||||||
|
endereco.numero,
|
||||||
|
endereco.bairro,
|
||||||
|
endereco.cidade,
|
||||||
|
endereco.pais
|
||||||
|
].filter(Boolean).join(', ')}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{titulacoes.length === 0 && idiomas.length === 0 && orientacoes.length === 0 && (
|
||||||
|
<p className="modal-empty">Dados detalhados não disponíveis no ATUACAPES.</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user