Less noise, more data. Get the biggest data report on software developer careers in South Africa.

Dev Report mobile

Programmable Banking Community: How To Save Money While You Run

1 February 2022 , by Nick Benson

Members of the Programmable Banking community got together to demo a few of their Transfer API solutions submitted for the Q4 2021 hackathon. Here Jan Marais presents his solution Run to the Bill, which helps him finance his "expensive" running habit by automatically saving to buy new shoes, every time he runs.

Transcript of the demo

Jan Marais 0:00

I don't think I've met most of you. But thanks. Thanks for having me.

The Problem To Be Solved

A little bit of context for my submission here is, I'm a runner. I think I run more than the average person, or at least the average developer. And I go through running shoes quite quickly, and they are getting expensive. Or at least the nice ones are. It's kind of a problem. And I would like to be able to save for a new pair. But it's also difficult to know when I'll need a new pair, because I have multiple shoes for different occasions, for like running on trail or road or racing.

And I don't use them all at the same frequency. And it's hard to say, in three months'; time, I'll need a new pair, because it depends on how much I actually use that pair.

How The Solution Works

What I came up with was this way of automatically saving for replacement shoes by integrating it with Strava, which is this social activity-sharing site and so I get my activities from there. If there's an update, it will let my app know that there was a new event and there in the app, I log the shoe that I ran with. And, based on that, I'll get the distance and make a calculation to determine what's the amount that needs to be saved.

Then I transfer that from my current account to my savings account. I think I'm going to show you the use case now. Let's just see if I covered everything here. Please interrupt me if I'm not making sense.

I'm going to start with uploading activity from, I think, yesterday. I haven't uploaded it yet. I first go into my Garmin app, because I've got a Garmin watch. And then after I sync my watch with Garmin here, it will sync it to Strava. Let's give this a second.

Okay, so this is going to sync now. And when the circle completes, then you'll see we'll get an identification there that Strava received my activity. But while that's running, I just want to show you my front end that I built. This wasn't part of the submission. I just didn't have time before. But I wanted a better way of visualising the submission for today. This is just my home screen. And you can link your Investec account here.

Screenshot-2022-02-01-at-14.28.46

At the moment, you can just add your ID and secret like this because they don't have auth yet. And if I click here, this will kick off the Strava auth flow. But that's already done for my profile.

And then the first step; the items that are being shown here, they live in a MongoDB database that's living locally. I just saw the notification came through. You can see there's a little Strava icon at the top right of my mobile screen. And that means Strava caught my upload. I want to show you just where my server is running. This little text here at the bottom just says it received this update, and it will sync in two minutes. And I'll explain why in a second. Just back to the app.

The process here is you can add gear – in Strava they call it gear – but in my case, it's just shoes. This is now pulled from Strava's API. And I haven't added my New Balance shoes yet.

And once I've selected them, it gets this distance that Strava says is the amount that I ran with this pair and then I can go on to define the lifespan of these shoes. I think I can maybe run 900km in total with them, and to replace them will cost around R2 000. And just because I want to avoid making too-big transactions, I'm going to say that I've already saved R1 000. Then I add this. And you can see, it will add to the screen here.

This is the overview of the front end. But let's go back to my server here. What happened now in the background since my server found activity from Strava. The activity that I've just uploaded was this one for eight kilometres.

When I received this notification from Strava telling me there's a new update. I don't update the gear information immediately. So, it takes a while for that data to show on their side. That's why I'm waiting two minutes here, before I actually can pull the latest data. I just wait two minutes, and then I pull the totals and then I go and calculate. I get the new totals; here's just an example of what the totals look like.

This is an overview of my shoes at the moment. I pull this data and I compare it to what I have in my MongoDB database. I compared it with these items here.

And then I calculate the distance difference. And based on that, I'll take the replacement value minus it by the number of the contributions that have already made by the savings account, divide that by the number of kilometres left before it reaches its end of life, and then get this value per kilometre that's left and times that by the distance of an activity and get an amount, which is now the R30.

And then do the transfer. Let's see on my phone if I actually got the notification. Yeah. There it is!

Screenshot-2022-02-01-at-14.31.17

And then it's supposed to also update on my front end, if I press refresh. There you can see there's R30 that's added there. That's kind of the main flow or feature.

I don't want to bore you with any other details. You can maybe guide me with questions of what you're interested to see. And maybe part of the tech stack or I don't know.

Community Questions

Hennie Spies 8:38

Jan, burning question that I had while going through submission. Was this idea present before the submission, i.e., have you been doing this manually for a while? Or did the idea of doing this, i.e., saving on kilometres, get sparked through the submission?

Jan 8:58

Yeah, through this submission. I have this problem that shoes are extremely expensive and I've never had a good way of saving for them. But the solution, I hadn't thought of before that; I hadn't tried solving it before.

Nick Benson 9:28

I like that you use MongoDB. I'm just going to say that. I like to use MongoDB.

Jan 9:34

I started with Amplify aggregation and so DynamoDB and stuff, but I found the local development inefficient and then switched everything to Mongo local.

Rijnhardt Kotze 9:50

From someone that needs to start running again. This gave me inspiration to start running again. So, thanks for that.

Nick 10:01

If there's anything else you guys want to find out, if you want to do a running club, a Programmable Banking running club, just make a post in the Slack group. We will make it happen. Maybe we can sponsor some shirts; just don't tell Aretha about it. All good!

Cool. I think that's it. Jan, thank you very much. I really appreciate it. Really appreciate your submission.

OfferZen_Investec_PB_How-to-save-money-while-you-re-running_blog-Inner-image


Get involved in the Programmable Banking Community.

If you have questions or just want to say hi to the Programmable Banking Community core team, you can pop us a mail and we will get back to you.

If you want to see more from what the community has been up to, you can:

offerzen_investec_Developer_Finance_Guide_Banner_for_Blog_posts-1

Recent posts

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.