Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Python/ETL Take Home Coding Test

Build one or more command-line scripts to monitor, store, and visualize the Recent             Change event stream of Wikipedia.  Document the pipeline and check-in all related code  to a Git compatible source-code repository. See the Resources  section for an example      Recent Change JSON document.  If there is time, allow arbitrary queries against the stored data and containerize your code to make it easily deployable.

When submitting your code it should be in the format of a single Git repository with the README.md  file, in MarkDown format, at the root of the repository representing the

documentation for Task 1.

Please attempt to complete as many tasks as you are able within the time specified when you receive this assignment.

Be prepared to present your solution and discuss its implementation details.

Task 1 (documentation):

Write documentation for all tasks undertaken in a markdown file ( README .md ).

   Discuss the planning of the task(s) that were completed and their final implementations.    What were some of the design considerations?

   Why was this technology stack chosen and implemented?

   What are the pros/cons of this technology stack?

   What are some alternatives to the implemented technology stack?

   What are their strength's and weaknesses?

   Include a diagram of the overall pipeline that specifies the flow of the data and the

architectural components of the stack.

All documentation and code should be checked into a Git compatible repository.

   GitHub preferred.

Documentation should be in Markdown ( .md ) format as a  README .md  at the root of the Git repository.

Task/Script 2 (extract):

Using Python 3.x consume the Recent Change stream of the Wikipedia site and /filter the JSON to only show non-bot related edits/.

JSON should be printed to the console using the  logging  library.

JSON should also be logged to a file using the  logging  library.

JSON should be formatted and indented to be readable.

   Script should run until terminated.

(optional/bonus) Allow command-line parameter to alter the default filter (non-bot related edits) to an arbitrary filter via regex or DSL.

Task/Script 3 (storage):

Store the filtered non-bot edit stream in a database.

Database should be created new for each run of the tool.

Script should run until terminated.

Script should clear the database after 1,000 entries to keep the size down.

   Script should print a message to the console when clearing the db.

SQLite3 is good persistent storage mechanism but use what you are familiar with if needed.

Task 4 (visualization):

Visualize the edits per minute on a web page.

Using any language or tool build a small web-page.

Page should display a graph of edits per second while the extract or storage scripts are running.

If possible the web page should refresh automatically every few seconds to show updated edit counts.

Feel free to use any framework, tool, or plain HTML you feel comfortable with.

Task 5 (query):

Extend web-based reporting with a query interface that can take arbitrary SQL queries.

Using any off-the-shelf tool interface into the database to allow arbitrary queries of the Recent Change data.

Task 6 (devop):

Containerize the entire pipeline to make it easily deployable.  Use Docker compose or      Kubernetes if multiple containers are required. Write a BASH script that can bootstrap      your entire pipeline into it's container(s) and run the pipeline.  By running this "bootstrap" script you should build your execution containers, download your latest code from git  or copy it into it's containers, and run then run the pipeline.

Bootstrap devops files (e.g. Dockerfiles) should also be checked into the git repo.       Logging (if any) for the containers should be readable from the containers host via the

 --volume  flag.

Resources:

Wikipedia Recent Events: https://stream.wikimedia.org/v2/stream/recentchange RCFeed Schema: https://www.mediawiki.org/wiki/Manual:RCFeed                       MarkDown: https://daringfireball.net/projects/markdown/

Example RC JSON

Here is a single JSON message retrieved from the  recentchange  Wikimedia website. This would be a small portion of the logged output.

 

event:  message

id:   [{"topic":"codfw .mediawiki . recentchange",  "partition":0,  "offset":-1},

{"topic":"eqiad .mediawiki . recentchange",  "partition":0,  "offset": 908623564}]

data:  {"bot":false,  "comment":"[[:File:Seine  enjpg]]  added  to  category", "id":1084961656,

"meta":{"domain":"commons.wikimedia.org",

"dt":"2018-05-23T22:34:43+00:00",

"id":"82a14923-5ed9-11e8-ac45-141877614309",

"request_ id":"WwXsgwpAMEYAAL2@l9EAAAAW",

"schema_uri":"mediawiki/recentchange/1",

"topic":"eqiad .mediawiki . recentchange",

"uri":"https://commons.wikimedia.org/wiki/Category:TakS_1200D", "partition":0,  "offset":908623563},

"namespace":14,

"parsedcomment":"<a  href=\"/wiki/File:Seine_entre  ...  ded  to  category", "server_name":"commons.wikimedia.org",

"server_script_path":"/w",

"server_url":"https://commons.wikimedia.org",

"timestamp":1527114883,

"title":"Category:Taken  with  Canon  EOS  1200D",

"type":"categorize",  "user":"Chabe01",

"wiki":"commonswiki"}

Tips:

Simple, readable code is better than elegant but complex code.

All functions should have a documentation block at their head as well as comments within the code itself as required to understand it.

Be able to explain not only your code but the thought process behind it. In general:

   The Zen of Python: https://www.python.org/dev/peps/pep-0020/

Focus on quality not quantity.  It is unlikely that candidates will be able to finish all of the tasks of this take-home tests in the time allowed.