How sahooashis/hackernewsproject works
Project type and purpose
• This is a command-line Python 2.7 data-ingestion tool that fetches “new” and “top” stories from the HackerNews API and outputs them as CSV files or stores them in a SQLite database.
• The README spells out the use case: query the HN API, retrieve stories, then persist them in CSV or SQLite.
File structure
• Top-level files
• run.py – entry point
• README.md
• Packages
• utility/ – bootstrapping, user choice handling (ChoiceUtility.py, Main.py)
• functionality/ – core logic for fetching and dispatching data (HackerNews.py, HackerNewsCSV.py, HackerNewsSqlite.py, StoryFetch.py)
• connection/ – I/O abstractions (WebConnection.py for HTTP, DBConnection.py for SQLite)
• models/ – domain model (StoryClass.py)
• files/ – output artifacts (CSV and .db files)
README for additional insights
• It lists the four main packages and their responsibilities.
• Dependencies: urllib2 (HTTP), csv, sqlite3.
Detailed Capturing of Architectural Elements
• That run.py does not itself fetch or persist, but delegates to utility.Main
• How ChoiceUtility abstracts user input from the rest of the system
• That StoryFetch is the orchestrator for invoking HackerNews and persistence adapters
• Model StoryClass as the data carrier between fetch and persist