# ankitvarma11/cews architecture

> Architecture diagram of the GitHub repository ankitvarma11/cews, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ankitvarma11/cews
- Repository: https://github.com/ankitvarma11/cews

## Overview

CEWS is a local competitive-intelligence system for life-sciences organizations: it gathers public evidence, resolves it into organizations and topics, computes explainable scores and forecasts, and presents results for human review. The documented analyst workflow runs from source collection through normalization, competitor discovery, feature generation, scoring, and forecasting. Supporting capabilities include deterministic insights, a dashboard, API, exports, scheduled runs, and optional AI-assisted chat. Some subsystems are present in the tree but were not sampled; their links are omitted or marked unverified rather than inferred.

Main entry points: [`src/cews/cli.py`](https://github.com/ankitvarma11/cews/blob/main/src/cews/cli.py) (Command workflow), [`src/cews/database/models.py`](https://github.com/ankitvarma11/cews/blob/main/src/cews/database/models.py) (Analytical database), [`src/cews/features/pipeline.py`](https://github.com/ankitvarma11/cews/blob/main/src/cews/features/pipeline.py) (Feature generation), [`dashboards/streamlit/app.py`](https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/app.py) (Streamlit dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Evidence collection"]
  node_ingestion["Source ingestion<br/>[orchestrator.py]"]
  node_adapters["Public data adapters"]
  node_database[("Analytical database<br/>[models.py]")]
end

subgraph group_processing["Entity processing"]
  node_normalization["Record normalization<br/>[pipeline.py]"]
  node_review_actions["Human review actions<br/>[review_actions.py]"]
  node_discovery["Competitor discovery"]
end

subgraph group_analytics["Analytics"]
  node_features["Feature generation<br/>[pipeline.py]"]
  node_scoring["Explainable scoring<br/>[pipeline.py]"]
  node_forecasting["Forecasts and anomalies<br/>[pipeline.py]"]
end

subgraph group_delivery["Insights and delivery"]
  node_insights["Deterministic insights<br/>[rule_engine.py]"]
  node_dashboard_queries["Dashboard data queries<br/>[queries.py]"]
  node_exports["CSV and Power BI exports"]
  node_scheduler["Scheduled jobs"]
end

subgraph group_interfaces["User interfaces"]
  node_cli["Command workflow<br/>[cli.py]"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_review_panel["Review panel<br/>[review_panel.py]"]
  node_api["HTTP API<br/>[app.py]"]
  node_chat["Analyst chat<br/>[chat_widget.py]"]
  node_agents["Chat agent runtime<br/>[session.py]"]
end

node_user(("Analyst"))

node_user -->|"runs commands"| node_cli
node_cli -->|"invokes collection"| node_ingestion
node_ingestion -.->|"dispatches sources"| node_adapters
node_cli -->|"runs normalization"| node_normalization
node_cli -->|"runs discovery"| node_discovery
node_cli -->|"runs features"| node_features
node_features -->|"stores features"| node_database
node_cli -->|"runs scoring"| node_scoring
node_features -->|"supplies inputs"| node_scoring
node_cli -->|"runs forecasts"| node_forecasting
node_forecasting -->|"stores forecasts"| node_database
node_insights -->|"reads stored scores"| node_database
node_dashboard -->|"requests data"| node_dashboard_queries
node_dashboard_queries -->|"reads records"| node_database
node_review_panel -->|"applies decisions"| node_review_actions
node_cli -.->|"serves API"| node_api
node_dashboard -->|"offers chat"| node_chat
node_chat -->|"runs agent"| node_agents
node_scheduler -.->|"runs workflow"| node_cli
node_exports -.->|"exports results"| node_database

click node_cli "https://github.com/ankitvarma11/cews/blob/main/src/cews/cli.py"
click node_ingestion "https://github.com/ankitvarma11/cews/blob/main/src/cews/ingestion/orchestrator.py"
click node_adapters "https://github.com/ankitvarma11/cews/tree/main/src/cews/ingestion/adapters"
click node_database "https://github.com/ankitvarma11/cews/blob/main/src/cews/database/models.py"
click node_normalization "https://github.com/ankitvarma11/cews/blob/main/src/cews/normalization/pipeline.py"
click node_review_actions "https://github.com/ankitvarma11/cews/blob/main/src/cews/normalization/review_actions.py"
click node_discovery "https://github.com/ankitvarma11/cews/blob/main/src/cews/discovery/competitor_discovery.py"
click node_features "https://github.com/ankitvarma11/cews/blob/main/src/cews/features/pipeline.py"
click node_scoring "https://github.com/ankitvarma11/cews/blob/main/src/cews/scoring/pipeline.py"
click node_forecasting "https://github.com/ankitvarma11/cews/blob/main/src/cews/forecasting/pipeline.py"
click node_insights "https://github.com/ankitvarma11/cews/blob/main/src/cews/insights/rule_engine.py"
click node_dashboard_queries "https://github.com/ankitvarma11/cews/blob/main/src/cews/dashboard/queries.py"
click node_exports "https://github.com/ankitvarma11/cews/tree/main/src/cews/exports"
click node_scheduler "https://github.com/ankitvarma11/cews/tree/main/src/cews/scheduler"
click node_dashboard "https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/app.py"
click node_review_panel "https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/components/review_panel.py"
click node_api "https://github.com/ankitvarma11/cews/blob/main/src/cews/api/app.py"
click node_chat "https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/components/chat_widget.py"
click node_agents "https://github.com/ankitvarma11/cews/blob/main/src/cews/agents/session.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ingestion,node_adapters,node_database toneBlue
class node_normalization,node_review_actions,node_discovery toneAmber
class node_features,node_scoring,node_forecasting toneMint
class node_insights,node_dashboard_queries,node_exports,node_scheduler toneRose
class node_cli,node_dashboard,node_review_panel,node_api,node_chat,node_agents,node_user toneIndigo
```

## Components

### Evidence collection

- [Source ingestion](https://github.com/ankitvarma11/cews/blob/main/src/cews/ingestion/orchestrator.py): `src/cews/ingestion/orchestrator.py`
- [Public data adapters](https://github.com/ankitvarma11/cews/tree/main/src/cews/ingestion/adapters): `src/cews/ingestion/adapters`
- [Analytical database](https://github.com/ankitvarma11/cews/blob/main/src/cews/database/models.py): `src/cews/database/models.py`

### Entity processing

- [Record normalization](https://github.com/ankitvarma11/cews/blob/main/src/cews/normalization/pipeline.py): `src/cews/normalization/pipeline.py`
- [Human review actions](https://github.com/ankitvarma11/cews/blob/main/src/cews/normalization/review_actions.py): `src/cews/normalization/review_actions.py`
- [Competitor discovery](https://github.com/ankitvarma11/cews/blob/main/src/cews/discovery/competitor_discovery.py): `src/cews/discovery/competitor_discovery.py`

### Analytics

- [Feature generation](https://github.com/ankitvarma11/cews/blob/main/src/cews/features/pipeline.py): `src/cews/features/pipeline.py`
- [Explainable scoring](https://github.com/ankitvarma11/cews/blob/main/src/cews/scoring/pipeline.py): `src/cews/scoring/pipeline.py`
- [Forecasts and anomalies](https://github.com/ankitvarma11/cews/blob/main/src/cews/forecasting/pipeline.py): `src/cews/forecasting/pipeline.py`

### Insights and delivery

- [Deterministic insights](https://github.com/ankitvarma11/cews/blob/main/src/cews/insights/rule_engine.py): `src/cews/insights/rule_engine.py`
- [Dashboard data queries](https://github.com/ankitvarma11/cews/blob/main/src/cews/dashboard/queries.py): `src/cews/dashboard/queries.py`
- [CSV and Power BI exports](https://github.com/ankitvarma11/cews/tree/main/src/cews/exports): `src/cews/exports`
- [Scheduled jobs](https://github.com/ankitvarma11/cews/tree/main/src/cews/scheduler): `src/cews/scheduler`

### User interfaces

- [Command workflow](https://github.com/ankitvarma11/cews/blob/main/src/cews/cli.py): `src/cews/cli.py`
- [Streamlit dashboard](https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/app.py): `dashboards/streamlit/app.py`
- [Review panel](https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/components/review_panel.py): `dashboards/streamlit/components/review_panel.py`
- [HTTP API](https://github.com/ankitvarma11/cews/blob/main/src/cews/api/app.py): `src/cews/api/app.py`
- [Analyst chat](https://github.com/ankitvarma11/cews/blob/main/dashboards/streamlit/components/chat_widget.py): `dashboards/streamlit/components/chat_widget.py`
- [Chat agent runtime](https://github.com/ankitvarma11/cews/blob/main/src/cews/agents/session.py): `src/cews/agents/session.py`

### Other components

- **Analyst**

## Connections

- Analyst → Command workflow: runs commands (evidence: `README.md`)
- Command workflow → Source ingestion: invokes collection (evidence: `src/cews/cli.py`)
- Source ingestion → Public data adapters: dispatches sources
- Command workflow → Record normalization: runs normalization (evidence: `README.md`)
- Command workflow → Competitor discovery: runs discovery (evidence: `README.md`)
- Command workflow → Feature generation: runs features (evidence: `README.md`)
- Feature generation → Analytical database: stores features (evidence: `src/cews/features/pipeline.py`)
- Command workflow → Explainable scoring: runs scoring (evidence: `README.md`)
- Feature generation → Explainable scoring: supplies inputs (evidence: `src/cews/scoring/pipeline.py`)
- Command workflow → Forecasts and anomalies: runs forecasts (evidence: `README.md`)
- Forecasts and anomalies → Analytical database: stores forecasts (evidence: `src/cews/forecasting/pipeline.py`)
- Deterministic insights → Analytical database: reads stored scores (evidence: `src/cews/insights/rule_engine.py`)
- Streamlit dashboard → Dashboard data queries: requests data (evidence: `dashboards/streamlit/app.py`)
- Dashboard data queries → Analytical database: reads records (evidence: `src/cews/dashboard/queries.py`)
- Review panel → Human review actions: applies decisions (evidence: `dashboards/streamlit/components/review_panel.py`)
- Command workflow → HTTP API: serves API
- Streamlit dashboard → Analyst chat: offers chat (evidence: `dashboards/streamlit/app.py`)
- Analyst chat → Chat agent runtime: runs agent (evidence: `dashboards/streamlit/components/chat_widget.py`)
- Scheduled jobs → Command workflow: runs workflow (evidence: `src/cews/cli.py`)
- CSV and Power BI exports → Analytical database: exports results
