Skip to content

Commit 478ec9d

Browse files
scalbertmSCALBERT Mathieu
andauthored
Update readme (#19)
Co-authored-by: SCALBERT Mathieu <[email protected]>
1 parent c709977 commit 478ec9d

File tree

1 file changed

+92
-3
lines changed

1 file changed

+92
-3
lines changed

README.md

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,95 @@
11
# Griddyna-App
22

3-
Template app that bootstraps the creation of gridsuite apps.
4-
The template setup the authentication mechanism and provide a configured empty application.
3+
This app has for main goal to create a mapping between equipments of a network, and their dynamic model representation.
4+
This mapping is a tool to quickly create data sets for the dynamic simulations of electric networks.
55

6-
To customize this repository for an app, search and replace the string XXX with the name of the app. For example, GridXXX -> GridFoo, gridXXX-app -> gridfoo-app.
6+
The main result of the app is, for now, a script that can be used to generate the .dyd file that can be fed to the
7+
simulators. It can also manage, for a given network, to create the .par file that can instantiate the model using data
8+
specific (or not) to the network.
9+
10+
Finally, the app gives a preview of how different equipments of the network will be modeled using the selected mapping.
11+
12+
## Front-End Architecture
13+
14+
The code is sorted into three main parts:
15+
16+
### 1) Components
17+
18+
They are what the user **sees**, their sole function is to display the data to the user and present how to modify it.
19+
20+
**There is no data processing logic in the components**, only display logic is present.
21+
22+
This project use [atomic-design](https://bradfrost.com/blog/post/atomic-web-design/) to sort components and avoid
23+
writing several times the same function/display.
24+
25+
a) "Atoms" are meant to be the smallest generic components(e.g. Buttons), and are meant to be reused.
26+
27+
b) "Molecules" are slightly bigger components that still aims to be generic, but have a more complex function to fill.
28+
They are usually groups of atoms.
29+
30+
_The distinction between Atoms and Molecules is difficult and no two project will have the same distinction, but both
31+
types have the same goal: provide generic reusable components._
32+
33+
c) "Organisms" are groups of molecules and/or other organisms. This is where the work-specific display is, they are a
34+
complex, distinct section of the interface. For instance a complete form for the user to fill using the project data.
35+
36+
d) "Templates" goal is to organize the different organisms on the display to form the pages. They are the layout of the
37+
application.
38+
39+
### 2) Containers
40+
41+
Containers are the links between the presentational components and the data. There is usually one container for each
42+
work-specific concern, they can be nested to enhance readability.
43+
44+
They subscribe to the data store relevant to their specific concern and instantiate the functions that modify the data
45+
store. They then instantiate the presentational components with ready-to-display data and functions to call.
46+
47+
There is usually no or little display associated with a Container
48+
49+
_This is not where the data is processed in this project, the containers call specific selectors to receive only the
50+
data relevant to them, **containers role is only to prepare side effects and link the Model with the View**._
51+
52+
### 3) Data Store
53+
54+
This is where **all** front-end data is stored, fetched and processed. All interactions with the data happens in this
55+
section.
56+
57+
This project use [`redux-toolkit`](https://redux-toolkit.js.org/) (RTK) to manage data and how data is processed is
58+
heavily influenced by its concepts.
59+
60+
First, the data store is organised into _slices_ that are (conceptually and often literally) related to back-end
61+
services. Each slice contains the data relevant to one particular function of the application.
62+
63+
Each slice possesses the following:
64+
65+
#### a) Data state
66+
67+
This is the single source of truth of your applications, from where all the data needed by the function are accessed and
68+
derived. **No data is redundant, there is no derived value here.**
69+
70+
#### b) Selectors
71+
72+
Selectors are the functions called by the Containers to retrieve the data needed by the presentational components, all
73+
derived data should be obtained from a selector.
74+
75+
A selector has for argument the state of the slice. It is possible to add other arguments to selector by using
76+
`React.useMemo` and `RTK.createSelector` to customise the fetched data. `RTK.createSelector can also be used to combine
77+
reducers to create a more complex one.
78+
79+
_There is no inherent reason to not have Selectors fetching data from separate slices, however, in most cases, it is
80+
unnecessary if the slices are well conceived._
81+
82+
#### c) Reducers
83+
84+
Reducers are the functions to edit the state data. **This is the only way for the front-end to edit it.**
85+
86+
They are functions taking the state and an action from a Container as arguments to modify the state.
87+
88+
#### d) ExtraReducers
89+
90+
ExtraReducers are also reducers, but they are related to asynchronous functions. They are the way for the front-end to
91+
interact with the server.
92+
93+
In the slice are defined functions created by `RTK.createAsyncThunk` that make REST calls (using `fetch`). The state can
94+
then be changed according to the result (or the error) received by the server. These functions are called by the
95+
containers.

0 commit comments

Comments
 (0)