Giter Site home page Giter Site logo

provenance's Introduction

Provenance

A common architecture used for data collection.

Provenance collects and stores articles from infoq.com and follows a Netflix Conductor-esque architecture.

History

In 2016 we began a project to address some of the concerns around fake news. While most were analyzing articles, we decided to take another approach; showing consumers where their content comes from. Our goal was to bring source [journalist] context to the foreground.

The exercise

Get the tests to pass!

  • Query the articles gateway.
  • Map rss results to a collection.
  • Start the background worker.

Look for todo items in the codebase for where to get started.

Quick start

Download the codebase.

Create a jar file without running tests.

./gradlew assemble

Articles

Run the articles component tests to see what's failing.

./gradlew :components:articles:test

Review the todo comments in the ArticlesController class and get the tests to pass. Along the way it will be helpful to use the writeJsonBody method to convert articles to json.

writeJsonBody(servletResponse, articles);

Endpoints

Run the endpoints component tests to see what's failing.

./gradlew :components:endpoints:test  

Review the todo comments in the EndpointWorker class and get the tests to pass. Along the way it will be helpful to use XmlMapper to convert RSS feeds to Java objects.

RSS rss = new XmlMapper().readValue(response, RSS.class);

Test suite

Ensure all the tests pass.

./gradlew build

Schedule work

Review todo comments in the App class within the provenance-server component. Create and start a WorkScheduler.

WorkScheduler<EndpointTask> scheduler = new WorkScheduler<>(finder, workers, 300);

Pro tip: review the testScheduler test in the WorkSchedulerTest class.

Run locally

Build the application again then run it locally to ensure that the endpoint worker is collecting articles.

./gradlew build
java -jar applications/provenance-server/build/libs/provenance-server-1.0-SNAPSHOT.jar 

Make a request for all articles in another terminal window.

curl -H "Accept: application/json" http://localhost:8881/articles

Hope you enjoy the exercise!

Thanks,

The IC Team

© 2022 by Initial Capacity, Inc. All rights reserved.

provenance's People

Contributors

dlynch42 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.