Skip to content

Commit a313297

Browse files
committed
instructions for connecting to local db
1 parent 658e4d3 commit a313297

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ You should now have the following directory structure:
4040
```
4141

4242
and you should be in the `driver` directory.
43-
You can now execute `make` commands.
43+
You can now execute `make` commands (but only from the `driver` directory).
4444

4545
```sh
4646
# Create all docker containers: db, web, redis, and python
4747
$ [sudo] make all
4848

49-
# Run tests
49+
# Run python tests
5050
$ [sudo] make test
5151

5252
# To drop into debugger on error
@@ -57,7 +57,7 @@ $ [sudo] make test pdb=1
5757
$ [sudo] make test test=repos/delphi/delphi-epidata/integrations/acquisition
5858
$ [sudo] make test test=repos/delphi/delphi-epidata/integrations/acquisition/covid_hosp/facility/test_scenarios.py
5959

60-
# To run R tests
60+
# Run R tests
6161
$ [sudo] make r-test
6262
```
6363

@@ -78,6 +78,7 @@ From the `driver` directory, run
7878
```sh
7979
# If containers are not already started
8080
$ [sudo] make all
81+
8182
# Starts a bash session inside the `delphi_web_python` container
8283
$ [sudo] make bash
8384
```
@@ -97,13 +98,35 @@ $ python -m delphi.epidata.acquisition.flusurv.flusurv_update all
9798

9899
You may need to add '$(M1)' flag to subcommands if using a new M\* chip Mac. The '$(M1)' flag is added to commands within the [Makefile](https://github.com/cmu-delphi/delphi-epidata/blob/cae43f8/dev/local/Makefile), so take a look there for guidance.
99100

100-
## Other useful commands and information
101+
## Running local epidata API
102+
103+
From the `driver` directory, run
101104

102105
```sh
103106
# Starts a MySQL prompt that can be used to query the local database.
104107
# This connection can be kept open while adding data to the database.
105108
$ [sudo] make sql
106-
# Cleans up the docker environment
109+
```
110+
111+
If the container was successfully started, you should see a prompt that looks like `root@containerhash:/usr/src/app#`.
112+
113+
From the container, open a Python session with `python` and then run
114+
115+
```python
116+
from delphi.epidata.client.delphi_epidata import Epidata
117+
118+
# use the local instance of the Epidata API
119+
Epidata.BASE_URL = 'http://delphi_web_epidata/epidata'
120+
121+
# Run API calls as normal, e.g.
122+
Epidata.fluview(regions = "ny", epiweeks = Epidata.range(202340, 202342))
123+
```
124+
125+
126+
## Other useful commands and information
127+
128+
```sh
129+
# Removes dangling docker images (old images after you've created a new build of the image)
107130
$ [sudo] make clean
108131
```
109132

0 commit comments

Comments
 (0)