Empty data directory and script for adding sample data #17

Closed
opened 2024-10-25 14:55:57 +02:00 by Frank · 6 comments
Owner

Users with existing data should not have to remove sample data.
For them the data dir should be empty.

For users without data, provide a script that creates sample data.
The trips in the sample data shall be current, e.g for $tomorrow.
Thats why we can not have static sample data.

Users with existing data should not have to remove sample data. For them the data dir should be empty. For users without data, provide a script that creates sample data. The trips in the sample data shall be current, e.g for $tomorrow. Thats why we can not have static sample data.
Csaba was assigned by Frank 2024-10-25 14:55:57 +02:00
Frank added this to the Amarillo project 2024-10-25 14:55:57 +02:00
Author
Owner

TBD the data dir could be in amarillo-core and/or amarillo-compose

Use case

  • admin with existing data
  • new user wanting to play around quickly
    • the there should be a lot of interesting data to play with, not just 1 trip
  • developer, usually knowing what he is doing
TBD the data dir could be in amarillo-core and/or amarillo-compose Use case - admin with existing data - new user wanting to play around quickly - the there should be a lot of interesting data to play with, not just 1 trip - developer, usually knowing what he is doing
Owner

there should be a lot of interesting data to play with, not just 1 trip

If there are many trips, I wouldn't cram it all into the one script, rather separate the data.
Actually, a good way i can think of is to write this as a python script, have a list of locations, then generate connections between them. This way we can compactly define many trips and also easily scale up and down how many trips are generated

> there should be a lot of interesting data to play with, not just 1 trip If there are many trips, I wouldn't cram it all into the one script, rather separate the data. Actually, a good way i can think of is to write this as a python script, have a list of locations, then generate connections between them. This way we can compactly define many trips and also easily scale up and down how many trips are generated
Author
Owner

Create a bash script.

  • create user with random api key printed to console, see file
  • create "sampleagency"
  • create 4 trips
    1. Stuttgart to Berlin $today at 18:00
    2. Stuttgart to Frankfurt $tomorrow at 18:00
    3. Stuttgart to Herrenberg every weekday 7:00
    4. Stuttgart to München one week ahead at 12:00
  • use echo JSON_HERE_WITH_MULTILINE > some_file
Create a bash script. - create user with random api key printed to console, see file - create "sampleagency" - create 4 trips 1. Stuttgart to Berlin $today at 18:00 2. Stuttgart to Frankfurt $tomorrow at 18:00 3. Stuttgart to Herrenberg every weekday 7:00 4. Stuttgart to München one week ahead at 12:00 - use echo JSON_HERE_WITH_MULTILINE > some_file
Owner

Create a bash script.

  • create user with random api key printed to console, see file
  • create "sampleagency"
  • create 4 trips
    1. Stuttgart to Berlin $today at 18:00
    2. Stuttgart to Frankfurt $tomorrow at 18:00
    3. Stuttgart to Herrenberg every weekday 7:00
    4. Stuttgart to München one week ahead at 12:00
  • use echo JSON_HERE_WITH_MULTILINE > some_file

If there is no data on startup, prompt user to run the script

> Create a bash script. > - create user with random api key printed to console, see file > - create "sampleagency" > - create 4 trips > 1. Stuttgart to Berlin $today at 18:00 > 2. Stuttgart to Frankfurt $tomorrow at 18:00 > 3. Stuttgart to Herrenberg every weekday 7:00 > 4. Stuttgart to München one week ahead at 12:00 > - use echo JSON_HERE_WITH_MULTILINE > some_file If there is no data on startup, prompt user to run the script
Owner

I created the sample data script
71942e852f

TBD: Since the enhancer is stateless, it has no idea that there are new trips from running the sample script that need to be enhanced. Normally amarillo sends requests to enhance trips, but here we are creating trips from outside. We need to change it so the main amarillo recognizes on startup that there are some trips that are not enhanced and send them to enhancer.

I created the sample data script https://github.com/mfdz/amarillo/pull/34/commits/71942e852f604fbeeb52624757fff8934bb206bb TBD: Since the enhancer is stateless, it has no idea that there are new trips from running the sample script that need to be enhanced. Normally amarillo sends requests to enhance trips, but here we are creating trips from outside. We need to change it so the main amarillo recognizes on startup that there are some trips that are not enhanced and send them to enhancer.
Owner

TBD: Since the enhancer is stateless, it has no idea that there are new trips from running the sample script that need to be enhanced. Normally amarillo sends requests to enhance trips, but here we are creating trips from outside. We need to change it so the main amarillo recognizes on startup that there are some trips that are not enhanced and send them to enhancer.

This is done in #24

  • create user with random api key printed to console, see file
  • create "sampleagency"
  • create 4 trips
    1. Stuttgart to Berlin $today at 18:00
    2. Stuttgart to Frankfurt $tomorrow at 18:00
    3. Stuttgart to Herrenberg every weekday 7:00
    4. Stuttgart to München one week ahead at 12:00

Status:
These 4 trips are included in the /sampledata folder of amarillo-compose.
There is an update_sample_data.sh script that can replace the dates in the sample data for current ones.

> TBD: Since the enhancer is stateless, it has no idea that there are new trips from running the sample script that need to be enhanced. Normally amarillo sends requests to enhance trips, but here we are creating trips from outside. We need to change it so the main amarillo recognizes on startup that there are some trips that are not enhanced and send them to enhancer. This is done in https://git.gerhardt.io/amarillo/amarillo-core/issues/24 > > - create user with random api key printed to console, see file > > - create "sampleagency" > > - create 4 trips > > 1. Stuttgart to Berlin $today at 18:00 > > 2. Stuttgart to Frankfurt $tomorrow at 18:00 > > 3. Stuttgart to Herrenberg every weekday 7:00 > > 4. Stuttgart to München one week ahead at 12:00 Status: These 4 trips are included in the [/sampledata](https://github.com/mfdz/amarillo-compose/tree/main/sampledata) folder of amarillo-compose. There is an [update_sample_data.sh](https://github.com/mfdz/amarillo-compose/blob/main/update_sample_data.sh) script that can replace the dates in the sample data for current ones.
Csaba closed this issue 2025-01-29 12:05:34 +01:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: amarillo/amarillo-core#17
No description provided.