Skip to content

Commit

Permalink
chore: updating staging to master (#66)
Browse files Browse the repository at this point in the history
* refactor: change Aaron to standard feat: adding basic test
- Changed APP to app according to Flask/FastAPI standard
- Changed config_ to _config. trailing space is for python default conflicts not import
- Adding basic tests for endpoints

* test: added test structures
- 	est_app.py: testing �pp.py app title, description, version
- 	est_config.py: tested ProductionConfig, DevelopmentConfig, config loader
- 	est_endpoints.py: tested root test

* test: added test structures
- 	est_app.py: testing �pp.py app title, description, version
- 	est_config.py: tested ProductionConfig, DevelopmentConfig, config loader
- 	est_endpoints.py: tested root test

* tests: add testing for custom error messages

* chore: updated README

* chore: fixed PR template

* chore: updated README

* chore: updated README

* tests: adds test cases for endpoints
- '/' done
- '/news' only testing for 422 and 405, no validation yet
- '/twitter': tested 422, 404, 405, and random data sample validation
- '/county': tested 404, 405, 422. no data return validation yet
- '/state': tested 405, 422.
- '/country': tested 405, 422.
- '/stats': tested 405, 422.

* style: fix for codefactor.
- 	est_config.py: keeping assert == True/False for code readability
- 	est_endpoints.py: keeping TODO as a reminder to fix endpoints.py

* style: changed config_ to �pp_config after technical discussion

* style: chore:
- added .pylintrc
- fixed all files for pylint
- added .github/workflow/pythonapp.yml
- added pipenv, pylint and pytest

* chore:
- streamlining pythonapp.yml
- triggers pythonapp.yml on all push and pull_request

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml, readme.md

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* feat: rerouting root endpoint to postman

* feat: rerouting root endpoint to postman

* feat: added redirect to postman, added test

* fix: added uvloop

* feat: adding coverall

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io attempt 6

* feat: installed coveralls for coverall.io attempt 8

* feat: installed coveralls for coverall.io attempt 9

* feat: settingup coverall attempt #11

* feat: coverall badge attempt #12

* feat: coverall added, feat: routing root to redoc

* fix: default config logic

* fix: default config logic

* Update LICENSE

* chore: updating README again  🤧 (#46)

* chore: updating READMEs

* chore: updating READMEs

* chore: updating READMEs (#48)

* fix: post county new_death nan error (#50)

* fix: /post county new_death nan error

* fix: /post county new_death nan error

* feat: test: (#52)

* feat: adding zip route

* feat: zip route #1

* feat: removed uszipcode, added zipcodes

* feat:
- feat: added zip endpoint to return county data given zip code
- test: added tests for the zip endpoint
- feat: modified github actions to trigger on push, and on pr to master/staging

* han: attempt to fix codefactor #1

* feat: zip endpoint
- added custom exception handlers
- mal-formed zip codes now return 422 instead of 404
- changed mal-formed zip codes test cases from 404 to 422

* fixed zip endpoint for nyc (#54)

* fix: benton, wa

* fix: github actions

* fix: github actions to pr only

* fix: combined -- counties and retargeted combined counties (#57)

* chore: updating master (#55)

* refactor: change Aaron to standard feat: adding basic test
- Changed APP to app according to Flask/FastAPI standard
- Changed config_ to _config. trailing space is for python default conflicts not import
- Adding basic tests for endpoints

* test: added test structures
- 	est_app.py: testing �pp.py app title, description, version
- 	est_config.py: tested ProductionConfig, DevelopmentConfig, config loader
- 	est_endpoints.py: tested root test

* test: added test structures
- 	est_app.py: testing �pp.py app title, description, version
- 	est_config.py: tested ProductionConfig, DevelopmentConfig, config loader
- 	est_endpoints.py: tested root test

* tests: add testing for custom error messages

* chore: updated README

* chore: fixed PR template

* chore: updated README

* chore: updated README

* tests: adds test cases for endpoints
- '/' done
- '/news' only testing for 422 and 405, no validation yet
- '/twitter': tested 422, 404, 405, and random data sample validation
- '/county': tested 404, 405, 422. no data return validation yet
- '/state': tested 405, 422.
- '/country': tested 405, 422.
- '/stats': tested 405, 422.

* style: fix for codefactor.
- 	est_config.py: keeping assert == True/False for code readability
- 	est_endpoints.py: keeping TODO as a reminder to fix endpoints.py

* style: changed config_ to �pp_config after technical discussion

* style: chore:
- added .pylintrc
- fixed all files for pylint
- added .github/workflow/pythonapp.yml
- added pipenv, pylint and pytest

* chore:
- streamlining pythonapp.yml
- triggers pythonapp.yml on all push and pull_request

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml, readme.md

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* feat: rerouting root endpoint to postman

* feat: rerouting root endpoint to postman

* feat: added redirect to postman, added test

* fix: added uvloop

* feat: adding coverall

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io attempt 6

* feat: installed coveralls for coverall.io attempt 8

* feat: installed coveralls for coverall.io attempt 9

* feat: settingup coverall attempt #11

* feat: coverall badge attempt #12

* feat: coverall added, feat: routing root to redoc

* fix: default config logic

* fix: default config logic

* Update LICENSE

* chore: updating README again  🤧 (#46)

* chore: updating READMEs

* chore: updating READMEs

* chore: updating READMEs (#48)

* fix: post county new_death nan error (#50)

* fix: /post county new_death nan error

* fix: /post county new_death nan error

* feat: test: (#52)

* feat: adding zip route

* feat: zip route #1

* feat: removed uszipcode, added zipcodes

* feat:
- feat: added zip endpoint to return county data given zip code
- test: added tests for the zip endpoint
- feat: modified github actions to trigger on push, and on pr to master/staging

* han: attempt to fix codefactor #1

* feat: zip endpoint
- added custom exception handlers
- mal-formed zip codes now return 422 instead of 404
- changed mal-formed zip codes test cases from 404 to 422

* fixed zip endpoint for nyc (#54)

Co-authored-by: leehanchung <[email protected]>
Co-authored-by: Hanchung Lee <[email protected]>

* fix: benton, wa

* fix: github actions

* fix: github actions to pr only

* fix: counties yo counties

* fix: merge confliictassz round 2

Co-authored-by: Harsh Desai <[email protected]>

* chore: updating master (#55) (#59)

* refactor: change Aaron to standard feat: adding basic test
- Changed APP to app according to Flask/FastAPI standard
- Changed config_ to _config. trailing space is for python default conflicts not import
- Adding basic tests for endpoints

* test: added test structures
- 	est_app.py: testing �pp.py app title, description, version
- 	est_config.py: tested ProductionConfig, DevelopmentConfig, config loader
- 	est_endpoints.py: tested root test

* test: added test structures
- 	est_app.py: testing �pp.py app title, description, version
- 	est_config.py: tested ProductionConfig, DevelopmentConfig, config loader
- 	est_endpoints.py: tested root test

* tests: add testing for custom error messages

* chore: updated README

* chore: fixed PR template

* chore: updated README

* chore: updated README

* tests: adds test cases for endpoints
- '/' done
- '/news' only testing for 422 and 405, no validation yet
- '/twitter': tested 422, 404, 405, and random data sample validation
- '/county': tested 404, 405, 422. no data return validation yet
- '/state': tested 405, 422.
- '/country': tested 405, 422.
- '/stats': tested 405, 422.

* style: fix for codefactor.
- 	est_config.py: keeping assert == True/False for code readability
- 	est_endpoints.py: keeping TODO as a reminder to fix endpoints.py

* style: changed config_ to �pp_config after technical discussion

* style: chore:
- added .pylintrc
- fixed all files for pylint
- added .github/workflow/pythonapp.yml
- added pipenv, pylint and pytest

* chore:
- streamlining pythonapp.yml
- triggers pythonapp.yml on all push and pull_request

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml, readme.md

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* chore: updated pythonapp.yml

* feat: rerouting root endpoint to postman

* feat: rerouting root endpoint to postman

* feat: added redirect to postman, added test

* fix: added uvloop

* feat: adding coverall

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io

* feat: installed coveralls for coverall.io attempt 6

* feat: installed coveralls for coverall.io attempt 8

* feat: installed coveralls for coverall.io attempt 9

* feat: settingup coverall attempt #11

* feat: coverall badge attempt #12

* feat: coverall added, feat: routing root to redoc

* fix: default config logic

* fix: default config logic

* Update LICENSE

* chore: updating README again  🤧 (#46)

* chore: updating READMEs

* chore: updating READMEs

* chore: updating READMEs (#48)

* fix: post county new_death nan error (#50)

* fix: /post county new_death nan error

* fix: /post county new_death nan error

* feat: test: (#52)

* feat: adding zip route

* feat: zip route #1

* feat: removed uszipcode, added zipcodes

* feat:
- feat: added zip endpoint to return county data given zip code
- test: added tests for the zip endpoint
- feat: modified github actions to trigger on push, and on pr to master/staging

* han: attempt to fix codefactor #1

* feat: zip endpoint
- added custom exception handlers
- mal-formed zip codes now return 422 instead of 404
- changed mal-formed zip codes test cases from 404 to 422

* fixed zip endpoint for nyc (#54)

Co-authored-by: leehanchung <[email protected]>
Co-authored-by: Hanchung Lee <[email protected]>

Co-authored-by: Harsh Desai <[email protected]>

* fix: zipcode fix for us districts and territories

* tests: unit test for US districts and all territories added

* chore: linting fixed

* style: pylint and fix panda warning

* chore: more linting

* chore: temp pylint removed from the github workflow

* fix: post stats endpoint error
refactor: added black formatter and bring back linting

Co-authored-by: Harsh Desai <[email protected]>
  • Loading branch information
leehanchung and hurshd0 committed Apr 30, 2020
1 parent 8661e05 commit 7453c76
Show file tree
Hide file tree
Showing 17 changed files with 260 additions and 328 deletions.
10 changes: 9 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

What Changed ? e.g. Github Issues Title or Trello Card Title

**Please describe it here... in EDIT mode.**

## Type of change

Please delete options that are not relevant.
**Please don't put a X mark here in EDIT mode**

- [ ] :ambulance: Bug fix (non-breaking change which fixes an issue)
- [ ] :recycle: :wastebasket: Re-factor, cleanup, un-comment, docstring
Expand All @@ -13,17 +15,23 @@ Please delete options that are not relevant.

## Change Status

**Please don't put a X mark here in EDIT mode**

- [ ] :checkered_flag: Complete, tested, ready to review and merge
- [ ] :traffic_light: Complete, but not tested (may need new tests)
- [ ] :construction: WIP work-in-progress, PR is for discussion/feedback

# How Has This Been Tested?

**Please don't put a X mark here in EDIT mode**

- [ ] Manually Functionality Testing
- [ ] Unit Test

# Checklist

**Please don't put a X mark here in EDIT mode**

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
#===============================================#
- name: STEP 4. Lint with pylint
run: |
pipenv run black --line-length=80 api
pipenv run pylint --rcfile=.pylintrc api
#===============================================#
- name: STEP 5. Test with pytest
Expand Down
9 changes: 4 additions & 5 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from api.config import DataReadingError, DataValidationError



_logger = get_logger(logger_name=__name__)


Expand Down Expand Up @@ -40,10 +39,10 @@ def create_app() -> FastAPI:
allow_headers=["*"],
)

app.add_exception_handler(DataReadingError,
data_reading_exception_handler)
app.add_exception_handler(DataValidationError,
data_validation_exception_handler)
app.add_exception_handler(DataReadingError, data_reading_exception_handler)
app.add_exception_handler(
DataValidationError, data_validation_exception_handler
)

_logger.info("FastAPI instance created")

Expand Down
23 changes: 14 additions & 9 deletions api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def get_logger(*, logger_name):
class DataReadingError(Exception):
"""DataReadingError exception used for sanity checking.
"""

def __init__(self, *args):
super(DataReadingError, self).__init__(*args)
if args:
Expand All @@ -74,6 +75,7 @@ def __str__(self):
class DataValidationError(Exception):
"""DataValidationError exception used for sanity checking.
"""

def __init__(self, *args):
super(DataValidationError, self).__init__(*args)
if args:
Expand All @@ -95,6 +97,7 @@ class Config:
"""
Base config for Staging API
"""

DEBUG = False
TESTING = False
CSRF_ENABLED = True
Expand All @@ -108,13 +111,17 @@ class Config:
COLLECTION_TWITTER = "twitter"

# JHU CSSE Daily Reports
BASE_URL = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/" \
"master/csse_covid_19_data/csse_covid_19_daily_reports/"
BASE_URL = (
"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/"
"master/csse_covid_19_data/csse_covid_19_daily_reports/"
)

# JHU CSSE time series reports
TIME_URL = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/" \
"master/csse_covid_19_data/csse_covid_19_time_series/" \
"time_series_19-covid-Confirmed.csv"
TIME_URL = (
"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/"
"master/csse_covid_19_data/csse_covid_19_time_series/"
"time_series_19-covid-Confirmed.csv"
)

# NEWS API
NEWS_API_KEY = config("NEWS_API_KEY")
Expand All @@ -124,7 +131,7 @@ class Config:

# CVTRACK
CVTRACK_URL = "https://covidtracking.com/api/us/daily"
CVTRACK_STATES_URL = "https://covidtracking.com/api/states"
CVTRACK_STATES_URL = "https://covidtracking.com/api/v1/states/daily.json"

TMP_URL = "https://coronavirus-19-api.herokuapp.com/countries/USA"

Expand All @@ -136,7 +143,6 @@ class Config:

DB_NAME = "covid"


INFO = dict(
{
"title": "ncov19.us API",
Expand All @@ -145,7 +151,7 @@ class Config:
"URL: https://github.com/ncov19-us/back-end | "
"[GNU GENERAL PUBLIC LICENSE]"
"(https://github.com/ncov19-us/back-end/blob/master/LICENSE)"
),
),
}
)

Expand All @@ -164,7 +170,6 @@ class DevelopmentConfig(Config):
DB_NAME = "covid-staging"



def get_config():
"""Set default config to ProductionConfig unless STAGING environment
is set to false on Linux `export STAGING=False` or Windows Powershell
Expand Down
Loading

0 comments on commit 7453c76

Please sign in to comment.