-
Notifications
You must be signed in to change notification settings - Fork 1
acs
ACS data comes from the US Census.
In the first implementation here (it's now September 2018) users have access to more than 15000 records from California in 2013. We hope to expand that, but this is a proof of concept.
Users can choose from among a few dozen attributes, grouped into categories. Typical attributes include sex, age, income, race, and education. This suggests obvious types of investigations, looking at relationships among these variables.
The data themselves are stored in a mySQL database. Javascript (being client-side) cannot access mySQL directly, so we use php as an intermediary. For more background on this interaction, see our page on how we use php to get to mySQL.
Here is a list of the files and what they're responsible for:
-
acs.html: Where we begin. Contains paths to the javascript and the DOM elements the user sees. -
acs.css: Styles what the user sees. -
acs.js: The main controller and catchall. Defines theacsglobal. -
acs.constants.js: Defines constants including the version number and the base URL for the php. -
acs.ui.js: Adjusts text and visibility of DOM elements inacs.ui.updateWholeUI(). Also constructs strings used in the UI such as sets of checkboxes or status strings. -
acs.userActions.js: Has functions called directly when the user takes an action such as clicking a checkbox or, of course, asking for a sample. -
acs.DBconnect.js: (néephpConnect) Contains functions that send commands to php in order to query the database. Asking for a sample triggers a call here to retrieve the sample from the database. This comes in as a JSON object. -
acs.CODAPConnect.js: Contains all of the functions that interact with the CODAP platform, for example, for creating new items when the user requests a sample. The JSON from the database interaction becomes avaluesparameter in the request to CODAP. -
Attribute.js: This is a class, really only a structure, that manages the various features of an 'attribute.' We create one of these for each attribute selected by the user; we retrieve that set of columns from the database. AnAttributecontains the internal name of the attribute, the user-facing name, and other information such as a description. For example,PINCPis the total person's income, which we display asTotalIncome. -
acs.php: This is the php code called inDBconnect. It assembles and executes mySQL queries and reports the results back as JSON. Here, a typical query retrieves a number of records from the database. -
acs.establishCredentials.php: Note this isphp! This file contains the URL of the file that contains the credentials. This file is not in a publicly-accessible place, and is not checked in to github. You can read about such files in the page about communicating with mySQL (referenced above).