Skip to content

Commit

Permalink
Adding AWS region instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte committed Sep 22, 2024
1 parent 168cd35 commit 34fd4cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ This is the repository for the TransitMatters Data Dashboard. Client code is wri

1. Add `MBTA_V3_API_KEY` to your shell environment:
- `export MBTA_V3_API_KEY='KEY'` in ~/.bashrc or ~/.zshrc
2. Add your AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) to your shell environment, OR add them to a .boto config file with awscli command `aws configure`.
3. In the root directory, run `npm install` to install all frontend and backend dependencies
4. Run `npm start` to start both the JavaScript development server and the Python backend at the same time.
5. Navigate to [http://localhost:3000](http://localhost:3000) (or the url provided after running `npm start`)
2. In the root directory, run `npm install` to install all frontend and backend dependencies
3. Run `npm start` to start both the JavaScript development server and the Python backend at the same time.
4. Navigate to [http://localhost:3000](http://localhost:3000) (or the url provided after running `npm start`)

### AWS Setup

If you have access to AWS credentials, add them to your local setup for a better development experience

1. Add your AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) to your shell environment, OR add them to a .boto config file with awscli command `aws configure`.
2. Ensure that AWS is set to read from/to `us-east-1` via `export AWS_DEFAULT_REGION=us-east-1` or with an aws config

AWS access is not required for development, but may be required for certain charts and data to appear

## Deployment Instructions

Expand Down
4 changes: 2 additions & 2 deletions server/chalicelib/dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
dynamodb = boto3.resource("dynamodb")


def query_daily_trips_on_route(table_name, route, start_date, end_date):
def query_daily_trips_on_route(table_name: str, route, start_date: str | date, end_date: str | date):
table = dynamodb.Table(table_name)
response = table.query(KeyConditionExpression=Key("route").eq(route) & Key("date").between(start_date, end_date))
return ddb_json.loads(response["Items"])


def query_daily_trips_on_line(table_name, line, start_date, end_date):
def query_daily_trips_on_line(table_name: str, line: str, start_date: str | date, end_date: str | date):
route_keys = constants.LINE_TO_ROUTE_MAP[line]
with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
futures = [
Expand Down

0 comments on commit 34fd4cc

Please sign in to comment.