Skip to content

Commit

Permalink
Merge pull request #381 from Deltares/docs/354-extend-general-overvie…
Browse files Browse the repository at this point in the history
…w-documentation

Docs/354 extend general overview documentation
  • Loading branch information
Carsopre authored Mar 25, 2024
2 parents 40976c7 + fa0a90d commit 3c7513a
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 1,327 deletions.
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Directories created during build of SPHINX
build/**
docs/**
272 changes: 0 additions & 272 deletions docs/_diagrams/ra2ce_analysis.drawio

This file was deleted.

Binary file removed docs/_diagrams/ra2ce_analysis.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
306 changes: 0 additions & 306 deletions docs/_diagrams/ra2ce_network.drawio

This file was deleted.

Binary file removed docs/_diagrams/ra2ce_network.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
726 changes: 0 additions & 726 deletions docs/_diagrams/ra2ce_overview.drawio

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/_diagrams/ra2ce_v0_3_0.drawio

This file was deleted.

13 changes: 13 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import sys
from distutils.dir_util import copy_tree
import sphinx_autosummary_accessors
from pathlib import Path

# This is not needed
sys.path.insert(0, os.path.abspath(".."))
Expand All @@ -48,9 +49,21 @@ def remove_dir_content(path: str) -> None:
remove_dir_content("build")
if os.path.isdir("_examples"):
remove_dir_content("_examples")

os.makedirs("_examples")
copy_tree("../examples", "_examples")

if os.path.isdir("docs"):
remove_dir_content("docs")

_src_diagrams = "../docs/_diagrams/"
_dst_diagrams = "docs/_diagrams/"
os.makedirs(_dst_diagrams)
for _img_file in os.listdir(_src_diagrams):
if not _img_file.endswith(".png"):
continue
shutil.copy((_src_diagrams + _img_file), (_dst_diagrams + _img_file))

# -- General configuration ---------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down

This file was deleted.

This file was deleted.

8 changes: 8 additions & 0 deletions docs/technical_documentation/analysis_package.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _analysis_package:

============
Analysis
============

.. include:: ../../ra2ce/analysis/README.md
:parser: myst_parser.sphinx_
6 changes: 5 additions & 1 deletion docs/technical_documentation/technical_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ Technical Documentation
:caption: Table of Contents
:maxdepth: 2

network_package
network_package
analysis_package

.. include:: ../../ra2ce/README.md
:parser: myst_parser.sphinx_
29 changes: 29 additions & 0 deletions ra2ce/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# RA2CE

## Ra2ce semantics

- `ra2ce` is a [package](https://packaging.python.org/en/latest/tutorials/packaging-projects/),
- everything else with an `__init__.py` is a subpackage (often written as (sub-)package).
- single `.py` files are [modules](https://docs.python.org/3/tutorial/modules.html),
- from a business perspective an `analysis` might be a module, but technically it can be implemented either as a (subpackage) or a module.

## Structure description

This package is divided into different (sub-)packages, the most relevants being the following:

- `network`, this (sub-)package contains the logic to retrieve a normalized data structure capable of representing all the required properties of a network for its later analysis.
- `analysis`, this (sub-)package is responsible to execute an analysis (`direct` or `indirect`) for the given network.
- `runners`, this (sub-)package encapsulates the logic to automatize an analysis of a ra2ce model.

Other (sub-)packages carry a more 'supporting' role, such as:

- `common`, a (sub-)package mostly contaning generic definitions as protocols (`typing.Protocol`) to be used across the whole project.
- `configuration`, a subpackage responsible to parse the ra2ce `.ini` configuration files (for network and analysis) into their corresponding dataclasses. It is worth mentioning this subpackage is explicitely outside `common` to avoid circular dependencies with the `analysis` and `network` subpackages.

## General class overview

A general overview of the package relationships can be seen in the following diagram.

| ![ra2ce_package_overview.drawio.png](/docs/_diagrams/ra2ce_package_overview.drawio.png)|
|:--:|
| *Ra2ce package overview* |
2 changes: 1 addition & 1 deletion ra2ce/analysis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Each analysis should comply to the `AnalysisProtocol`.
## General class overview
The following diagram describes the relations between the most relevant entities of the `ra2ce.analysis` (sub-)package.

| ![ra2ce_analysis.jpg](../../docs/_diagrams/ra2ce_analysis.png)|
| ![ra2ce_analysis_class_diagram.drawio.png](/docs/_diagrams/ra2ce_analysis_class_diagram.drawio.png)|
|:--:|
| *Ra2ce analysis overview* |

Expand Down
13 changes: 5 additions & 8 deletions ra2ce/network/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# Network

In this package you will find all logic required to load network data from diverse sources (file or web based).
In this (sub-)package you will find all logic required to load network data from diverse sources (file or web based).

The configuration to be used to load a network is usually an `.ini` file. This file is later represented as a `NetworkConfigData` object that can as well be directly initialized via code (`network_config_data` (sub)package).
The configuration to be used to load a network is usually an `.ini` file. This file is later represented as a `NetworkConfigData` object that can as well be directly initialized via code (`network_config_data` (sub-)package).

The different sources to generate a network are handled through our own network wrappers (`NetworkWrapperProtocol`) in the `network_wrappers` (sub)package.
The different sources to generate a network are handled through our own network wrappers (`NetworkWrapperProtocol`) in the `network_wrappers` (sub-)package.


## General class overview

The following diagram describes the relations between the most relevant entities of the `ra2ce.network` (sub-)package.

| ![ra2ce_network.jpg](../../docs/_diagrams/ra2ce_network.png)|
| ![ra2ce_network_class_diagram.drawio.png](/docs/_diagrams/ra2ce_network_class_diagram.drawio.png)|
|:--:|
| *Ra2ce network overview* |

Add class diagram
Add flowchart diagram of loading a diagram
| *Ra2ce network overview* |

0 comments on commit 3c7513a

Please sign in to comment.