You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55
Original file line number
Diff line number
Diff line change
@@ -531,3 +531,58 @@ If a test case fails because the `com.microsoft.sqlserver.jdbc.SQLServerExceptio
531
531
the error message says that it cannot find a database object, the problem is that the script which
532
532
creates the source MSSQL database (_docker/mssql_init/populate.sql_) was changed. You can solve this problem by running the command:
533
533
`./development.sh recreate` at command prompt.
534
+
535
+
---
536
+
537
+
## Jore3 stop import script
538
+
539
+
### Requirements
540
+
541
+
You need to have Python 3 installed on your system to run the script
542
+
543
+
#### Virtual environment
544
+
545
+
To run Python scripts with required libraries you should setup a virtual environment which contains the requirements for the script. To setup an environment, run:
546
+
547
+
`python3 -m venv LOCATION/OF/ENVIRONMENT/HERE`
548
+
549
+
Where you should replace the location with one you want to use. For example a directory under your home directory.
550
+
To use the environment you can either source the virtual environment by running:
Which allows you to use the binaries directly as `python importer.py`
555
+
556
+
Or you can use the virtual environment python directly: `LOCATION/OF/ENVIRONMENT/HERE/bin/python importer.py`
557
+
558
+
#### Script setup
559
+
560
+
You need to run the `import.py` script using Python 3 and it requires the following libraries:
561
+
562
+
- pymssql
563
+
- requests
564
+
- simplejson
565
+
566
+
They can be installed by running `pip install -r requirements.txt`
567
+
568
+
### How to use
569
+
570
+
To run the stop registry importer script you need to have a Jore3 database, a populated Jore4 routes database, Jore4 Hasura and Jore4 Tiamat running.
571
+
572
+
By default the script runs from the local jore3 test database and uses the base local Jore4 Hasura instance as the target.
573
+
You can change the source database and target Hasura instance by creating a `.env` file in the same directory as the script.
574
+
575
+
Set the values for variables you want to set:
576
+
577
+
```
578
+
GRAPHQL_URL=
579
+
GRAPHQL_SECRET=
580
+
JORE3_USERNAME=
581
+
JORE3_PASSWORD=
582
+
JORE3_DATABASE_URL=
583
+
JORE3_DATABASE_NAME=
584
+
```
585
+
586
+
You should have run the base Jore3 importer first which ensures the Jore4 database has the required scheduled stop points. Then run the stop registry import script which will match scheduled stop points in the Jore4 routes database with stops in the Jore3 database and generate GraphQL mutations to Hasura/Tiamat according to the data. The script will also link the generated stop registry stops with the scheduled stop points by their NeTEx ID using Hasura for the mutation.
587
+
588
+
Running the script will produce multiple errors as there are many stops in the Jore3 database with overlapping validity. These can be ingored as only the most recent one is the one which ends up being imported.
0 commit comments