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
The panel loader is designed to read a CSV file and load the data onto the HMDA-Platform. The CSV file should use the `|` (pipe) delimiter, and should include a header row as the first line.
3
+
The panel loader is designed to read a CSV file of institution data and load them onto the HMDA-Platform. It can be used to load data either into a local Cassandra instance or a remote one (e.g. in a cluster).
5
4
6
-
## Environment Variables
5
+
## The Panel File
7
6
8
-
For testing on an API running in SBT, no changes need to be made. The default for this variable will point to the correct local admin API.
7
+
The CSV file should use the `|` (pipe) delimiter, and should include a header row as the first line.
8
+
9
+
A small example file (~200 institutions) is located at `panel/src/main/resources/inst_data_2017_dummy.csv`
10
+
11
+
The real panel file (~160,000 institutions) is located at `panel/src/main/resources/inst_data_2017.csv`
12
+
13
+
14
+
## Loading Institutions Remotely
15
+
16
+
For loading panel data into a remote system or into a local Docker container, you don't need to have any services running on your local environment as dependencies. You will need to set the `HMDA_HTTP_ADMIN_URL` environment variable.
9
17
10
-
For loading panel data into a remote system or into a local Docker container, you'll need to set the following environment variable:
11
18
```shell
12
-
>export HMDA_HTTP_ADMIN_URL={base URL}
19
+
>export HMDA_HTTP_ADMIN_URL={admin URL}
13
20
```
14
21
15
22
**IMPORTANT NOTE:** The base URL should *include*`http://` or `https://`, but *exclude* any trailing backslash `/`. For example:
16
23
24
+
To load panel data into the cluster, simply find the URL of the admin API (for the release branch: `https://hmda-ops-api.demo.cfpb.gov/admin`).
25
+
26
+
To load panel data into a Docker container running locally, the URL will depend on your Docker Machine's IP. If it uses the default IP, this will be the admin API URL:
A small example file (~200 institutions) is located at `panel/src/main/resources/inst_data_2017_dummy.csv`
31
+
Once that variable is set, use the instructions in [Running the Loader](#running-the-loader) to load the data.
23
32
24
-
The real panel file (~160,000 institutions) is located at `panel/src/main/resources/inst_data_2017.csv`
25
33
26
-
In order for the panel data to be loaded locally, the API project must be up and running, along with Docker containers running Cassandra and Zookeper, or run the full `docker-compose` setup. To load panel data into the cluster, simply find the URL of the admin api (for the release branch: `https://hmda-ops-api.demo.cfpb.gov/admin`). No other running services are necessary.
34
+
## Loading Institutions Locally
35
+
36
+
In order for the panel data to be loaded locally, the API project must be up and running, along with Docker containers running Cassandra, PostgreSQL, and Zookeper. Once the dependencies are running, use the instructions in [Running the Loader](#running-the-loader) to load the data.
37
+
38
+
### Running the Dependencies
39
+
40
+
#### Cassandra
41
+
42
+
The easiest way to run a Cassandra server to support this application for testing is to do it through Docker:
* Set the environement variables for Zookeper. `ZOOKEEPER_HOST` uses your Docker Machine's IP address. In this example, we use the default Docker Machine IP:
76
+
77
+
```shell
78
+
export ZOOKEEPER_HOST=192.168.99.100
79
+
export ZOOKEEPER_PORT=2181
80
+
```
81
+
82
+
* Set the environment variables for the local Cassandra instance. `CASSANDRA_CLUSTER_HOSTS` also uses the Docker Machine IP:
83
+
84
+
```shell
85
+
export CASSANDRA_CLUSTER_HOSTS=192.168.99.100
86
+
export CASSANDRA_CLUSTER_PORT=9042
87
+
```
88
+
89
+
* Tell the platform to use Cassandra as its database instead of LevelDB:
90
+
91
+
```shell
92
+
export HMDA_IS_DEMO=false
93
+
```
94
+
95
+
* Start sbt using the command `sbt`, then use these commands at the sbt prompt:
96
+
97
+
```shell
98
+
project api
99
+
clean
100
+
re-start
101
+
```
102
+
103
+
### Running the Loader
27
104
28
105
In a terminal, execute the following commands:
29
106
@@ -40,6 +117,7 @@ sbt> assembly
40
117
```
41
118
Then the panel loader can be run with `java -jar panel/target/scala-2.12/panel.jar path/to/institution_file.csv`
42
119
120
+
43
121
## Error codes
44
122
There are four ways the panel loader can fail. The exit code and error message should tell you what happened.
45
123
@@ -48,7 +126,11 @@ There are four ways the panel loader can fail. The exit code and error message
48
126
3. The call to `institutions/create` didn't return the correct response. This can indicate that you don't have the correct environment variables set, or that something is wrong with the hmda-platform.
49
127
4. The loader didn't finish processing all the institutions. This will happen when running the real panel file, but unsure as to why this happens.
50
128
129
+
51
130
## Testing
131
+
132
+
Once you have run the Panel Loader with an institution file, you can check the HMDA API to see that the data loaded correctly.
133
+
52
134
Make sure your authorization header is updated with a few real `id_rssd` fields from the given file. This can be found in the API log output (first field argument in the `InstitutionQuery` object), or in the CSV file (seventh field).
53
135
54
136
Try out the endpoint `localhost:8080/institutions`, and you should see a response with real panel data.
0 commit comments