-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7fddac
commit e9a1734
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "CurricularAnalytics" | ||
uuid = "593ffa3d-269e-5d81-88bc-c3b6809c35a6" | ||
authors = ["Greg Heileman <[email protected]>", "Hayden Free <[email protected]>", "Orhan Abar <[email protected]>", "Will Thompson <[email protected]>"] | ||
version = "0.6.3" | ||
version = "0.6.4" | ||
|
||
[deps] | ||
Blink = "ad839575-38b3-5650-b840-f874b8c74a25" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#TODO - Include documentation in this file such that it builds to GitHub Pages | ||
|
||
using Bukdu | ||
|
||
struct RESTController <: ApplicationController | ||
conn::Conn | ||
end | ||
|
||
function healthcheck(c::RESTController) | ||
render(JSON, "Healthy") | ||
end | ||
|
||
function validate(c::RESTController) | ||
@info :PAYLOAD (c.params.curriculum) | ||
@info "Validating recieved degree plan..." | ||
degreeplan = json_to_julia(c.params.curriculum) | ||
result = isvalid_degree_plan(degreeplan) | ||
if(result) | ||
@info "Curriculum is valid." | ||
else | ||
@info "Curriculum is invalid" | ||
end | ||
render(JSON, julia_to_json(degreeplan)) | ||
end | ||
|
||
function calculate_metrics(c::RESTController) | ||
@info "Calculating degree plan metrics..." | ||
degreeplan = json_to_julia(c.params.curriculum) | ||
@info "Blocking factor: $(blocking_factor(degreeplan.curriculum))" | ||
@info "Delay factor: $(delay_factor(degreeplan.curriculum))" | ||
@info "Centrality: $(centrality(degreeplan.curriculum))" | ||
@info "Complexity: $(complexity(degreeplan.curriculum))" | ||
render(JSON, julia_to_json(degreeplan)) | ||
end | ||
|
||
routes() do | ||
get("/healthcheck", RESTController, healthcheck) | ||
post("/validate", RESTController, validate) | ||
post("/metrics", RESTController, calculate_metrics) | ||
# create degree plan from curriculum | ||
plug(Plug.Parsers, parsers=[:json]) | ||
end | ||
|
||
Bukdu.start(8080, host="0.0.0.0") |