otp-profile-score
Score OTP profiles
Installation
Requires nodejs.
$ npm install otp-profile-score
Tests
$ npm test
API
Table of Contents
ProfileScore
Process & score an OTP Profile response. Tally statistics, score options.
Parameters
optsObject Options object.
Examples
const ProfileScore = require('otp-profile-score')
const scorer = new ProfileScore({ factors: {}, rates: {} })
processOption
Process an individual option, only uses the first access and egress modes given.
Parameters
optionObject Option returned from OTP's profiler.
Examples
getProfileFromOTP(query, function(err, profile) {
const scoredOption = scorer.processOption(profile[0])
})
Returns Object processedOption Annotated and scored.
processOptions
Process an array of options that were generated by OpenTripPlanner's Profiler.
Parameters
optionsArray
Examples
getProfileFromOTP(query, function(err, profile) {
const allScoredResults = scorer.processOptions(profile)
})
Returns Array processedOptions Options that are split up by access mode and annotated with a score.
score
Get the weighted score of an option based on the factors, weights, and tallied totals for that option.
Parameters
optionObject
Returns number score
tally
Tally values. Add up total calories, cost, transfers, distances, and times.
Parameters
optionObject
Returns Object talliedOption
