npm.io
0.6.3 • Published 11 years ago

otp-profile-score

Licence
MIT
Version
0.6.3
Deps
1
Vulns
0
Weekly
0
Stars
1

otp-profile-score

build status

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

  • opts Object Options object.
    • opts.factors Object? Factors to override the defaults.
    • opts.rates Object? Rates to to override the defaults.

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

  • option Object 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

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

Returns number score

tally

Tally values. Add up total calories, cost, transfers, distances, and times.

Parameters

Returns Object talliedOption

Keywords