Skip to content

Commit

Permalink
Merge pull request #57 from Code-Institute-Community/app-structure
Browse files Browse the repository at this point in the history
Restructring the app
  • Loading branch information
auxfuse committed Mar 22, 2022
2 parents 0601a4e + 7fc6964 commit e131799
Show file tree
Hide file tree
Showing 48 changed files with 976 additions and 926 deletions.
Empty file removed .env_sample
Empty file.
131 changes: 130 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,135 @@

A Collaborative Open-Source Project where we are looking for a way to put regional Irish IT businesses into clusters based on their services/products. The information about their services/products should be found on their website, but are not in a format it can be used for applications.

# Prerequisists

- Python 3.8+
- MongoDB (either an ATLAS instance or locally installed)

# How to run the project

1) Create a new `env.py` file with the content from the `env.py.sample` file. Update the `MONGO_URI` and `MONGO_DBNAME` if necessary.
1) Install the requirements (optionally create a new virtual environment )
1) Start the app running `pyhton3 run.py` from the terminal

# Flask Blueprint

New Blueprints only need to added for completely new functionality.
Currently we only have four blueprints, please add to these before creating a new one.

1) Organisations - Everything to do with listing, updateing and deleting organisations
1) Categories - Everything to do with analysing, clustering and categorising organisations
1) API - Everthing to do with avaiable RESTful APIs
1) Home - A basic home app and any static views

In case a new Blueprint needs to be created, follow the below steps:

1) Add new file in the `app` directory giving it a meaningful and relevant name (e.g. categories)
2) Import `Blueprint` from flask and define your Blueprint

```
from flask import Blueprint
categories = Blueprint("categories", __name__, template_folder='templates')
```

3) Register your Blueprint in the app directory's `__init__.py` file.

```
from app.categories import categories
app.register_blueprint(categories)
```

4) Create a new sub-folder in the app diretory's `templates` folder for your new Blueprint

5) If your Blueprint needs to use mongodb, import mongo from the `app` directory's `__init__.py` file to reuse the PyMongo instance.

```
from app import mongo
```

6) Here is a full example:

categories.py
```
from flask import Blueprint, render_template
from app import mongo
categories = Blueprint("categories", __name__, template_folder='templates')
@categories.route('/')
def view_categories():
categories = mongo.db.categories.find()
return render_template('categories/list_categories.html',
categories=categories)
```

# Directory Structure

Below is an outline of what this project's directory structure can and will look like. Please note that working with the file system is not the focus of this project, but rather the planning of its' directory structure.

Please feel free to add, edit and leave comments and/or notes in this file as you see fit.

Please do not alter the general layout of this template, as markdown can be very sensitive and small spaces, characters, etc. can throw off the whole layout.


__/business-analysis-project
|
|____ app
|___ __init__.py
|___ api.py
|___ authentication.py
|___ categories.py
|___ config.py
|___ home.py
|___ organisations.py
|____ templates
|____ api
|___ list_organisations.html
|____ authentication
|___login.html
|___register.html
|___logout.html
|___reset_password.html
|___user_dashboard.html
|____ categories
|___ clustering.html
|____ home
|___ home.html
|____ organisations
|___ create_organisations.html
|___ edit_organisations.html
|___ list_organisations.html
|___ base.html
|___ navbar.html
|____ functions
|___ __init__.py
|___ company_web_scraper.py
|___ create_cat_from_nace.py
|___ text_rank.py
|____ models
|___ __init__.py
|___ user.py
|____ static
|___ css
|___ style.css
|___ js
|___ script.js
|___ main.js
|____ data
|___ nace_codes.json
|____ docs
|___
|___ .gitignore
|___ .gitpod.yml
|___ env.py.sample
|___ LICENSE
|___ Procfile
|___ README.md
|___ requirements.txt
|___ run.py

# Challenge

- The primary challenge is to query an existing company name dataset, find their website, extract the relevant data which can be queried by search.
Expand Down Expand Up @@ -38,4 +167,4 @@ Contribution will be rewarded with special participation badges and prizes.
# Credit

- Code to create keywords from a text is from Xu Liang.
- [Understand TextRank for Keyword Extraction by Python](https://towardsdatascience.com/textrank-for-keyword-extraction-by-python-c0bae21bcec0)
- [Understand TextRank for Keyword Extraction by Python](https://towardsdatascience.com/textrank-for-keyword-extraction-by-python-c0bae21bcec0)
Loading

0 comments on commit e131799

Please sign in to comment.