feat: Sistema de Ranking de Consultores CAPES - versão inicial
Backend (FastAPI + DDD):
- Arquitetura DDD com camadas Domain, Application, Infrastructure, Interface
- Integração com Elasticsearch (ATUACAPES) para dados de consultores
- Integração com Oracle (SUCUPIRA_PAINEL) para coordenações PPG
- Cálculo dos 4 componentes de pontuação (A, B, C, D)
- Cache em memória para otimização de performance
- API REST com endpoints /ranking, /ranking/detalhado, /consultor/{id}
Frontend (React + Vite):
- Interface responsiva com cards expansíveis
- Visualização detalhada de pontuação por componente
- Filtro por quantidade de consultores (Top 10, 50, 100, etc)
Docker:
- docker-compose com shared_network externa
- Backend com Oracle Instant Client
- Frontend com Vite dev server
This commit is contained in:
67
backend/src/domain/value_objects/pontuacao.py
Normal file
67
backend/src/domain/value_objects/pontuacao.py
Normal file
@@ -0,0 +1,67 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ComponentePontuacao:
|
||||
base: int
|
||||
tempo: int
|
||||
extras: int
|
||||
bonus: int
|
||||
retorno: int = 0
|
||||
|
||||
@property
|
||||
def total(self) -> int:
|
||||
return self.base + self.tempo + self.extras + self.bonus + self.retorno
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PontuacaoCompleta:
|
||||
componente_a: ComponentePontuacao
|
||||
componente_b: ComponentePontuacao
|
||||
componente_c: ComponentePontuacao
|
||||
componente_d: ComponentePontuacao
|
||||
|
||||
@property
|
||||
def total(self) -> int:
|
||||
return (
|
||||
self.componente_a.total
|
||||
+ self.componente_b.total
|
||||
+ self.componente_c.total
|
||||
+ self.componente_d.total
|
||||
)
|
||||
|
||||
@property
|
||||
def detalhamento(self) -> Dict[str, Dict[str, int]]:
|
||||
return {
|
||||
"componente_a": {
|
||||
"base": self.componente_a.base,
|
||||
"tempo": self.componente_a.tempo,
|
||||
"extras": self.componente_a.extras,
|
||||
"bonus": self.componente_a.bonus,
|
||||
"retorno": self.componente_a.retorno,
|
||||
"total": self.componente_a.total,
|
||||
},
|
||||
"componente_b": {
|
||||
"base": self.componente_b.base,
|
||||
"tempo": self.componente_b.tempo,
|
||||
"extras": self.componente_b.extras,
|
||||
"bonus": self.componente_b.bonus,
|
||||
"total": self.componente_b.total,
|
||||
},
|
||||
"componente_c": {
|
||||
"base": self.componente_c.base,
|
||||
"tempo": self.componente_c.tempo,
|
||||
"extras": self.componente_c.extras,
|
||||
"bonus": self.componente_c.bonus,
|
||||
"total": self.componente_c.total,
|
||||
},
|
||||
"componente_d": {
|
||||
"base": self.componente_d.base,
|
||||
"tempo": self.componente_d.tempo,
|
||||
"extras": self.componente_d.extras,
|
||||
"bonus": self.componente_d.bonus,
|
||||
"total": self.componente_d.total,
|
||||
},
|
||||
"pontuacao_total": self.total,
|
||||
}
|
||||
Reference in New Issue
Block a user