Commit 56d62d53 authored by Knut Behrends's avatar Knut Behrends
Browse files

add USAGE.md

parent fe85f1ce
......@@ -4,7 +4,9 @@
A set of scripts generating fake-data and testdata for a new mDIS instance.
Written in Javascript for the Node Platform.
Written in Javascript for the Node Platform (v14+).
For details: read [USAGE.md](USAGE.md)
knb@gfz-potsdam.de
......
# dis-datagen
## USAGE
A set of scripts generating fake-data and testdata for a new mDIS instance.
Written in Javascript for the Node Platform v14+
You must use node v14 because the JS code internaly uses the `?.` 'optional chaining' operator as a shortcut for definedness of nested object properties.
### Inserting fake data
First, cd into the `bin/` subdirectory to execute Shell scripts,
or enter the `src/`subdirectory to execute node scripts.
#### Inserting a Fake Program
#### Inserting a Fake Expedition
#### Inserting a Fake Site
#### Inserting a Fake Hole
#### Inserting a Fake Core
#### Inserting a Fake Section
#### Inserting a Fake Split
Command:
```sh
node src/split-inserter.js -c 118 # -c stands for core
```
Expected outputs:
```sh
/api/v1/form?name=split&per-page=-1&page=1&sort=section&filter[core_id]=118
Stop early. Core 5363_A_AB_14_1 (id 118) and its 2 sections
seems to be split already, at least partially.
Maybe create the missing split sections manually.
Map(2) {
'5363_A_AB_14_1' => { A: 1, W: 1, WR: 1 },
'5363_A_AB_14_2' => { A: 1, W: 1, WR: 1 }
}
```
### Querying the List-values table
Get value list names, and get all items of that list.
#### Get value list names
```js
node list-values.js -a
[
'ABUNDANCE',
'ACCESSORIES',
'ACTIVITY_TYPE',
] // and ~ 100 more
```
#### Get all entries of a single value list, filtered by na
Get all entries of a single value list, filtered by name
optionally.
-d values only, or
-e value+remark/labeltext paired
```sh
node list-values.js -n CITIES -e
```
##### Expected result
```js
{
Aarau: 'Aargau, Switzerland',
Aarhus: 'Central Jutland, Denmark',
Abiko: 'Chiba, Japan',
Abo: 'Finland Proper, Finland',
}
```
### Configuration
To use the scripts you must get a Bearer token for the REST API first. Add it either as an environment variable, or insert it at the top of the `src/config` file.
......@@ -199,7 +199,7 @@ Core ${options.core_id}: Created A- and W- splits for ${fake_split_promises.len
axutil.update_item(ax, url, put_data, s.id).then((updated) => {
console.log(
{
"'still_exists' is now:": updated?.data?.exists,
"'still_exists' is now:": `${updated?.data?.exists}`,
},
{ [`id_${updated?.data?.combined_id}`]: updated?.data?.id }
)
......@@ -217,7 +217,7 @@ Core ${options.core_id}: Created A- and W- splits for ${fake_split_promises.len
axutil
.update_item(ax, url, put_data, options.core_id)
.then((updated) => {
console.table(
console.log(
{ url: url, "'oriented/split' is now:": updated?.data?.oriented },
{ [`id_${updated?.data?.comments}`]: updated?.data?.id }
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment