# MP Sequence Diagrams
To obtain some context for the diagrams below, see the [Entities & Interactions](https://docs.google.com/spreadsheets/d/1QLi-4d9y6iTpLNluSn9rem0GHsVTyM0mc6_FCK_epDo/edit#gid=301796707) and the [Overview Matrix](https://docs.google.com/spreadsheets/d/1QLi-4d9y6iTpLNluSn9rem0GHsVTyM0mc6_FCK_epDo/edit#gid=1799902653) worksheets.
### Create Schema
Aggregators will compose fields to create schemas and then upload them to the library (a git repo). The library stores schemas created by aggregators. The Steering Group manages the schemas stored in the library and curates the list of fields used to compose schemas.
```mermaid
sequenceDiagram
Aggregator->>Library: Get list of fields
Aggregator->>Aggregator: Draft new schema
Aggregator->>+Library: Post new schema
Library->>Library: Check if new Fields added
opt Info Message
Library->>Steering Group: Inform of proposed <br> new fields
end
Library->>Steering Group: Inform of new schema
Steering Group->>Steering Group: Review new schema <br> (and fields)
Steering Group-->>Library: Accept new schema <br> (and fields)
Library-->>-Aggregator: Confirm schema added
```
### Add Node to Index
Node operators run a node (a website) that they want to have recorded by the index so that aggregators can add them to a map, directory, etc. They use the node UI (a WordPress plugin or a website using HTML/CSS/JavaScript) to select the schema/s they want to use from the library in order to be indexed, and then they fill in the data requested by the schema/s.
```mermaid
sequenceDiagram
Node Operator->>Node UI: Request Schema list
Node UI->>Library: Get Schemas & Fields
Library-->>Node UI: Return Schemas & Fields
Node UI-->>Node Operator: Sees Schemas & Fields
Node Operator->>Node UI: Create new profile
Node UI->>Node: Add profile
Note right of Library: { profileUrl: xyz,<br>name: abc, ... }
Node-->>Node UI: Confirmation file added
Node UI->>+Index: Post notification of new profile
Index->>Node: Confirm profile on Node
Note right of Node: { profileUrl: xyz,<br>name: abc, ... }
Index->>Library: Get Schema and Fields for validation
Index->>Index: Validate file to Schema and Fields
Index-->>Node UI: Return an error if validation fails
Node UI-->>Node Operator: Sees error
Index->>Index: Update Index records with new Node
Index-->>-Node UI: Confirmation of Node being added
Node UI-->>Node Operator: Sees confirmation
```
### Get Nodes for Aggregation
Aggregators use the index to find nodes that have created data according to the schemas that the aggregators are interested in aggregating for their directories, maps, etc.
```mermaid
sequenceDiagram
Aggregator App->>Library: Request list of Schemas
Library-->>Aggregator App: Return list of Schemas
Aggregator App->>Index: Get Nodes using Schema X
Index-->>Aggregator App: Return list of Node profile URLs using Schema X
Aggregator App->>Node A: Get profile
Node A-->>Aggregator App: Return profile
Aggregator App-->>Aggregator App: Add Node data to Aggregator DB
Aggregator App->>Node B: Get profile
Node B-->>Aggregator App: Return profile
Aggregator App-->>Aggregator App: Add Node data to Aggregator DB
Aggregator App-->>Aggregator App: Create map, directory, etc.
App User->>Aggregator App: View map, directory, etc.
```