{"id":21723391,"url":"https://github.com/bcko/ud-fs-logsanalysis-python","last_synced_at":"2025-06-25T03:06:58.393Z","repository":{"id":143671654,"uuid":"93458748","full_name":"bcko/Ud-FS-LogsAnalysis-Python","owner":"bcko","description":"Udacity Full Stack Web Developer Nanodegree Project : Logs Analysis in Python Postgresql","archived":false,"fork":false,"pushed_at":"2017-12-08T06:56:29.000Z","size":12811,"stargazers_count":4,"open_issues_count":0,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-21T05:43:35.200Z","etag":null,"topics":["database","logs-analysis","postgresql","python","udacity","udacity-fullstack-nanodegree"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bcko.png","metadata":{"files":{"readme":"README.md","changelog":"newsdata.zip","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-06-06T00:24:14.000Z","updated_at":"2023-12-08T11:15:36.000Z","dependencies_parsed_at":"2023-04-16T14:53:10.669Z","dependency_job_id":null,"html_url":"https://github.com/bcko/Ud-FS-LogsAnalysis-Python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bcko/Ud-FS-LogsAnalysis-Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcko%2FUd-FS-LogsAnalysis-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcko%2FUd-FS-LogsAnalysis-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcko%2FUd-FS-LogsAnalysis-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcko%2FUd-FS-LogsAnalysis-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcko","download_url":"https://codeload.github.com/bcko/Ud-FS-LogsAnalysis-Python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcko%2FUd-FS-LogsAnalysis-Python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261795318,"owners_count":23210619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","logs-analysis","postgresql","python","udacity","udacity-fullstack-nanodegree"],"created_at":"2024-11-26T02:38:57.914Z","updated_at":"2025-06-25T03:06:58.379Z","avatar_url":"https://github.com/bcko.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logs Analysis Project\n\n## [Project Description](Project_Description.md)\n\n## [Project_Specification](Project_Specification.md)\n\n## Questions\n1. What are the most popular three articles of all time?\n  Which articles have been accessed the most?\n  Present this information as a sorted list with the most popular article at the top\n2. Who are the most popular article authors of all time?\n  That is, when you sum up all of the articles each author has written, which authors get the most page views?\n  Present this as a sorted list with the most popular author at the top.\n3. On which days did more than 1% of requests lead to errors?\n  The log table includes a column status that indicates the HTTP status code that the news site sent to the user's browser.\n\n## Requirements\n* Python 3.5.3\n* psycopg2\n* Postgresql 9.6\n\n## How to run\n\n* load the data onto the database\n```sql\npsql -d news -f newsdata.sql\n```\n* connect to the database\n```sql\npsql -d news\n```\n* create views\n* python3 LogsAnalysis.py\n\n### Create Views\n```sql\nCREATE VIEW author_info AS\nSELECT authors.name, articles.title, articles.slug\nFROM articles, authors\nWHERE articles.author = authors.id\nORDER BY authors.name;\n```\n\n```sql\nCREATE VIEW path_view AS\nSELECT path, COUNT(*) AS view\nFROM log\nGROUP BY path\nORDER BY path;\n```\n\n```sql\nCREATE VIEW article_view AS\nSELECT author_info.name, author_info.title, path_view.view\nFROM author_info, path_view\nWHERE path_view.path = CONCAT('/article/', author_info.slug)\nORDER BY author_info.name;\n```\n\n```sql\nCREATE VIEW total_view AS\nSELECT date(time), COUNT(*) AS views\nFROM log \nGROUP BY date(time)\nORDER BY date(time);\n```\n\n```sql\nCREATE VIEW error_view AS\nSELECT date(time), COUNT(*) AS errors\nFROM log WHERE status = '404 NOT FOUND' \nGROUP BY date(time) \nORDER BY date(time);\n```\n\n```sql\nCREATE VIEW error_rate AS\nSELECT total_view.date, (100.0*error_view.errors/total_view.views) AS percentage\nFROM total_view, error_view\nWHERE total_view.date = error_view.date\nORDER BY total_view.date;\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcko%2Fud-fs-logsanalysis-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcko%2Fud-fs-logsanalysis-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcko%2Fud-fs-logsanalysis-python/lists"}