Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 18 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,41 @@
version: 2.1
orbs:
node: circleci/node@5.0.3
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs

jobs:
setup:
docker:
- image: cimg/base:stable

working_directory: ~/jobs-data-analyzer/JDA-12/v1

steps:
- checkout:
path: ~/jobs-data-analyzer
- node/install-packages:
app-dir: JDA-12/v1
cache-only-lockfile: true
check-cache: never
include-branch-in-cache-key: true
pkg-manager: npm
with-cache: true
- run:
command: ls -a ./ && npm ci
name: check and install


build:
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
docker:
- image: cimg/base:stable
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps

working_directory: ~/jobs-data-analyzer/JDA-12

steps:
- checkout
- checkout:
path: ~/jobs-data-analyzer
- run:
name: "checks"
command: "echo $(python --version)"
name: install python
command: sudo apt-get install python && python --version

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
build:
jobs:
Expand Down
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.git
.env
venv/
__pycache__/
*.pyc
*.pyo
node_modules/
.DS_Store
*.egg-info/
dist/
build/
.pytest_cache/
.mypy_cache/
34 changes: 0 additions & 34 deletions .github/workflows/python-package-conda.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __pycache__/
*$py.class


.env*
node_modules/
node_modules

Expand Down
1 change: 1 addition & 0 deletions .pyenv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.7.12
11 changes: 11 additions & 0 deletions APIs/exp-API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# JDA - API

API to parsed data.
Runs on independent server.

## Running

Go to `JDA` folder and run `npm start` <br/>
It will launch this `api` server before launching the `frontend` server.

READ JDA/servers.md for other launch methods
49 changes: 49 additions & 0 deletions APIs/exp-API/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require('dotenv').config();
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
var apiRouter = require('./routes/api');

var app = express();

app.use((req, res, next) => {
res.append('Access-Control-Allow-Origin', ['*']);
res.append('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
res.append('Access-Control-Allow-Headers','Content-Type');
next();
});

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
app.use('/api', apiRouter);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});

// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};

// render the error page
res.status(err.status || 500);
res.render('error');
});

module.exports = app;
94 changes: 94 additions & 0 deletions APIs/exp-API/bin/www
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env node
require('dotenv').config();

/**
* Module dependencies.
*/

var app = require('../app');
var debug = require('debug')('api:server');
var http = require('http');

/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.API_PORT);
app.set('port', port);

/**
* Create HTTP server.
*/

var server = http.createServer(app);

/**
* Listen on provided port, on all network interfaces.
*/

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

/**
* Normalize a port into a number, string, or false.
*/

function normalizePort(val) {
var port = parseInt(val, 10);

if (isNaN(port)) {
// named pipe
return val;
}

if (port >= 0) {
// port number
return port;
}

return false;
}

/**
* Event listener for HTTP server "error" event.
*/

function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}

var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;

// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}

/*
* Port info message
* */
console.log("Step 1: Go to http://localhost:"+process.env.API_PORT+"/api");
/**
* Event listener for HTTP server "listening" event.
*/

function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
File renamed without changes.
17 changes: 9 additions & 8 deletions JDA-12/data-API/routes/api.js → APIs/exp-API/routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ var last_six_months = function()

for( var i = 0; i < YEAR.length/2; i++ )
{
prev_month -= i ;
prev_month = ( YEAR.length + prev_month ) % YEAR.length;
prev_month = ( YEAR.length + (curr_month - i) ) % YEAR.length;
months.push({
'month': YEAR[ prev_month ],
'year': ( prev_month < 0 ) ? ( curr_year - 1 ) : curr_year
'year': ((curr_month - i) < curr_month) ? (curr_year - 1) : curr_year
});
}
return months;
Expand All @@ -33,9 +32,11 @@ var last_six_months = function()
router.get(['/data','/jobs'], function(req, res, next)
{
var months = last_six_months();
var sample_months = [ 'Jan', 'Dec', 'Nov', 'Oct', 'Sept', 'Aug' ];
sample_months.reverse();
const MAX = 40;
var six_months = [];

months.forEach(function( element ){ six_months.unshift( element.month ); });

const MAX = 200000;

var job_queries = [ 'Software Engineer', 'Support Engineer', 'Dev-Ops'];

Expand Down Expand Up @@ -71,7 +72,7 @@ router.get(['/data','/jobs'], function(req, res, next)
title:{ text: job_queries[0] + ' demand.' },
tooltip: { },
legend: { data: ['Applications'] },
xAxis: { data: sample_months },
xAxis: { data: six_months },
yAxis: { },
series: [
{
Expand Down Expand Up @@ -124,7 +125,7 @@ router.get(['/data','/jobs'], function(req, res, next)
title:{ text: job_queries[1] + ' demand.' },
tooltip: { },
legend: { data: ['Applications'] },
xAxis: { data: sample_months },
xAxis: { data: six_months },
yAxis: { },
series: [
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions APIs/py-API/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import uvicorn
from fastapi import FastAPI

api = FastAPI()

from py-API import security
import views
6 changes: 6 additions & 0 deletions APIs/py-API/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from fastapi import Request, HTTPException, Depends
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
from fastapi.responses import HTMLResponse, PlainTextResponse
from db import crud, models, schemas, get_db
from
Loading