0.6.3 • Published 9 years ago

otp-profile-score v0.6.3

Weekly downloads
8
License
MIT
Repository
github
Last release
9 years ago

otp-profile-score

build status

Score OTP profiles

ProfileScore(opts, opts.factors, opts.rates)

Process & score an OTP Profile response. Tally statistics, score options.

Parameters

parametertypedescription
optsObjectOptions object.
opts.factorsObjectoptional: Factors to override the defaults.
opts.ratesObjectoptional: Rates to to override the defaults.

Example

var ProfileScore = require('otp-profile-score');
var scorer = new ProfileScore({ factors: {}, rates: {} });

processOption(option)

Process an individual option, only uses the first access and egress modes given.

Parameters

parametertypedescription
optionObjectOption returned from OTP's profiler.

Example

getProfileFromOTP(query, function(err, profile) {
  var scoredOption = scorer.processOption(profile[0]);
});

Returns Object, processedOption Annotated and scored.

processOptions(options)

Process an array of options that were generated by OpenTripPlanner's Profiler.

Parameters

parametertypedescription
optionsArray

Example

getProfileFromOTP(query, function(err, profile) {
  var allScoredResults = scorer.processOptions(profile);
});

Returns Array, processedOptions Options that are split up by access mode and annotated with a score.

score(option)

Get the weighted score of an option based on the factors, weights, and tallied totals for that option.

Parameters

parametertypedescription
optionObject

Returns Number, score

tally(option)

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

Parameters

parametertypedescription
optionObject

Returns Object, talliedOption

Installation

Requires nodejs.

$ npm install otp-profile-score

Tests

$ npm test
0.6.3

9 years ago

0.6.2

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.2

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago