Class PolarPdd

Description

Class to parse Polar PDD file and insert / update data to database

PDD file contains data related to 1 day, including some exercise data.

The following fields are handled when present in PDD file :

Day info :

  • date : Date of day (format : YYYYMMDD)
  • resting_hr : Rest heart rate (bpm)
  • weight : Weight in Kg * 10
  • sleep_minute : Sleep duration in minutes
  • sleep_pattern : Quality of sleep (list of values)
  • temperature : Temperature (in Celcius * 10)
  • weather : Weather (list of values)
  • description : Note for the day
Exercise info (for each exercise) :
  • sport_id : Sport ID
  • title : Exercise title
  • start_time : Start time (format : HH:MM:SS)
  • no_report : No report flag (list of values)
  • total_time : Duration in seconds * 10
  • rec_distance : Recorded distance in meters * 10
  • real_distance : Real distance in meters * 10
  • feeling : Feeling (list of values)
  • recovery : Recovery (list of values)
  • ranking : Ranking from 1 to 5 (0 if no ranking)
  • running_index : Polar running index
  • footpod_cal : Foot pod calibration (coeff around 1000)
  • avg_hr : Average heart rate (bpm)
  • max_hr : Maximum heart rate (bpm)
  • avg_speed : Average speed in km/h * 10
  • max_speed : Maximum speed in km/h * 10
  • avg_cadence : Average cadence in cycles / minute
  • max_cadence : Maximum cadence in cycles / minute
  • avg_altitude : Average altitude in meters
  • max_altitude : Maximum altitude in meters
  • ascend : Ascend in meters
  • energy : Energy consumption (Polar) in Kcal
  • beat_sum : Number of heart beats
  • description : Note for exercise
  • hrm_file : HRM file name (parse only)

Located in /class/PolarPdd.class.php (line 64)

PolarFile
   |
   --PolarPdd
Variable Summary
array $feeling
array $inReports
array $recovery
array $weather
Method Summary
void PolarPdd (string $fileName, integer $userId)
void db_insert (array $day)
array parse ()
array _parse_block_dayinfo_get ( &$buffer, integer $start, integer $nb, string $buffer)
array _parse_block_exerciseinfo_get ( &$buffer, integer $start, integer $nb, string $buffer)
Variables
array $feeling = array (
'excellent', 'good', 'average', 'bad', 'very_bad', 'hurt')
(line 91)

List of feeling values (from 0 to 5)

array $inReports = array (
'all', 'count', 'report', 'none')
(line 84)

List of "no report" values (from 0 to 3)

array $recovery = array (
'fully', 'recovered', 'normal', 'tired', 'exhausted')
(line 98)

List of recovery values (from 0 to 4)

array $sleepPattern = array (
'excellent', 'normal', 'disturbed', 'insufficient', 'insomnia')
(line 70)

List of sleep patterns values (from 0 to 4)

array $weather = array (
'sunny', 'fewclouds', 'cloudy', 'rainy', 'snowy')
(line 77)

List of weather values (from 1 to 5)

Inherited Variables

Inherited from PolarFile

PolarFile::$fileName
PolarFile::$userId
PolarFile::$version
Methods
Constructor PolarPdd (line 108)

Class constructor

void PolarPdd (string $fileName, integer $userId)
  • string $fileName: Polar PDD file name (full path name)
  • integer $userId: User ID (as in database)
db_insert (line 126)

Insert day information into database

SQL tables :

  • plw_day_info (insert / update)
  • plw_exercise (insert / update)

void db_insert (array $day)
  • array $day: Structure for day information + some exercise data:
    • 'dayinfo' : Day fields
    • 'exerciseinfo' : Array of exercise fields, indexed by
    exercise rank
parse (line 300)

Parse Polar PDD file (day information, including some exercise data)

Note : Both <dayinfo> and <exerciseinfo> blocks are parsed.

  • return: Structure for day and exercises :
    • 'dayinfo' : Day fields
    • 'exerciseinfo' : Exercise fields, indexed by rank
array parse ()
_parse_block_dayinfo_get (line 348)

Parse <dayinfo> block in PDD file

  • return: Fields of day
array _parse_block_dayinfo_get ( &$buffer, integer $start, integer $nb, string $buffer)
  • string $buffer: Buffer with PDD file content
  • integer $start: Line number of block in buffer
  • integer $nb: Number of lines in block
  • &$buffer
_parse_block_exerciseinfo_get (line 400)

Parse <exerciseinfo> block in PDD file

  • return: Array of exercises, indexed by rank
array _parse_block_exerciseinfo_get ( &$buffer, integer $start, integer $nb, string $buffer)
  • string $buffer: Buffer with PDD file content
  • integer $start: Line number of block in buffer
  • integer $nb: Number of lines in block
  • &$buffer

Inherited Methods

Inherited From PolarFile

PolarFile::PolarFile()
PolarFile::_parse_block_get()
PolarFile::_parse_note()

Documentation generated on Sat, 28 Mar 2009 23:16:54 +0000 by phpDocumentor 1.4.1