aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
author ClarkeCode <clarke.john.robert@gmail.com>2023-03-15 06:23:37 +0100
committer ClarkeCode <clarke.john.robert@gmail.com>2023-03-15 06:23:37 +0100
commitf87f24c6fd9196cdef315efa96b19b3df5532c69 (patch)
tree9f820e035d36060a651cfcaf1f3e15e2825af732 /docs
parentf1873046a5607e672939d25beb09a5ed824a4b73 (diff)
Re-evaluated approach for dataloading
Diffstat (limited to 'docs')
-rw-r--r--docs/simulation/provinces.md74
1 files changed, 60 insertions, 14 deletions
diff --git a/docs/simulation/provinces.md b/docs/simulation/provinces.md
index 014735c..88eea50 100644
--- a/docs/simulation/provinces.md
+++ b/docs/simulation/provinces.md
@@ -10,10 +10,13 @@ classDiagram
string tradeGood
Int64 lifeRating
bool hasLegalSlavery
+
Int64 fortLevel
Int64 navalBaseLevel
Int64 railroadLevel
+ string regionId
+ string continentId
}
```
<!-- The following attributes will need to be added when Nations are added
@@ -22,21 +25,18 @@ classDiagram
NationId[] coreNations
-->
-## Dataloading
+# Dataloading
+To populate the Province structures, the following data files will be loaded in the following order:
+1. `provinces.json`
+2. `regions.json`
+3. `continents.json`
+
+## 1. Provinces.json
The `provinces.json` file shall look like:
```json
{
"provinces": [
- ...
- ],
-
- "regions": [
- {"id": "", "name": "", "provinceIds": [...]},
- ...
- ],
-
- "continents": [
- {"id": "", "name": "", "provinceIds": [...]},
+ {"id": 123, "provinceName": "abc", ...},
...
]
}
@@ -52,7 +52,53 @@ Where the `"provinces"` array contains valid province JSON objects which conform
| fortLevel | int | optional | 0 |
| navalBaseLevel | int | optional | 0 |
| railroadLevel | int | optional | 0 |
-
-### Notes on values
+### Notes on values:
- The values of `fortLevel`, `navalBaseLevel`, and `railroadLevel` may not be negative
-- The value of `tradeGood` may only be a Good Identifier string as defined in [goods.md](goods.md) or `"no_good"` \ No newline at end of file
+- The value of `tradeGood` may only be a Good Identifier string as defined in [goods.md](goods.md) or `"no_good"`
+
+
+## 2. Regions.json
+The `regions.json` file shall look like:
+```json
+{
+ "regions": [
+ {"id": "abc", "provinceIds": [123, 456, ...]},
+ ...
+ ]
+}
+```
+Where the `"regions"` array contains valid region JSON objects which conform to the following key-value pairs:
+| Key | type | Required? | Default Value |
+|--|--|--|--|
+| id | string | required | N/A |
+| provinceIds | Array[int] | required | N/A |
+### Notes on values:
+- The value of `id` may not be an empty string
+- The value of `id` must be unique among all continents
+- `provinceIds` may be an empty array; an empty array should be logged as a warning
+- The content of `provinceIds` may only be Province Identifier integers as defined above
+- A province may only belong to a single region, any attempts to re-assign a province's region during dataloading should be ignored and logged as an error
+
+
+
+## 3. Continents.json
+The `continents.json` file shall look like:
+```json
+{
+ "continents": [
+ {"id": "abc", "provinceIds": [123, 456, ...]},
+ ...
+ ]
+}
+```
+Where the `"continents"` array contains valid continent JSON objects which conform to the following key-value pairs:
+| Key | type | Required? | Default Value |
+|--|--|--|--|
+| id | string | required | N/A |
+| provinceIds | Array[int] | required | N/A |
+### Notes on values:
+- The value of `id` may not be an empty string
+- The value of `id` must be unique among all continents
+- `provinceIds` may be an empty array; an empty array should be logged as a warning
+- The content of `provinceIds` may only be Province Identifier integers as defined in [provinces.md](provinces.md)
+- A province may only belong to a single continent, any attempts to re-assign a province's continent during dataloading should be ignored and logged as an error