I wrote a program that made me healthier

Periodically, due to tonsillitis, I need to visit an ENT about twice a year: for check-ups, treatment, and other minor things.

The problem is that there is only one ENT in the local clinic, and their schedule is always fully booked two weeks in advance.

That is, if you want to book an appointment through EMIAS (Unified Medical Information and Analytical System of Moscow), it's not possible. You need to constantly recheck the schedule and "catch the gaps".

A couple of weeks ago, I managed to catch such a gap, came to the appointment, they prescribed a course of procedures for me, which meant another 4-5 visits, and the next appointment was only in 10 days.

What to do, I booked it.

But the next morning, I accidentally found out that a "gap" was available that day, and I immediately booked it. As a result, I managed to visit the ENT two days in a row by appointment, which is usually impossible.

That is, for some reason, slots can become available, and it would be great to find out about it as early as possible.

I went to https://emias.info, looked at how their API works (by the way, for authorization, a policy number and date of birth are enough, very convenient), and wrote a small program within an hour that pulls the schedule every minute and sends me an email notification about the available "gap". I set up my phone so that these specific notifications immediately appear on the screen, and as a bonus, they also appear on my watch.

Everything worked very well. The program reliably and promptly sent me available slots every day, and I just had to book them. And with the help of Yulia's policy, I "booked" the next day's appointment (a patient cannot book twice with the same specialist).

As a result, I was able to visit the ENT four more times in a row, went through a full course of everything needed, and I'm happy with everything. And the ENT goes on vacation next week, so everything turned out to be timely.

Perhaps, these were the most useful 200 lines of code in my life.