From 17e89da0d8113adec5889808b2f12e153afbbc9d Mon Sep 17 00:00:00 2001 From: Philipp Horstenkamp Date: Mon, 4 Sep 2023 19:48:14 +0200 Subject: [PATCH] Repo struktur dokumentieren (#75) --- CONTRIBUTING.md | 46 +++++++++---------- README.md | 34 ++++++++++++-- documentations/index.rst | 5 ++ .../ai/__init__.py | 1 + .../config/__init__.py | 2 +- 5 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 src/aki_prj23_transparenzregister/ai/__init__.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 71ba65a..ac2c1ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,32 +11,26 @@ - [Install the python Project](https://python-poetry.org/docs/basic-usage/#installing-dependencies) - [Install pre-commit](https://pre-commit.com/#install) -## Setup +## Repository structure -### Connection strings +- **src/`aki_prj23_transparenzregister`**: + - This subfolder/`package` contains several subdirectories: + - `ai`: + - Houses AI models and pipelines, including NER and sentiment analysis. + - `config`: + - Contains configuration files such as database connection strings and model files. + - `models`: + - Stores data models. + - `ui`: + - Manages the user interface and dash interface. + - `utils`: + - Contains general tooling functions, including database access and other miscellaneous functions. -Create a `secrets.json` in the root of this repo with the following structure (values to be replaces by desired config): - -```json - { - "postgres": { - "username": "postgres", - "password": "postgres", - "host": "localhost", - "database": "postgres", - "port": 5432 - }, - "mongo": { - "username": "username", - "password": "password", - "host": "localhost", - "database": "transparenzregister", - "port": 27017 - } -} -``` - -Example usage see [connector.py](./src/aki_prj23_transparenzregister/utils/postgres/connector.py) +- **tests**: + - Test files organized in a mirrored structure of the 'src' folder. Please at least import every python file you + add. + Please Try to test every function with a test that compares with an example result. If that is not possible it + would be best to find a big consensus that only limited testing is required. ## Code style @@ -49,6 +43,10 @@ We defined to use the following formats: - Import Order by [isort](https://pycqa.github.io/isort/) - Strict Typing of function headers see the examples provided by the [mypy](https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html) documentation. +- The generell linting is done by ruff but since ruff is a reimplementation of ruff of many different linters the old + documentations are still valid. +- Ruff can be executed with the `ruff .` command. May errors are auto-fixable with `ruff --fix .` if they are straight + forward changes. ## Language diff --git a/README.md b/README.md index bef0fbe..bc669d1 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,39 @@ # aki_prj23_transparenzregister -[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) +[![python](https://img.shields.io/badge/Python-3.11-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org) [![Actions status](https://github.com/astral-sh/ruff/workflows/CI/badge.svg)](https://github.com/astral-sh/ruff/actions) -[![Pytest](https://github.com/fhswf/aki_prj23_transparenzregister/actions/workflows/test-action.yaml/badge.svg?branch=main)](https://github.com/fhswf/aki_prj23_transparenzregister/actions/workflows/test-action.yaml) -[![Python-Lint-Push-Action](https://github.com/fhswf/aki_prj23_transparenzregister/actions/workflows/lint-actions.yaml/badge.svg)](https://github.com/fhswf/aki_prj23_transparenzregister/actions/workflows/lint-actions.yaml) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) +[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) +[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) +[![Documentation Status](https://readthedocs.org/projects/mypy/badge/?version=stable)](https://mypy.readthedocs.io/en/stable/?badge=stable) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ## Contributions See the [CONTRIBUTING.md](CONTRIBUTING.md) about how code should be formatted and what kind of rules we set ourselves. -[![bandit](https://github.com/fhswf/aki_prj23_transparenzregister/actions/workflows/bandit-action.yaml/badge.svg)](https://github.com/fhswf/aki_prj23_transparenzregister/actions/workflows/bandit-action.yaml) +## DB Connection settings + +To connect to the SQL db see [sql/connector.py](./src/aki_prj23_transparenzregister/utils/postgres/connector.py) +To connect to the Mongo db see [connect] + +Create a `secrets.json` in the root of this repo with the following structure (values to be replaces by desired config): + +```json + { + "postgres": { + "username": "postgres", + "password": "postgres", + "host": "localhost", + "database": "postgres", + "port": 5432 + }, + "mongo": { + "username": "username", + "password": "password", + "host": "localhost", + "database": "transparenzregister", + "port": 27017 + } +} +``` diff --git a/documentations/index.rst b/documentations/index.rst index 4a4ec1d..20efae3 100644 --- a/documentations/index.rst +++ b/documentations/index.rst @@ -4,6 +4,11 @@ Transparenzregister Dokumentation ================================= This is the documentation for the AKI project group on the german transparenzregister and an Analysis there of. +.. include:: ../README.md + :parser: myst_parser.sphinx_ +.. include:: ../CONTRIBUTING.md + :parser: myst_parser.sphinx_ + .. toctree:: :maxdepth: 3 :caption: Project Management diff --git a/src/aki_prj23_transparenzregister/ai/__init__.py b/src/aki_prj23_transparenzregister/ai/__init__.py new file mode 100644 index 0000000..3166040 --- /dev/null +++ b/src/aki_prj23_transparenzregister/ai/__init__.py @@ -0,0 +1 @@ +"""This module contains all the ai pipelines.""" diff --git a/src/aki_prj23_transparenzregister/config/__init__.py b/src/aki_prj23_transparenzregister/config/__init__.py index 2730631..f5d43d4 100644 --- a/src/aki_prj23_transparenzregister/config/__init__.py +++ b/src/aki_prj23_transparenzregister/config/__init__.py @@ -1 +1 @@ -"""App configuration.""" +"""App configuration tools."""