-
Notifications
You must be signed in to change notification settings - Fork 66
Cruncher Dev Test Sandbox
João Pereira edited this page Oct 28, 2016
·
11 revisions
The URL for the sandbox is the same as for the production version(s) of the Cruncher, with the exception that the version indicator in the production URL ('v1', 'v2', etc.) is replaced with 'v99999' in the sandbox API. (this is for all operations - authenticate, upload résumé, etc.)
Perform same authentication as in production.
Allow résumé upload as in production.
Allow résumé download as in production.
Logic:
- For first 10 jobs (IDs), match with 10 résumés
- For every 5th job (after first 10), match with zero résumés
- Otherwise, match job with 5 résumés
This logic is outlined below in Ruby.
resume_stars = ['1.8', '4.1', '2.6', '4.9', '3.2']
resume_stars += resume_stars
resumes = {matcher1: []}
if job_id.between? 1, 10
10.times do |n|
resume = Resume.find n+1
resumes[:matcher1] << {'resumeId'=>resume.id.to_s, 'stars'=>resume_stars[n]} if resume
end
else if resume_id % 5 != 0
(job_id..job_id+4).each do |resume_id|
resume = Resume.find resume_id
resumes[:matcher1] << {'resumeId'=>resume_id.to_s, 'stars'=>resume_stars[resume_id-job_id]} if resume
end
end
Logic:
-
Resume ID == 1 and Job ID < 5
Return canned results
Crunchers Job id 0 Job id 1 Job id 2 Job id 3 Job id 4 ExpressionCruncher 1.1 1.2 3. 4.3 5. NaiveBayesCruncher 1.2 1.3 3.1 4.4 4.9 -
Other values
Behaves as the live endpoint
Allow job creation as in production.
Allow job update as in production.
Logic:
- For first 10 résumés (IDs), match with 10 jobs
- For every 5th job (after first 10), match with zero jobs
- Otherwise, match résumé with 5 jobs
This logic is outlined below in Ruby.
job_stars = ['3.1', '2.4', '4.2', '3.8', '4.7']
job_stars += job_stars
jobs = {matcher1: []}
if resume_id.between? 1, 10
10.times do |n|
job = Job.find n+1
jobs[:matcher1] << {'jobId'=>job.id.to_s, 'stars'=>job_stars[n]} if job
end
else if resume_id % 5 != 0
(resume_id..resume_id+4).each do |job_id|
job = Job.find job_id
jobs[:matcher1] << {'jobId'=>job_id.to_s, 'stars'=>job_stars[job_id-resume_id]} if job
end
end