backend/
├── fetchers.py # Data collection (APIs reais)
├── calculators.py # 6 métricas matemáticas
├── main-v2.py # API atualizada
└── requirements-v2.txt # Dependencies
frontend/
└── index-v2.html # UI com 6 métricas + radar chart
1. Parar containers
docker-compose down
2. Atualizar backend
cd backend/
cp /mnt/user-data/outputs/backend/fetchers.py .
cp /mnt/user-data/outputs/backend/calculators.py .
cp /mnt/user-data/outputs/backend/main-v2.py main.py
cp /mnt/user-data/outputs/backend/requirements-v2.txt requirements.txt
3. Atualizar frontend
cd ../frontend/
cp /mnt/user-data/outputs/frontend/index-v2.html index.html
4. Rebuild e subir
cd ..
docker-compose build --no-cache
docker-compose up -d
Análise fake
bubble_index = 0.35
DEPOIS:
Dados reais de múltiplas fontes
pypi_data = await fetcher.fetch_pypi("openai")
github_data = await fetcher.fetch_github("openai", "openai-python")
reddit_data = await fetcher.fetch_reddit("OpenAI")
6 métricas calculadas
analysis = calculator.analyze(raw_data)
1. PyPI (downloads Python) 2. NPM (downloads JavaScript) 3. GitHub (stars, forks, watchers) 4. Reddit (subscribers, activity) 5. CoinGecko (crypto market data) 6. HuggingFace (model downloads)
1. Adoção → Bass Model (p=0.03, q=0.38)
2. Hype → Gartner Cycle
3. Investment → Momentum (cap, volume, velocity)
4. Network → Metcalfe^1.5
5. Feedback → F = γ(H×I + N×A) - δA²H²
6. Bubble → Composite (pesos: 0.25, 0.30, 0.20, 0.25)
curl -X POST http://localhost:8000/api/analyze \
-H "Content-Type: application/json" \
-d '{"asset":"chatgpt"}'
Response:
{
"asset": "ChatGPT/OpenAI",
"category": "AI/LLM",
"data_sources": {
"pypi_downloads": 45000000,
"github_stars": 75000,
"reddit_subscribers": 1200000
},
"analysis": {
"metrics": {
"adoption": 0.750,
"hype": 0.580,
"investment": 0.700,
"network": 0.650,
"feedback": 0.170,
"divergence": 0.085
},
"bubble_index": 0.324,
"bubble_percentage": 32.4,
"risk": {
"level": "Moderado",
"color": "yellow",
"action": "Monitorar"
}
}
}
curl http://localhost:8000/presets
Assets disponíveis:
curl -X POST http://localhost:8000/api/analyze/custom \
-H "Content-Type: application/json" \
-d '{
"pypi_package": "fastapi",
"github_owner": "tiangolo",
"github_repo": "fastapi",
"subreddit": "FastAPI"
}'
curl http://localhost:8000/api/compare?assets=chatgpt,claude,langchain
1. Bubble Index Card - Valor em % - Risk level (Baixo/Moderado/Alto/Crítico) - Ação recomendada - Barra de progresso colorida 2. 6 Cards de Métricas - Adoção, Hype, Investimento - Rede, Feedback, Divergência - Barras individuais 3. Radar Chart (Chart.js) - Visualização das 6 métricas - Interativo 4. Data Sources - Mostra fontes usadas - Valores formatados (K, M)
.env
GITHUB_TOKEN=ghp_your_token_here
Sem token: 60 req/hora
Com token: 5000 req/hora
Em fetchers.py
ASSET_CONFIGS["meu-asset"] = {
"name": "Meu Asset",
"pypi_package": "meu-pacote",
"github": {"owner": "user", "repo": "repo"},
"subreddit": "MeuSubreddit",
"category": "AI/Custom"
}
1. Health check
curl http://localhost:8000/health
2. Ver presets
curl http://localhost:8000/presets
3. Analisar ChatGPT
curl -X POST http://localhost:8000/api/analyze \
-H "Content-Type: application/json" \
-d '{"asset":"chatgpt"}'
4. Abrir frontend
open http://localhost:3000
{"asset": "chatgpt"}
Dados Coletados:
PyPI (openai): 45M downloads/mês
GitHub (openai-python): 75K stars
Reddit (r/OpenAI): 1.2M subscribers
Google Trends: 45/100
Métricas Calculadas:
Adoção: 75% (alta)
Hype: 58% (moderado)
Investimento: 70% (alto)
Rede: 65% (boa)
Feedback: 17% (equilibrado)
Divergência: 9% (baixa - bom sinal)
Resultado:
Bubble Index: 32.4%
Risk Level: Moderado 🟡
Action: Monitorar
Adicionar Redis
docker-compose.yml:
redis:
image: redis:7-alpine
Adicionar PostgreSQL
- Salvar análises
- Time series
- Comparações temporais
Celery workers
- Análise automática
- Alertas por email
- Dashboard atualizado
docker-compose build --no-cache
docker-compose up -d
docker-compose logs api
Ver se fetchers.py e calculators.py existem
main.py já tem CORS configurado:
allow_origins=["*"]
1. Use presets para assets comuns 2. GitHub token aumenta rate limits 3. Frontend mostra loading enquanto busca dados 4. Radar chart é interativo (hover) 5. Data sources mostra o que foi usado ---
TL;DR:Copy files
cp outputs/backend/* backend/
cp outputs/frontend/* frontend/
Rebuild
docker-compose build --no-cache
docker-compose up -d
Test
curl localhost:8000/presets
open localhost:3000
Agora com dados reais! 🚀