Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -890,5 +890,8 @@ docs/_linkcheck/
*.xls
*.xlsx

# Font file
*.ttf

# ignoring all contents of top level data folder
data/
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.8.3
hooks:
- id: bandit
name: bandit - Checks for vulnerabilities
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.12
hooks:
# Run ruff linter.
- id: ruff-check
types_or: [ python, pyi ]
args: [ --fix ]
# Run ruff formatter.
- id: ruff-format
types_or: [ python, pyi ]
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ Your file structure should look like the following. Text in red are the folders

[Clicking this link will open the image in a separate window to allow you to zoom in if needed.](https://github.com/user-attachments/assets/196538ad-8df7-4011-a696-8d7744501260)

### 4.3.6 Running the pipeline
### 4.3.6 Download specific font
To create the horizontal bar chart, the Open Sans font is required.
Download the Open Sans font from https://fonts.google.com/specimen/Open+Sans
Manually save the downloaded font folder within the Data folder, output_data, bar_charts.

### 4.3.7 Running the pipeline
The entry point for the pipeline is stored within the package and called `main_pipeline.py`.
To run the pipeline, run the following code in the terminal (either in the root directory of the
project, or by specifying the path to `main_pipeline.py` from elsewhere).
Expand Down Expand Up @@ -227,6 +232,4 @@ This project structure is based on the [`govcookiecutter` template project][govc
If you want to help us build and improve `area_classification`, please take a look at our [contributing guidance][contributing].

# 11.0 Contacts
[ONS Geography inbox](mailto:ons.geography@ons.gov.uk)


[ONS Geography inbox](mailto:ons.geography@ons.gov.uk)
11 changes: 5 additions & 6 deletions area_classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import sys
from pathlib import Path

#This ensures that when the log prints it includes the time, the level and the message associated
logging_str = (
"%(asctime)s - %(levelname)s - %(message)s"
)
# This ensures that when the log prints it includes the time, the level and the message associated
logging_str = "%(asctime)s - %(levelname)s - %(message)s"

# Get the root directory by going up two levels
root_dir = Path(__file__).resolve().parents[1]
Expand All @@ -15,11 +13,12 @@
os.makedirs(log_dir, exist_ok=True)
log_filepath = os.path.join(log_dir, "running_log.log")

#If level is set to INFO it won't show DEBUG messages. DEBUG includes all messages associated with this repo.
# If level is set to INFO it won't show DEBUG messages. DEBUG includes all
# messages associated with this repo.
logging.basicConfig(
level=logging.INFO,
format=logging_str,
handlers=[logging.FileHandler(log_filepath), logging.StreamHandler(sys.stdout)],
)

logger = logging.getLogger("area_classification")
logger = logging.getLogger("area_classification")
Loading