Beatspeak DevBlog 2 Computer Vision + Telehealth = passion project
Tags: cpp, computervision, opensource, devjournal
Published: 2023-05-06 17:57:35

In my last entry I went through the origin for the idea behind the system I'm building. The aim of the system is to provide a free to use application for smartphones that can give a user a base line on their health and flag potential risk. Its based on the idea that prevention is the best treatment. The project is admittedly a moonshot but I think trying to build something to help the billions of people who don't have access to any healthcare is worth sinking my free time into regardless of the slim chances of success, I think the key is to make the attempt fun and interesting regardless of the outcome. The project is also opensource, right now that just means its available to all on my github(I cant image its much use to most in its current state) but i hope to clean it up and make it more universally available via api's and documentation once the code reaches a mature enough state. 

**My Plan**
In the last post I made I left the story as I was just starting on a state run accelerator program for entrepreneurship. The idea I had pitched was to automate the task of measuring patients heart rates in hospitals while they stay in intensive care generally overnight. In Ireland this is currently done by nurses, they manually take the pulse, enter the values into a formula that gives an estimate for the risk to the patient. Currently this is done on pen and paper and nurses who often works incredibly long shifts (due to a staff shortage in the country) typically will be responsible for 8 patients. Besides the long shifts and the nature of manual calculations on paper being hard to avoid small errors; the nurses I interviewed said they often had all their attention on one or two patients who were really struggling. The measurement was suppose to be taken every hour but this could be missed for all kinds of reasons.

My assumption and value proposition was that if I could provide a low cost device that provided an accurate heart rate, and then If i could get this medically certified and complaint (with all the regulations) I could automate this task, give the overworked staff some peace of mind knowing all the patients are being monitored and allow them to focus on what is important. I knew going into it, this would be a massive task, it would take at least 5 years for certification alone. I had 6 months in the program to focus on the problem before I had to return to work. My aim was to use this time to prove the business case and more importantly to prove the technology. 

Realistically I would need to partner or sell the idea into a much larger and established company and to do this the technology would need to be very mature for anyone to invest in the certification process. Any partner would also require some patent protection to justify the upfront cost of the trials needed for certification. So this was a very very ambitious undertaking on my part. My decision to undertake it wast based on ego or ignorance but more the thought it was immoral not to try. 

I also had more selfish reasons. I knew that spending 6 months focusing all my time and energy on this project would really push me to the next level in my development skills both in business and tech.

**Living Conditions**
So with this plan I got started, I attended everything on offer and I spent all my free time coding. At the time I was in a tiny apartment in Dublin, this apartment was actually just a room that was converted, it had a single room with the cooker, bathroom and desk all together, I cannot stress how small this place was. When I was cooking I had to move the bed in front of the door. The place had no internet and it had a coin operated electricity meter. Hot water and heating was a distant memory and I could hear everything my neighbours did. 

It was all I could afford at the time and I was happy I found it. I took as many opportunities as I could  to get out of the room, I worked in coffee shops or parks. In Dublin then as now there was/is no place to go after 8pm. Most coffee shops close after 4pm and the rest by 8pm. I tried working in pubs but this proved impossible its just not culturally acceptable here to work on a laptop in a bar alone, people take it as an invitation to talk or worse as a source of entertainment to mock. TBF most people go to bars to relax and escape work so they don't need a reminder. Other issue was public transport, which mostly stops in Dublin at 11pm so I often found myself walking home after meetups or networking events through less than safe areas. 

The point of talking about all this isn't to generate sympathy or give excuses, I just want to give the backdrop and setting and then to tell you this was one of the best and happiest times of my life. The stimulation, elation and joy of working on a project I was passionate about was incredible and having the freedom to think past the next few days and into the future was incredible. Up to this point I was living day to day barely able to think past tomorrow. This period in my life really proved to me that when you work on something you truly care about and you can do so sustainably you will be happy regardless of the conditions (again provided they are sustainable both from a health and financial point of view).

**The Accelerator**
The accelerator was incredibly challenging, It was so clear to me I had an opportunity but I would only get out what I put in. On the business side I had to do a crash course on starting and building a business, I needed to submit a business plan by the end of the program and I needed to create a pitch deck and practice pitching it weekly in front of different crowds. 

For someone like me with no background in business or finance this was a challenge I also needed to get up to speed fast with sales and marketing. Most of the other participants were a team with people focusing solely on their area of expertise. The other challenge I had to get over was speaking in front of people and also being grilled by experts in front of a crowd on a business plan I was trying to pull together. I always had a fear of public speaking, a heavy accent mixed with really rapid speech lead to a lot of embarrassing moments growing up with nobody understanding me, this was something I had to overcome quickly.

Some things were easier than other, I could binge for a few days on topics like sales or marketing. I could take out of these topics what I needed to write my business plan and ignore anything that wasn't relative to me. 

Other topics and areas were harder for example public speaking. I had to practice daily my elocution and speaking slowly and loudly, I then had to get over my fears and ignore the feeling my heart was going to beat out of my chest when I stood in front of a crowd. The third aspect I needed to work on was I needed to learn to think quickly on my feat and answer questions slowly, the final aspect was i needed to add some humour and a bit of theatrics into my pitches. I had a rough start with this but by the end of the program it all came together. I know consider speaking in front of crowds a strength I have.

In parallel to public speaking I needed to build up the business case, this required talking to a lot of people, reading a lot and watching a lot of content. One thing I came to realise is everyone had an opinion and they rarely overlapped, the other thing I quickly realised at least in my society is if you suggest doing something people will queue to explain why it won't work. Its a hard balance to get right but you need to be taking in feedback but equally having confidence in the idea and expressing that confidence to stop people throwing out ill formed criticisms, you also need to present the information in a way that stops a lot of question about problems you have solved or assumptions you have already tested. 

The final part of the business side is, for startups at least you need to build a team nobody invests in a single founder its way too risky. This was ultimately something I failed on but it wasn't from a lack of trying. 

One of the main issues was that so much of my network and often the most talented people I grew up with had emigrated due to the rent crisis, lack of opportunities and tbh a culture that has a lot of suspicion and discomfort with the new generation that grew up in free education and with access to the internet. There is also a culture and tradition in Ireland of leaving, its said people here vote with their feet and leave, the narrative is that there is nothing here for young people mixed with a narrative that if you never left and proved yourself you must not be any good. 

This is pretty common in a lot of post colonial societies its a general inferiority complex and in Ireland its mixed with a small economy, small resources and a small population in comparison to other places in the world.

To find a co-founder and a potential team I started attending as many meetups as I could, I joined a lot of organisations like the World Economics Forum Global Shapers, the Youth Council of Ireland etc... There wasn't all that much to explore in Dublin so when I ran out of places to try I started my own groups or took over existing groups, so I took over Ireland's biggest functional programming group for a while and I even started a 5 a side soccer team. This was a process I started in the accelerator and that continues to this day. I haven't fully figure it out but I realised its part of a bigger global problem and that is how to build a community. I will probably post about this at some point in the future but I think its the core to being successful at anything in life. 

On the business side of the program I was very successful in the business plan but failed totally to build a team in 6 months, this basically meant raising money was impossible and I would have to bring the idea to an established company.

**Building the system**
To bring the system to a company it needed to be very mature, to me this clearly meant taking my prototype that was written in python and held together with wishful thinking (the code was terrible and not even its author could love it) and turning it into a robust scalible system.

The real time requirement of the system meant I needed to use multiple treads and this ran me straight into the limitations of Python. I believe it is possible to write python code to run in parallel across multiple processes but at this point I was running into the limitations of the language everywhere. I wasn't using types so finding bugs was increasingly hard, it wasn't compiled so everything I ran the code I was afraid the fan on my laptop would take off. I was using the python version of OpenCV, using opencv comes with its own frustrations but I wanted to switch to its native language to avoid the type conversion bugs. 

C++ was the logical choice, it was the language OpenCV was written in which did 90% of the work of the system. It was compiled so I could building it for mobile which was a very attractive option. It was a lot more efficient which meant lower server costs if I went the API route. The greater power meant I could do more with less resources which is what I wanted. 

I also had a lot of personal bias, I had written a lot of JS and python but I always preferred C, I also had recently really gotten into Object Orientated Programming and I boarded the hype train with all the enthusiasm i had. I really like the similarities with biology in OOP and more than that I was so tired of the spaghetti code I was writing when my project grew so having a robust framework to organise my code was very exciting. I was really craving structure at this point. 

Looking back aiming to go from an imperative programmer who used python; to building something this complex with something as complicated as C++ using a new coding framework in 6 months was very naive even before you consider all the other commitments I had. In truth I did it because i had to do it. 

I started the with the c++ the first week of the program, the frustrations were ever constant from the start of the program to the end. In the six months of the program I threw all the code out and started from scratch numerous times. It was only in the last weeks of the program I was actually matching the accuracy of the prototype. This was definitely not the best way to learn a language or even a good way. I learned through sheer brute force and ignorance. 

Looking back now it all seems so obvious but I think I was able to pick up so many skills and abilities after the program in c++ based on this early experience and frustrations. For example when I later came across functional  and generic programming I immediately saw the benefits over OOP, and vice versa I saw when OOP was better. I later came across Cmake, and Valgrind and Conan and was able to quickly add them to my toolset because I could excitedly binge on learning them to overcome the frustrations I ran into in the first 6 months of the project.

**Outcome of the Program**

When I left the program I had a business plan, a pitch deck and a robust system in C++. Unfortunately I didn't have any more funding, I didn't have a team and the system I built was solid but not nearly mature enough for certification. Overall I learned a lot  but I wasn't successful in achieving what I set out to do. I think my goals where achievable and I could probably achieve them with a second try but I underestimated the challenge at the time and over estimated my abilities. 

One surprise outcome was that I won a local start up competition with my idea, winning the best young entrepreneur in my region of Ireland, this was a massive confidence boost.

After the program I realised I really needed to get some experience as a pure programmer in the tech industry. I took a job first in the famous Bell labs, then in a robotics startup, after this in a big data, AI startup and now I work in an established telecoms company. I think this was the best move for me, I got first hand experience in professional C, C++, Rust development with agile, scrum, CI/CD and all the skills needed to bring and scale a software product to market. In all I spent 4 year moving between these roles and no two role were the same. As I'm typing today I'm in a much stronger position as a developer and a much more mature person. 

**End of the introduction part II**

I'm going to stop here in the story and write about my experience in industry in the next post, ill also talk about how I worked on the system on the side and came to the realisation I needed to make it an opensource library with a showcase free to use application. There are probably two or three more posts of content before I can get up to date with what I'm working on now; and my future plans. 

Looking forward to seeing you in the next one.

Shane