How saip05501-coder/navy-agent works
1. What this repo is:
This is a small, single-purpose Python agent, not a web app. Its job is to periodically check the Indian Navy recruitment site, detect new relevant updates, and send email alerts.
2. Main execution entrypoint:
main.py is the orchestrator. It ties together scraping, change detection/storage, and notification sending into one run cycle.
3. Data collection boundary:
scraper.py is the source-ingestion layer. It pulls content from the Indian Navy website using HTTP requests and HTML parsing, then extracts only the relevant news/recruitment section.
4. State and deduplication boundary:
storage.py handles persistence of notification history in data/notifications.json. This is the key stateful part of the system and is likely used to avoid re-sending the same alert on every run.
5. Notification boundary:
notifier.py is the delivery layer. It sends email alerts through SMTP, separating outbound communication from scraping and storage logic.
6. Configuration boundary:
config.py centralizes runtime settings such as target URLs, email/SMTP parameters, and file locations. This keeps environment-specific values out of the core logic.
7. Persistent data layout:
The data/ directory is the only explicit application data store in the repo. The JSON file there is the durable memory of what has already been notified.
8. Operational scheduling:
.github/workflows/navy-agent.yml indicates the agent is intended to run on a schedule or CI runner. That makes the system an automated job runner rather than a continuously serving process.
9. External dependencies and services:
The architecture depends on three outside systems: the Indian Navy site as the data source, an SMTP service as the notification sink, and GitHub Actions/hosting infrastructure for execution.
10. End-to-end flow:
The run sequence is: fetch website content → extract relevant updates → compare/store against prior notifications → send email if something new is found.
The main architectural boundary is between external scraping, local state tracking, and outbound email delivery.
11. Overall shape:
This is a lightweight, pull-based monitoring agent with a small amount of local persistence. Its correctness depends mostly on the website structure, the JSON state file, and the SMTP delivery configuration.
Main entry points: main.py Main · config.py Config · scraper.py Scraper · storage.py Storage
Components 10
Application
Core Python agent that orchestrates scraping, state tracking, and email delivery.
- Main · Runs one monitoring cycle and coordinates the other modules.
main.py - Config · Central runtime settings for URLs, email, SMTP, and file paths.
config.py - Scraper · Fetches the Indian Navy site and extracts relevant recruitment/news content.
scraper.py - Storage · Reads and updates notification history to prevent duplicate alerts.
storage.py - Notifier · Sends alert emails through SMTP.
notifier.py
State
Persistent notification memory used for deduplication.
- Notifications · Durable record of previously sent alerts.
data/notifications.json
Automation
Scheduled execution setup for the agent.
- Workflow · GitHub Actions workflow that triggers the agent on a schedule or runner.
.github/workflows/navy-agent.yml
External
Outside systems the repo depends on.
- Navy site · External Indian Navy recruitment/news website being monitored.
- SMTP · External email transport used to deliver alerts.
- GitHub Actions · Execution environment for the scheduled automation.
Connections 13
- Workflow → GitHub Actions: runs on · Workflow is executed by GitHub Actions.
- GitHub Actions → Main: invokes · Runner starts the monitoring job.
- Main → Config: loads · Main reads runtime settings.
- Main → Scraper: fetches via · Main asks the scraper for current site content.
- Main → Storage: checks state · Main consults stored notification history.
- Main → Notifier: sends alerts · Main triggers email delivery when new updates are found.
- Scraper → Navy site: requests · Scraper pulls content from the Indian Navy website.
- Storage → Notifications: reads/writes · Storage persists deduplication state in the JSON file.
- Notifier → SMTP: delivers via · Notifier sends outbound mail through SMTP.
- Storage → Config: uses paths · Storage relies on configured file locations.
- Scraper → Config: uses settings · Scraper uses configured target URLs and parsing parameters.
- Notifier → Config: uses settings · Notifier uses configured SMTP and recipient values.
- Main → Workflow: deployed by · The scheduled job wraps the main entrypoint.