How s314/news-service works
Project type and purpose
• This is a full-stack web application built with Ruby on Rails that provides a news classifier interface.
• It includes a separate Julia “Bukdu” microservice that performs Bayesian classification on news content.
File structure
• Top-level “app/” directory follows Rails’ MVC pattern:
• app/controllers – Rails controllers handling HTTP requests
• app/models – ActiveRecord models for Users, Sources, Entries
• app/views & app/assets – HTML templates, CSS/SCSS, CoffeeScript
• app/channels – WebSocket channels (ActionCable)
• config/ – Rails routing, environment configs, cable.yml
• db/ – Migrations, schema, seeds
• “Bukdu/” directory contains Julia code:
• bukdu_server.jl – entry point for a classifier microservice
• bayes.jl, db_learning.jl – classification logic
• corpus/ – sample text files organized by category
• Rakefile, Gemfile, package.json, bin/rails, bin/yarn indicate standard Rails build and asset pipeline.
README for additional insights
• The README instructs launching the Julia classifier service first, then starting the Rails server.
• Rails interacts with the Julia service over HTTP (or TCP) to classify incoming news items.
Main components and their interactions
a. Components:
1) Browser / Client UI
2) Rails Web Server
– Controllers, Views, Assets, ActionCable
3) PostgreSQL (or configured SQL) Database
4) Julia “Bukdu” Classifier Service
5) (Optional) Redis for ActionCable / background jobs
b. Relationships & data flow:
• User → Rails (HTTP GET/POST)
• Rails Controllers → Models → Database (SQL)
• Rails Classifier endpoint → Julia Service (HTTP/TCP request)
• Julia Service loads corpus, computes category, returns JSON
• Rails renders classification result back to user
• Background jobs (app/jobs) or ActionCable push notifications flow through Redis or the Rails process.
c. Architectural patterns:
– MVC for Rails application
– Microservice pattern for offloading classification to Julia
– REST or lightweight RPC between Rails and Julia
– Asset pipeline for JS/CSS, optional WebSockets for live updates
d. Key technologies:
• Ruby on Rails (MVC, ActiveRecord, ActionCable)
• PostgreSQL (config/database.yml)
• Julia (HTTP.jl or Sockets.jl in bukdu_server.jl)
• SCSS, CoffeeScript, Yarn/Webpacker for front-end assets
• Puma web server, Rake tasks
• Gemfile-managed Ruby gems
Diagramming conventions
• UI / Browser – Blue
• Rails Web/App – Green
• Database – Orange
• Julia Service – Purple
• Cache / Message Broker – Yellow