Compare commits

..

10 Commits

Author SHA1 Message Date
Matthew Huntington 61454fdaf0 prod creds
6 months ago
Matthew Huntington e9bf71f018 prod creds
6 months ago
Matthew Huntington 472ea9e23e outcomes_tracker.sql
6 months ago
Matthew Huntington 7b53c20746 adding create table sql
6 months ago
Matthew Huntington 72014def96 Merge branch 'main' of https://gitea.artisan.al/mahuntington/outcomes-api
2 years ago
Matthew Huntington 9fde21506e changing date format
2 years ago
Matt Huntington e3f058d126 start date added
2 years ago
Matt Huntington ddac0ed242 Merge branch 'main' of https://gitea.artisan.al/mahuntington/outcomes-api
2 years ago
Matt Huntington a907d4f860 close db when done
2 years ago
Matthew Huntington 4d77e2fc78 fixing width/height in FF
2 years ago

@ -1,6 +1,6 @@
const WIDTH = 800; const WIDTH = 800;
const HEIGHT = 600; const HEIGHT = 600;
const parseTime = d3.timeParse("%B %e, %Y"); const parseTime = d3.timeParse("%Y-%m-%dT%H:%M:%S.%L%Z");
let instances; let instances;
let xScale, yScale; let xScale, yScale;
@ -111,10 +111,9 @@ const renderPoints = () => {
} }
const setupGraph = ()=>{ const setupGraph = ()=>{
d3.select('svg'); d3.select('#container')
d3.select('svg') .attr('width', WIDTH)
.style('width', WIDTH) .attr('height', HEIGHT);
.style('height', HEIGHT);
xScale = d3.scaleTime(); xScale = d3.scaleTime();
xScale.range([0,WIDTH]); xScale.range([0,WIDTH]);

@ -3,7 +3,9 @@ const pg = require('pg');
const brokenInstances = [8302, 8294]; const brokenInstances = [8302, 8294];
const client = new pg.Client({ const client = new pg.Client({
database:"outcomes_tracker" database:"outcomes_tracker",
user:"matt",
password:"matt"
}) })
const delay = (ms) => { const delay = (ms) => {
@ -50,9 +52,10 @@ const scrapeInstance = async (link, page) => {
const graduationHTML = await graduationElem.getProperty('innerHTML'); const graduationHTML = await graduationElem.getProperty('innerHTML');
const instanceHeaderText = await graduationHTML.jsonValue() const instanceHeaderText = await graduationHTML.jsonValue()
const graduationDate = instanceHeaderText.split(' - ')[1].trim(); const graduationDate = instanceHeaderText.split(' - ')[1].trim();
const startDate = instanceHeaderText.split(' - ')[0].trim().split(':')[1].trim();
console.log({ instanceID, course, graduationDate, totalStudents, dropped, graduates, seeking, outcomes90Numeric, outcomes90Percent }); console.log({ instanceID, course, startDate, graduationDate, totalStudents, dropped, graduates, seeking, outcomes90Numeric, outcomes90Percent });
const res = await client.query(`INSERT INTO instances (instance_id, course, graduation_date, total_students, dropped, graduates, seekers, ninety_day_outcomes) VALUES (${instanceID}, '${course}', '${graduationDate}', ${totalStudents}, ${dropped}, ${graduates}, ${seeking}, ${outcomes90Numeric})`); const res = await client.query(`INSERT INTO instances (instance_id, course, start_date, graduation_date, total_students, dropped, graduates, seekers, ninety_day_outcomes) VALUES (${instanceID}, '${course}', '${startDate}', '${graduationDate}', ${totalStudents}, ${dropped}, ${graduates}, ${seeking}, ${outcomes90Numeric})`);
} else { } else {
await page.screenshot({ path: 'outcomes.png' }) await page.screenshot({ path: 'outcomes.png' })
} }
@ -76,7 +79,7 @@ const scrapeInstance = async (link, page) => {
await delay(500) //wtf await delay(500) //wtf
await page.type('input[type="text"]', 'matt.huntington@generalassemb.ly'); await page.type('input[type="text"]', 'matt.huntington@generalassemb.ly');
await page.type('input[type="password"]', 'Hunt!ngt0n!2'); await page.type('input[type="password"]', 'Hunt!ngt0n!4');
await page.click('input[type="submit"]'); await page.click('input[type="submit"]');
console.log('entered okta creds'); console.log('entered okta creds');
@ -124,4 +127,5 @@ const scrapeInstance = async (link, page) => {
console.log('done'); console.log('done');
//await page.screenshot({ path: 'outcomes.png' }) //await page.screenshot({ path: 'outcomes.png' })
await browser.close(); await browser.close();
await client.end();
})(); })();

@ -2,7 +2,9 @@ const express = require('express');
const app = express(); const app = express();
const pg = require('pg'); const pg = require('pg');
const client = new pg.Client({ const client = new pg.Client({
database:"outcomes_tracker" database:"outcomes_tracker",
user:'matt',
password:'matt'
}) })
app.use(express.static('public')) app.use(express.static('public'))
@ -13,6 +15,6 @@ app.get('/instances', async (req, res)=>{
}) })
client.connect(); client.connect();
app.listen(3000, ()=>{ app.listen(3003, ()=>{
console.log('listening'); console.log('listening');
}) })

Loading…
Cancel
Save