Code Monkey home page Code Monkey logo

go-data-analysis's Introduction

Created By Ryan Callahan

Installation

This project assumes that Go 1.15 or later and PostgreSQL 13.0 or later and make are already installed. This project also assumes that you are using some kind of bash-like terminal (this is built into macOS and most linux distros). If they are not installed you should do that first following these guides:

To install dependencies without using $GOROOT, in the top level directory, run:

go mod vendor

To install dependencies to $GOROOT, in the top level directory, run:

go mod tidy

To create the PostgreSQL user that will create the db, in the top level directory, run:

sh ./db_scripts/CREATE_INITIAL_USER.sh

Configure Enviorment variables

To hit the api you must create a file named .env with your api key. An example of this file can be found in the example.env file. It will look like this:

MAINTENANCE_CONNECTION_STRING=port=<Postgres Port Number> host=<Host IP> user=root password=toor<default user created by scripts, you may want to change this> dbname=posgres sslmode=disable
WORKING_CONNECTION_STRING=port=<Postgres Port Number> host=<Host IP> user=root password=toor<default user created by scripts, you may want to change this> dbname=<same as is specified in the DATABASE_NAME variable> sslmode=disable
TEST_CONNECTION_STRING=<same as WORKING_CONNECTION_STRING except the database field should be DATABASE_NAME with 'test' added to the end> sslmode=disable
DATABASE_NAME=<whatever db name you want, make sure this aligns with your connection strings>

Make sure dbname in your connection strings is as specified in the example above

Build and Run

  • Make sure the postgres server you are trying to connect to is started
  • In the top level directory run:
make run

Test

To unit test, in the top level directory run:

make test

To gui test, see test plan document located at ./guiTestPlan/TestPlan.xlsx

go-data-analysis's People

Contributors

ryancallahan312 avatar

Watchers

James Cloos avatar  avatar  avatar

go-data-analysis's Issues

Add Tests and Linting to Project

Acceptance Criteria

  1. The example uuid generation in main.go has tests in main_test.go
  2. Test runner runs all tests when pushed
  3. Code linter lints all code when pushed

Create Gui

Create placeholder gui that does nothing probably using go-astilectron because I assume gui testing on electron will be better documented and easier.

Gui Tests

Using Selenium or cypress or something else to do automated gui tests, perform E2E tests

Parse out Excel file and store data in DB

Source: https://www.bls.gov/oes/#data

for each state get every major employment category and record
the state
the occupation major title
the total employment in that field in that state
the 25th percentile salary (lets assume that most college grads earn in the lower 25%) for that field both hourly and annual
the total employment in that state for that field oops typo, It should be the Occupation code instead

Update DB

Create at least one more table in your database with state by state employment data per the following:

for each state get every major employment category and record
the state
the occupation major title
the total employment in that field in that state
the 25th percentile salary (lets assume that most college grads earn in the lower 25%) for that field both hourly and annual
the Occupation code instead

Add Tests

AC:

not sure how to test this properly, going to ask dr.santore on this one.

Tests

write tests to assure your method to read from the xlsx file works properly
eg, make sure you get data from all 50 states from the original data
maybe create a test xlsx with a limited number of major occupational groups along with some other stuff. make sure you get the right number of major occupational groups
write a test to make sure the new table is there
write a test to make sure the old table is still there if test is still not there from previous sprint
write a test to make sure that your new write to table works (unless you found a way to make the old write to table work and the old test covers it all.

Data Analysis

provide the user the ability to do two forms of data analysis
The first analysis should display the data in a color coded text format as a list in ascending or descending order (let the user choose)
The second should render a map to visualize the data.

compare the number of college graduates in a state (for the most recent year) with number of jobs in that state that likely expect a college education. (lets remove those that usually require a specialized school like police academies or apprenticeships). So lets remove all those professions which have an occ_code that begins with 30-39 or 40-49. (yes this is a broad brush, but we need to do this in 2 weeks)
comparing total jobs isn't going to be perfect since it isn't entry level jobs, but that data required a second API key
Compare the 3 year graduate cohort declining balance percentage to the 25% salary in the state and visualize that data

Write Data To File

Prerequisite Issue #2

Acceptance Criteria

  1. All data is stored in data.txt
  2. Data is written concurrently with api calls

Get around rate limiting

Currently there is a known rate limit of 1000 requests per two hours, but there is also another rate limit that only allows so many requests per x amount of seconds. that x amount of seconds is unknown.

AC

  • no data lost to rate limiting

Unit Tests

Add additional tests to your test suite. You should include tests to make sure your data analysis functions work properly (both forms)

Data Visualization

Using plotly.go implement data visualization feature into a map of the US

compare the number of college graduates in a state (for the most recent year) with number of jobs in that state that likely expect a college education. (lets remove those that usually require a specialized school like police academies or apprenticeships). So lets remove all those professions which have an occ_code that begins with 30-39 or 40-49. (yes this is a broad brush, but we need to do this in 2 weeks)
comparing total jobs isn't going to be perfect since it isn't entry level jobs, but that data required a second API key
Compare the 3 year graduate cohort declining balance percentage to the 25% salary in the state and visualize that data

Add Concurrency to writing data and making api calls

I tried to just add this into the other issues, but because I am very new at go it turned out to be challenging so I am separating it to its own issue.

AC:

  • requests happen all at once
  • writes to file in order of page number

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.