Analysing Parkrun timings

-

I've always enjoyed running- particularly on my own in wild country. Now nearly eighty I'm limited to walking only, having had lumbar stenosis for ten years. I know that if I mrove to even a slow jog I'm likely to trigger a month or more of very limiting back pain. To motivate me I try to visit ParkRun in a convenent place- an institution that organises a 5km timed course in many locations. Many of those attending are fit athletes, but it is intended to be fun and available to anyone, so there are people with dogs, people pushing children in prams, and even oldies like me.

Within an hour or two of the finish the results go online, as seen below.

I thought it would be fun to use LB to a display of the number of people who finish in 1-minute time slots. I do not have access to the dtabase of the day's results, but do see them shown on the webpage shown above.

While the source code is available in the browser, it is VERY convoluted. Sample below.

Instead I realised I could select the data table as displayed by the browser, paste it into a text file, and work on that.

Now I could see it a text editor ( left hand side) and in the hex editor, on the right hand side, that the data is separated by a mixture of chr$( 10) and chr$( 9) and at the start is the finishing position in ASCII text form.

Here is the scraped file..

1,James BUCKLEY,Male,VM40-44, ,17:25
2,Joe ORME,Male,VM35-39, ,17:43
3,Unknown, , , , 
4,Marcus ALBANO,Male,VM45-49,Taunton AC,18:22
5,George NICHOLLS,Male,SM30-34, ,18:33
6,Max BRADSHAW,Male,SM20-24, ,18:49
7,Jonathan GILLING,Male,VM50-54,Taunton AC,19:00
8,Daniel GIBSON,Male,SM20-24, ,19:08
9,Matt POWELL,Male,VM45-49,Burnham-on-Sea Harriers,19:09

It took a few false starts, and sorting things like the club name sometimes having a comma within it, but I'm happy.

Now I can see my outstanding time as the slow outlier that it is! ( I am happy if I get under 50 minutes these days..

This shows about 500 runners, with me in the last few stragglers taking nearly three times the fastest runner.


Code in LB.

NB If copying from screen, beware '<' and '>'may mess you up- I should change them to the html versions. Will either check them or put up a zip file soon!

Still working on this- things like adding a file selector to choose the file rather than coding it in-line.


    'nomainwin

    dim cnt( 100)

'goto [plotDistrn]

    open "02082025.txt" for input as #fIn
        all$    =input$( #fIn, lof( #fIn))
    close #fIn

    open "Converted02082025.cav" for output as #fOut

    i   = 1 '   instr( all$, chr$( 10) +str$( 1), 1)

    for entry =2 to 600 '   each record starts with x0A +comp number as text chars
        j       = instr( all$, chr$( 10) +str$( entry), j)
        if ( j =0) then exit for: goto [plotDistrbn]

        result$     =mid$( all$, i, j -i)

        for k =1 to len( result$)
            p$ =mid$( result$, k, 1)
            if ( asc( p$) >31) then print p$; : #fOut p$;
            if ( asc( p$) = 9) then print ",";: #fOut ",";
        next

        print "": #fOut ""

        i       =j
        scan
    next entry

    close #fOut

[plotDistrn]
    open "Converted02082025.cav" for input as #fIn

    WindowWidth  =850
    WindowHeight =550

    open "Distribution02082025" for graphics_nsb as #wg

    #wg "trapclose quit"

    #wg "fill darkblue ; backcolor darkblue ; color cyan ; down ; size 2 ; font 18"

    dim cnt( 70)   '   bin for every minute. Over 1h10min is very unusual..

    do
        line input #fIn, comp$
        if comp$ ="" then close #fIn: wait
        t$      =right$( comp$, 5)
        if mid$( t$, 2, 1) ="," then goto [O]
        mins    =val( left$(  t$, 2))
        cnt( mins) =cnt( mins) +1
        secs    =val( right$( t$, 2))
        tme     =secs +60 *mins
 [O]loop until eof( #fIn)

    #wg "line 10 420 830 420"

    for b =15 to 70
        #wg "color cyan ; font 18 ; place "; -158 +b *13; " 450"
        if b mod 5 =0 then #wg "\"; str$( b)

        #wg "color white ; font 8 ; place "; -143 +b *13; "  "; 400 -8 *cnt( b)
        if cnt( b) <>0 then #wg "\"; str$( cnt( b))

        #wg   "line "; -140 +b *13; " 420 "; -140 +b *13; " "; 420 -8 *cnt( b)
    next b

    #wg "flush"
    #wg "getbmp scr 1 1 850 550"
    bmpsave "scr", "distribn02082025.bmp"

    close #fIn

    wait

    sub quit h$
        close #h$
        end
    end sub