COVID-19 NEAR YOU
Find confirmed cases in 1,2 and 3 km and quarantine center in 10 Km radius range based on user given location, give some useful advises and informational links, and help officials to control covid19 transmission.
- Find users zone if they are in Red, Yellow or Green zone based on confirmed case aorund them.
- Give advices to people what they should do or not if they are in infected region or not.
- Show cluster of COVID-19 regions for officals to take right decisions. And for public to take appropriate precautions.Officials can
- Easily identify infected regions, and then impose lockdown and run awareness compaign.
- (Local authorities) can take quick and real time decision.
- Identify those regions where no of cases increasing.
- Show nearest confirmed case and Quarantine center point (address , distance (from user location) and radius range).
- Show total no of confirmed cases and no of points in different ranges around user.
- Provides WHO (World Health Organization) and National website links for latest information and some other useful links
- Users can also check other regions in case of if they wanna go or someone coming from infected region based on result they will take right decsion and appropriate precautions.
If people already know about infected regions and people of these regions transmitting the virus,then they will avoid them, (infected regions and thier people as well) so they will be definitely taking necessary precautions.
Must Read How COVID-19 NEAR YOU app can help to control transmission ?
Table of contents
- COVID-19 NEAR YOU
- Requirements
- Virtual environment
- Installation
- Setup
- App links
- FAQ
- License
- Contributing
- Built with
- Open source software used in this project
Note : Leaflet auto navigation not giving precise location of user that’s why we are getting user precise location manually.
Requirements
Virtual environment
Create new directory
mkdir covid19
Change directory
cd covid19/
Create virtual environment
python3 -m venv env
Activate virtual environment
# Windows:
env\Scripts\activate.bat
# On Unix or MacOS, run:
source env/bin/activate
Installation
Clone repository
git clone git@github.com:FaizanFareed/COVID-19-NEAR-YOU.git
Change directory
cd COVID-19-NEAR-YOU/
Create media directory
mkdir -p media/location
Install all dependencies
pip install -r requirements.txt
Create new project with name covid19.
# Don't forget to miss "." .
django-admin startproject covid19 .
Setup
Add MySQL database config into covid19/settings.py. And delete by default SQLite database directive (config).
# covid19/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': config('DB_NAME'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASSWORD'),
'HOST': config('DB_HOST'),
'PORT': config('DB_PORT'),
}
}
Add Email provider config into covid19/settings.py
# covid19/settings.py
# Console backend
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# Email provider
#DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL')
#EMAIL_BACKEND = config('EMAIL_BACKEND')
#EMAIL_HOST = config('EMAIL_HOST')
#EMAIL_USE_TLS = config('EMAIL_USE_TLS',cast=bool)
#EMAIL_PORT = config('EMAIL_PORT',cast=int)
#EMAIL_HOST_USER = config('EMAIL_HOST_USER')
#EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
Add Redis config into covid19/settings.py
# covid19/settings.py
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": config('REDIS_LOCATION_URL'), # Redis url
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"IGNORE_EXCEPTIONS": True,
"REDIS_CLIENT_KWARGS": {"decode_responses": True, 'charset':"utf-8"},
}
},"KEY_PREFIX" : "covid19",
}
# Storing session in Redis
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"
DJANGO_REDIS_IGNORE_EXCEPTIONS = True
Copy this and paste into covid19/urls.py
# covid19/urls.py
from django.urls import include
from django.contrib.auth import views as auth_views
urlpatterns = [
... # Others if any
# Admin password reset urls
path('admin/password_reset/',auth_views.PasswordResetView.as_view(),name='admin_password_reset',),
path('admin/password_reset/done/',auth_views.PasswordResetDoneView.as_view(),name='password_reset_done',),
path('reset/<uidb64>/<token>/',auth_views.PasswordResetConfirmView.as_view(),name='password_reset_confirm',),
path('reset/done/',auth_views.PasswordResetCompleteView.as_view(),name='password_reset_complete',),
path('admin/', include('django.contrib.auth.urls')),
# covid19nearyou app urls
path('',include('covid19nearyou.urls'))
]
Copy this and paste into covid19/settings.py
# covid19/settings.py
#Static and media urls and root directory
# Static files
STATIC_URL = '/files/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"),]
# Media files
MEDIA_ROOT = BASE_DIR + '/media/'
MEDIA_URL = '/location-points/'
Change your time zone from covid19/settings.py.
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Karachi' # your timezone
Add setting_constants context processer and template path into TEMPLATES directive in covid19/settings.py
# covid19/settings.py
TEMPLATES = [
{
... # others
'DIRS': [os.path.join(BASE_DIR, 'templates')], # copy this
'OPTIONS': {
... # others
'context_processors': [
... # others
'covid19nearyou.context_processors.setting_constants', # copy this
],
},
},
]
Copy these and paste into covid19/urls.py
# covid19/urls.py
from django.conf import settings
from django.conf.urls.static import static
Add static and media path
# covid19/urls.py
urlpatterns = [
... # urls
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # copy and add this at the end of urlpatterns
urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) # copy this
Add covid19nearyou app and MyAdminConfig into INSTALLED_APPS directive in covid19/settings.py
# covid19/settings.py
INSTALLED_APPS = [
... # others apps
'covid19nearyou.apps.Covid19NearyouConfig',
'covid19nearyou.apps.MyAdminConfig',
]
Copy all directives from covid19_settings_variables and paste into covid19/settings.py. And change these directives according to your requirements.
# covid19/settings.py
... # others directives
LOCATION_CACHE_BATCH_SIZE = 100
...
# All directives of covid19_settings_variables.py file goes here
Change country name in covid19/settings.py
COUNTRY_NAME = 'PAKISTAN' # your country name
Migrate
python manage.py migrate
Create superuser
python manage.py createsuperuser
username : #enter username
Email address: # enter your emailaddress
Password: #enter your password
Password (again): # again enter your password
Run server
python manage.py runserver
App links
- Index page or Map : http://127.0.0.1:8000/
- Dashboard : http://127.0.0.1:8000/covid19-dashboard/
- Admin panel : http://127.0.0.1:8000/admin/
- App configuration : http://127.0.0.1:8000/settings-configuration/
- Help/How to use : http://127.0.0.1:8000/help/
FAQ
License
License under a MIT License.
Contributing
If you have any suggestions , request new features ,found bugs, or you can start discussion at https://github.com/FaizanFareed/COVID-19-NEAR-YOU/issues
- Fork, clone or make a pull requset to this repository.
Built with
- Django (Python)
- Redis
- MySQL
- Leaflet
- Semantic UI
- JQuery
Open source software used in this project
Open soruce software license
- Leaflet BSD 2-Clause “Simplified” License
- Sementic UI MIT License