Here's the file structure and the modules of this project
src
- has the backend and frontend codecontrollers
- Rendering the pages and re-directions are written here.homecontroller.py
- render the main page
Consist of the methodindex
which rendersindex.html
page andcreate
which create the tables in postgreSQL if its not already presentingcontroller.py
- controller for ingredient module
Consist of the following methodsdetails()
- returns the dict consisting the ingredient details: name, precautions, side_effect, url, usesearch()
- returns the dict of urls and namesearch_ingredient()
- rendersearch-ingredient.html
search_ingredient_results()
- rendersearch-ingredient-results.html
ingredient_details()
- renderingredient-details.html
medcontroller.py
- controller for medicine module
Consist of the following methodsdetails()
- returns the dict consisting the medicine details: name, description, side_effect, url, usesearch()
- returns the dict of urls and namesearch_results()
- rendersearch_results.html
medicine_details()
- rendermedicine_details.html
models
- the SQLAlchemy models for the tablesmedicine.py
- The medicine table's modelingredient.py
- The ingredient table's model
services
- main logic is written heremedservice.py
- modules for CRUD, search and details of medicine
Consist of the following methodsMedSearch(key)
- the module for searching the medicine names,
it takes the user input value to be searched as argument and returns the dict of medicine list.
It calls two seperate search functions to do webscraping from otc and drugs lists and combine the results into one dataframe.MedDetails(id, name)
- the module for the medicine summary,
it takes the unique url and name to medicine as argument and returns the dict of medicine data. The details for otc and drugs are computed seperately and combined in this function.OtcDetails(content)
- takes the parsed html as input and returns dict of otc summaryDrugDetails(content)
- takes the parsed html as input and returns dict of drugs summary
ingservice.py
- modules for CRUD, search and details of ingredient
Consist of the following methodsIngredientDetails(id, name)
- the module for the medicine summary,
it takes the unique url and name to medicine as argument and returns the dict of ingredient data.IngredientSearch(key)
- the module for searching the medicine names,
it takes the user input value to be searched as argument and returns the dict of ingredient list.
routes
- routing on given urlshomeroute.py
- main page routeingroute.py
- ingredient module routesmedroute.py
- medicine module routes
utils
- utility filesinitdb.py
- initializing the database herecreate_db()
- creates the postgreSQL tables
template
- contain the html codessearch-ingredient.html
search-ingredient-results.html
ingredient-details.html
index.html
search-results.html
medicine-details.html
test
- For unit testingtest.py
- For unit testing, currently no tests there
main.py
- Creating the application, connecting to postgres here.Makefile
- Build and Run the application, linting and installation of dependenciesrequirement.txt
- The dependenciesdocumentation
- Contains documentation folder