Package: covid19-dashboard-pkg-hwhittle
Covid DashboardAutomatic covid dashboard for displaying accurate, up to date covid data and news.Documentation can be foundhere.This project is hosted onGitHubTable of ContentsFeaturesInstallingRunningDocumentationConfig FileLoggingTemplateCoreTestingPackagingFeaturesDisplay up-to-date COVID-19 statisticsDisplay both local and national articlesDisplay recent news articles about the configured search termsRemove articles from being displayed, even after new ones are fetchedSchedule one-time and repeating updates to fetch new statistics and news articlesAll configurableInstallingInstalling the dashboard is simple.Ensure pip is up to datepython -m pip install –upgrade pipUsing pipSimply runpip install covid19-dashboard-pkg-hwhittleFrom SourceInstall the required pip modules using the following commandpython -m pip install -r requirements.txtRunningRunning the dashboard is easy. You have two options;Using the main moduleFlask's CLIMain ModuleAssuming you have python and this module installed simply run in a directory with aconfig.jsonfile in itpython -m covid19dashboardFlask CLIFirst you need to export the necessary variablesCMDset FLASK_APP="covid19dashboard/__main__.py"Powershell$env:FLASK_APP="covid19dashboard/__main__.py"Bashexport FLASK_APP="covid19dashboard/__main__.py"Then run the app usingflask runThis will start the interface at127.0.0.1:5000/indexwhich can simply be navigated to with any web browser.DocumentationThis project uses Sphinx's documentation generator!The documentation can be accessedhere.Rebuilding DocumentationFirstly, delete thehtmlanddoctreesdirectories indocs/.Secondly in thedocsdirectory run:make htmlConfig FileThis project has a configuration JSON file which can be used to customize the dashboard.The default configuration is as follows:{"logging":{"enabled":true,"debug":false,"path":"./logging/log","use_file":true,"dump_debug_on_error":true,"dump_debug_count":10},"template":{"title":"COVID-19 UK Dashboard","logo":"logo.webp","favicon":"favicon.webp"},"location":"Exeter","location_type":"ltla","nation_location":"England","search_terms":"Covid COVID-19 coronavirus","language_code":"en","news_api_key":"news-api-key","resource_path":"./resources/","static_path":"./static/","inital_national_data_filename":"nation_2021-10-28.csv"}Loggingenabled: booleanWhether or not the logging module is enabled.This disables debug, info and error logs as well as file writes.debug: booleanThis toggles whether or not to log debug messages to the console.They will still be written to a file upon error.path: stringThe path to the log file. Can be relative or absolute.use_file: booleanWhether to write info and error logs to a file.dump_debug_on_error: booleanWhether to log the history of debug messages when an error log occurs.The number of debug messages to log is configurable.dump_debug_count: numberThe number of debug messages to log.Templatetitle: stringThe title to display at the top of the template page.logo: stringThe logo image path relative to/static/images/(where /static/ is the static directory)favicon: stringThe favicon image path relative to/static/images/(where /static/ is the static directory)news_article_count: number
The number of news articles to show on the screen at any given time.Corelocation: stringThe location in which to query covid data for.
The valid values for this config option depends on the value of location_type.location_type: stringThe type of the location configuration option.
Valid options can be foundhereunder the the areaType metric.nation_location: stringThe national location to use for national data.
Must be a valid nation in the UK.search_terms: stringA list of search terms separated by space used to query for news articles.
The valuecovid19 coronaviruswill be split into two queries,covid19andcoronavirus.
There is no way to include a space in a query.language_code: string
The 2-letter ISO-639-1 code of the language you want to get headlines for.
Possible options:ardeenesfrheitnlnoptruseudzh.news_api_key: stringYournews api key.resource_path: stringThe path to your resources folder.static_path: stringThe path to your static folder.
This folder is used for all static content on the dashboard, such as images.All file paths in thetemplateconfiguration section are relative tostatic_path/images/.inital_national_data_filename: stringThe path to the initial csv data file. This file is used to load initial data for the dashboard.The path for this file is relative toresource_path/TestingThis project uses pytest for its testing.All tests are inside the/tests/directory and have filenames according to the module it tests.
e.g.test_config.pyfor theconfigmodule.Running TestsRunning the tests is a simple task.Firstly ensure thepytestmodule is installed.pip install pytestAfter this, ensure you are in the root directory before runningpytestIf this doesn't work try runningpython -m pytestAdding TestsThe tests for this project have a simple directory structure.Each test is inside atest_$MODULE.pyfile inside thetestsdirectory.Each test inside those files is a function with the following naming convention.deftest_$FUNCTION_$FEATURE():assertconditionAn example of this would betest_log_error_makes_file. This test tests a function calledlog_errorand ensures that it makes a file.PackagingPackaging the project is simple using setuptools.The filesetup.pyis the setuptools build script.To package the application simply runpython setup.py sdist bdist_wheelYou can then find the packaged application in thedistdirectory.