chaunceyt / legislators-skill

U.S. Legislators Contact Info Alexa Skill
MIT License
2 stars 0 forks source link

Create script to convert .yml or .csv file to DymamoDB .json #3

Closed chaunceyt closed 6 years ago

chaunceyt commented 6 years ago

Issue We need to convert the legislators-current .csv or .yaml to a format we can import using dynamodb batch-write-item command.

Analysis

Source:

Output:

{
    "legislators-contact-info-dev": [
         {
            "PutRequest": {
                "Item": {
                    "id": {
                      "S": "R000122"
                      },
                      "address": {
                        "S": "728 Hart Senate Office Building Washington DC 20510"
                      },
                      "birthday": {
                        "S": "1949-11-12"
                      },
                      "cspan_id": {
                        "S": "24239"
                      },
                      "first_name": {
                        "S": "John"
                      },
                      "gender": {
                        "S": "M"
                      },
                      "govtrack_id": {
                        "S": "300081"
                      },
                      "last_name": {
                        "S": "Reed"
                      },
                      "opensecrets_id": {
                        "S": "N00000362"
                      },
                      "party": {
                        "S": "Democrat"
                      },
                      "phone": {
                        "S": "202-224-4642"
                      },
                      "state": {
                        "S": "RI"
                      },
                      "type": {
                        "S": "sen"
                      },
                      "url": {
                        "S": "https://www.reed.senate.gov"
                      },
                      "votesmart_id": {
                        "S": "27060"
                      },
                      "wikipedia_id": {
                        "S": "Jack Reed (Rhode Island politician)"
                      }
                }
            }
        }
     ]
}

The "id" is the bioguide_idfor each legislator.

Conformation Using the following command one should be able to import .json file into the dynamoDB table create via the severless deploy: aws dynamodb batch-write-item --request-items file://legislators-contact-info-dev.json --region

chaunceyt commented 6 years ago

This PR https://github.com/chaunceyt/legislators-skill/pull/5 resolves this issue.