Skip to content

Commit

Permalink
Pums data (#335)
Browse files Browse the repository at this point in the history
* added cypress test for PUMS demo

* fixed assignment of var_type

* change variables fixture to match updated profiler logic
  • Loading branch information
ekraffmiller authored Sep 20, 2021
1 parent b1aa328 commit 0f7af52
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 91 deletions.
16 changes: 16 additions & 0 deletions client/cypress/fixtures/PUMSDemoData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"datasetName": "2000 PUMS 5-Percent",
"variables": {
"age": {
"name": "age",
"type": "Numerical",
"min": "0.0",
"max": "100.0",
"fixedValue": "45"
},
"married": {
"name": "married",
"type": "Boolean"
}
}
}
9 changes: 9 additions & 0 deletions client/cypress/fixtures/PUMSMockDV.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"siteUrl": "http://ec2-18-232-125-211.compute-1.amazonaws.com",
"fileId": "13",
"datasetPid": "doi:10.5072/FK2/QWVFK0",
"token": "c7af4204-bbbf-44b8-a3e5-a37ba34c24dc",
"filePid": "doi:10.5072/FK2/QWVFK0",
"user": "test_user",
"password": "dpcreator"
}
175 changes: 88 additions & 87 deletions client/cypress/fixtures/variables.json
Original file line number Diff line number Diff line change
@@ -1,134 +1,135 @@
{
"trial": {
"max": null,
"min": null,
"name": "Trial",
"type": "Numerical",
"label": ""
},
"session": {
"name": "Session",
"type": "Boolean",
"label": ""
},
"subject": {
"name": "Subject",
"label": "",
"type": "Categorical",
"label": "",
"categories": null
},
"language": {
"name": "Language",
"label": "",
"type": "Boolean"
},
"session": {
"name": "Session",
"label": "",
"type": "Boolean"
"type": "Boolean",
"label": ""
},
"objectiveTaskDifficulty": {
"name": "ObjectiveTaskDifficulty",
"label": "",
"type": "Boolean"
},
"trial": {
"name": "Trial",
"label": "",
"type": "Categorical",
"categories": null
"eyeHeight": {
"max": null,
"min": null,
"name": "EyeHeight",
"type": "Numerical",
"label": ""
},
"typingSpeed": {
"name": "TypingSpeed",
"label": "",
"type": "Numerical",
"max": null,
"min": null,
"max": null
},
"correctedError": {
"name": "CorrectedError",
"label": "",
"name": "TypingSpeed",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"readTextEventsRatio": {
"name": "ReadTextEventsRatio",
"label": "",
"type": "Numerical",
"blinkDuration": {
"max": null,
"min": null,
"max": null
},
"attendedButNotSelectedRate": {
"name": "AttendedButNotSelectedRate",
"label": "",
"name": "BlinkDuration",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"uncorrectedErrorRate": {
"name": "UncorrectedErrorRate",
"label": "",
"type": "Numerical",
"blinkInterval": {
"max": null,
"min": null,
"max": null
},
"baselinePupilDiameter": {
"name": "BaselinePupilDiameter",
"label": "",
"name": "BlinkInterval",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"blinkFrequency": {
"max": null,
"min": null,
"name": "BlinkFrequency",
"label": "",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"blinkDuration": {
"name": "BlinkDuration",
"label": "",
"type": "Numerical",
"correctedError": {
"max": null,
"min": null,
"max": null
"name": "CorrectedError",
"type": "Numerical",
"label": ""
},
"blinkInterval": {
"name": "BlinkInterval",
"label": "",
"saccadeDuration": {
"max": null,
"min": null,
"name": "SaccadeDuration",
"type": "Numerical",
"label": ""
},
"saccadeVelocity": {
"max": null,
"min": null,
"max": null
"name": "SaccadeVelocity",
"type": "Numerical",
"label": ""
},
"blinkBurstRatio": {
"max": null,
"min": null,
"name": "BlinkBurstRatio",
"label": "",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"saccadeAmplitude": {
"max": null,
"min": null,
"name": "SaccadeAmplitude",
"label": "",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"saccadeDuration": {
"name": "SaccadeDuration",
"label": "",
"type": "Numerical",
"saccadePeakVelocity": {
"max": null,
"min": null,
"max": null
},
"saccadeVelocity": {
"name": "SaccadeVelocity",
"label": "",
"name": "SaccadePeakVelocity",
"type": "Numerical",
"min": null,
"max": null
"label": ""
},
"saccadePeakVelocity": {
"name": "SaccadePeakVelocity",
"label": "",
"readTextEventsRatio": {
"max": null,
"min": null,
"name": "ReadTextEventsRatio",
"type": "Numerical",
"label": ""
},
"uncorrectedErrorRate": {
"max": null,
"min": null,
"max": null
"name": "UncorrectedErrorRate",
"type": "Numerical",
"label": ""
},
"eyeHeight": {
"name": "EyeHeight",
"label": "",
"baselinePupilDiameter": {
"max": null,
"min": null,
"name": "BaselinePupilDiameter",
"type": "Numerical",
"label": ""
},
"objectiveTaskDifficulty": {
"name": "ObjectiveTaskDifficulty",
"type": "Boolean",
"label": ""
},
"attendedButNotSelectedRate": {
"max": null,
"min": null,
"max": null
"name": "AttendedButNotSelectedRate",
"type": "Numerical",
"label": ""
}
}
19 changes: 19 additions & 0 deletions client/cypress/integration/pums-demo-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
describe('PUMS Demo Test', () => {

beforeEach(() => {
cy.on("window:before:load", (win) => {
cy.spy(win.console, "log");
cy.spy(win.console, "error")
})
})
it('Uses the PUMS dataset', () => {
cy.on('uncaught:exception', (e, runnable) => {
console.log('error', e)
console.log('runnable', runnable)
return false
})
cy.runDemo('PUMSMockDV.json', 'PUMSDemoData.json')
})
})
}
6 changes: 2 additions & 4 deletions server/opendp_apps/profiler/profile_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ def format_profile_variables(profile_data: dict) -> BasicResponse:
if orig_var_info['binary'] is True:
var_type = pstatic.VAR_TYPE_BOOLEAN
elif orig_var_info['numchar'] == 'numeric':
if orig_var_info['interval'] == 'continuous':
var_type = pstatic.VAR_TYPE_NUMERICAL
else:
var_type = pstatic.VAR_TYPE_CATEGORICAL
var_type = pstatic.VAR_TYPE_NUMERICAL
# if orig_var_info['interval'] == 'continuous': # currently unused
else:
var_type = pstatic.VAR_TYPE_CATEGORICAL

Expand Down

0 comments on commit 0f7af52

Please sign in to comment.