npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@reuters-graphics/us-congressional-atlas

v0.0.5

Published

[![npm version](https://badge.fury.io/js/%40reuters-graphics%2Fus-congressional-atlas.svg)](https://badge.fury.io/js/%40reuters-graphics%2Fus-congressional-atlas) [![Reuters open source software](https://badgen.net/badge/Reuters/open%20source/?color=ff800

Downloads

2

Readme

@reuters-graphics/us-congressional-atlas

npm version Reuters open source software

Quick and easy access to meta information about members of U.S. Congress.

Quickstart

$ yarn add @reuters-graphics/us-congressional-atlas
// Import from the library by Congress number and chamber... 
import members from '@reuters-graphics/us-congressional-atlas/congress/117/senate';

/**
 * Get all members 
 */
members.getMembers();
// [ { ... }, { ... }, ... ]

/**
 * Get members by party
 */
members.getRepublicans();
members.getDemocrats(); // Includes independents who caucus with Democrats
members.getOthers();

/**
 * ... or all in one go ...
 */
members.getMembersByParty();
// { republicans: [ ... ], democrats: [ ... ], others: [ ... ] }

/**
 * ... or a shortcut if you just need the totals ...
 */
members.getSeatsByParty();
// { republicans: 50, democrats: 50, others: 0 }

/**
 * Get a single member...
 * 
 * ... using a candidate's name ...
 */
members.getMember('Rand Paul');
// { lastName: 'Paul', ... }

/**
 * ... using a candidate's seat ...
 * - Senate seat: state postal code + Senate class number
 * - House seat: state postal code + congressional district number
 */
members.getMember('KY 3');
// { lastName: 'Paul', ... }


/**
 * ... using a candidate's ID -- any of:
 *   bioguide, govtrack, cspan, votesmart, icpsr,
 *   crp, Google entity or FEC candidate ID
 */
members.getMember('P000603');
// { lastName: 'Paul', ... }

Member data:

{
  id: "P000603",
  title: "Senator, 3rd Class",
  shortTitle: "Sen.",
  firstName: "Rand",
  middleName: null,
  lastName: "Paul",
  suffix: null,
  gender: "M",
  dateOfBirth: "1963-01-07",
  state: "KY",
  stateRank: "junior",
  senateClass: "3",
  party: "R",
  leadershipRole: null,
  nextElection: "2022",
  seniority: "11",
  ids: {
    bioguide: "P000603",
    govtrack: "412492",
    cspan: "9265241",
    votesmart: "117285",
    icpsr: "41104",
    crp: "N00030836",
    googleEntity: "/m/05pdb7q",
    fecCandidate: "S0KY00156"
  },
  images: {
    original: "https://graphics.thomsonreuters.com/data/us-congressional-atlas/P000603/original.jpg",
    "225x275": "https://graphics.thomsonreuters.com/data/us-congressional-atlas/P000603/225x275.jpg",
    "75x92": "https://graphics.thomsonreuters.com/data/us-congressional-atlas/P000603/75x92.jpg",
    "50x50": "https://graphics.thomsonreuters.com/data/us-congressional-atlas/P000603/50x50.jpg"
  }
}

Building

Data

Data is pulled from the ProPublica's Congress API. Add your API key to a .env file at the root of this project or export it as the environment variable PROPUBLICA_API_KEY.

The data pulled is driven by the Congress numbers exported in index.js. Add any additional Congresses there and then run:

$ yarn getMembers

Then run tests before you publish:

$ yarn test

Photos

Photos come from the unitedstates project and are resized and published to our own servers during the build.

You can overwrite the photo used by adding it to the images/ directory named by the candidate's bioguide ID, e.g., P000603.jpg.

Once you've added custom photos, be sure to run:

$ yarn getMembers

... which will upload them to AWS. Then update and republish the library with:

$ yarn publish

Testing

$ yarn test