Category: English

and now Ippocra

E ora Ippocra! I always had the idea to build something like Ippocra, a way to manage your own health records in a way that is easy, secure and simple.

This starts from long time ago. I still remember the first attempt, called myhealthserver which we built in an Hackathon in Cambridge long long time ago (more than 20 years). It was me, Matias (hi there :D) and joined us on the day an MD that interested in that. It was a two days Hackathon, and we had quite a lot of fun.

After that I did not continue on the same path, but I focused on finishing my joint PhD at the University of Cambridge and EBI. I’ve written quite a lot of software, from 3d neurons visualizer, to algorithms to model the connect biochemical and electrical systems, while fostering a culture of open-source, and tracking code in version control (Git was just invented, and I was showcasing it to my pre-docs community and tried to convince them to adopt it, with a decent rate of success).

Finished the PhD I decided to launch my first startup, SustainableSouk, an en devour focused on making local food easier to find and order. This was way back, in 2012, when this idea was still super early. I was part of the Transition Cambridge movement and we tried to look at that for a bit. We realized pretty soon that we needed lots of stamps and authorization, treating food and beverage, making the whole enterprise too expensive to launch, and we decided to stop it. Also I did not want to end up managing lots of physical goods, so I switched.

After that I went working for DVLTech, where we start to build Darktrace. I was the one creating the Math Team, and leading it as Head of Math (Hi Tom, Steve, Damian and Valerio!), and I built a whole team from scratch, focused on detecting network anomalies. It was very fun and very challenging, but we had a phenomenal time. I also set up the local basketball Wednesday play, which we used to play in our lunch break, with a phenomenal uptake. I still have a basketball signed by all my former colleagues. As a side hustle I worked on Conduit (Hi Daniel!), which become the second biggest bitcoin exchange in UK for a while.

The love for biology/genomics call me back again though, and I start to collaborate with Sofia Genetics (Hi Tamara!) to build MOKA, a software made on coffee (and not, it’s not an acronym eheh, where we had 3 patents) and which is still used by Sofia Genetics AFAIK.

Then my Seven Bridges years started, where I joined the London office very early on (hi Julia!) and we started to establish the foot print of Seven Bridges in UK and Europe (which at the time was still in the European Union). Lots of fun, proposing the platform to customers to have an easier, faster and reproducible way to do complex research. I’ve soon started to work with the Children Hospital of Philadelphia and the Cavatica platform (Hi Allison and Adam!). This was a phenomenal partnership, where we managed to push the boundaries of possibility, making it the best platform in the world to do research, while making sure that the whole field was advancing with us. Lots of colleagues who I shared really good time at SBG, starting with the folks in my team (hi Surya and Jared), the whole Program team, and the folks in Belgrade office.

This is way I’ve focused very early on on the standards, making sure we had open-standards that were possible to adopt by anyone, in a fast and easy way, and most importantly, they were solving a problem that people had.

This was done under the GA4GH umbrella (Hi Brian, Heidi, Ian, Kurt, David!), where we have invented DRS, Passport, how to connect them, and how to connect these to FHIR. I called this strategy the interoperability triangle, and it was pretty well accepted both at Seven Bridges and also outside (It was adopted by the NIH, and it was also reported in the congressional papers in the senate of the United States of America.)

And now it’s time of Ippocra! A new adventure that just started, but already is giving us very good vibes and we are seeing real interest and validation.

Stay tuned for more!

6 Nations 2025 calendar file – get it here

I was looking for a 6 Nations 2025 calendar in the `ics` format, so I could add it to my own google calendar, to have an idea who was playing and what time.

Do you want a calendar file? Give me all your information

I was taken extremely disgusted by the approach taken by the folks at https://www.sixnationsrugby.com/en/m6n/fixtures/2025, who, when you try to add a calendar, instead of just giving you the file, ask you to provide access to all your google calendars (or equivalent) via the Ecal website.

The permissions required are way too broad for such type of request, and it makes no sense.

This is what you see when you try to add the calendar:

Picking google this is what you see:

To track some rugby matches, that are happening between Jan and March, this wants to have a constant access to all my calendars!

The only decent answer is no thank you.

Given the information are available, on when the matches are happening, written in several website, I took that info, I given to an AI and I had that generated the ics for me.

You can find it below. Simply import it in your calendar and should be good.
As usual, Forza Azzurri 😀

HTH!

Lifting a blind roller in a DIY approach — just a planning post

The Problem: I have two massive blind rollers that are operated by hand. I would like to explore the possibility to lift them using a combination of electric motors and gears.

The main idea is to figure out how to achieve that with very small motors, and have a system that would work not too slowly to be completely useless.

Following the information provided in this post, the problem can be decomposed into two:

  1. The torque of the model. With the right gearboxes also a small motor could lift (slowly) a heavy weight, so that is something that needs to be explored
  2. The rate of which the motor can lift the weight.

While the first one is difficult to calculate, the main idea for the second can be calculated using the following formula:

\[ W= m g h \over t \]

Where W is the power required to lift a mass m of an height h in a time t.
It’s also possible to rewrite as the velocity v on which such mass gets lifted (because v = h/t):

\[ W = mgv \]

So if we use 10Kg as weight, to lift this at a speed of 1 m/s would require a power:

\[ W = 10 \times 9.81 \times 1 = 98.1W \]

This is just the beginning of the rabbit hole. I may post updates in the future if I will continue this. We will see.

Fun with Pyscript

Update: you can have only one py-script block for now. I removed the example one, and just left matplotlib example.

Pyscrypt has just been released and I feel I had to give it a go straight up from my blog.

The usage seems to be pretty straightforward:

  • you drop the link to the pyscrip.js in the HTML, and then you have the new <py-script> tag where you can write Python. Standard Python.
    For example the code below actually gets transformed into a string with the content Now you can!
<pre>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>

<div id="target"></div>
<py-script output="target"> 
from datetime import datetime
now = datetime.now()

</py-script>
</pre>

which produce the following result!

        
        

from datetime import datetime now = datetime.now() #print("What time is it?") #print("Computed directly from Python: " + now.strftime("%m/%d/%Y, %H:%M:%S")) #print("Now you can use Python within the browser natively!")

Interestingly, you have the full Python arsenal at your disposal.

This code creates a matplotlib plot:

<pre>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css">
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-config>
      packages = ["matplotlib", "numpy"]
</py-config>
<div id="mpl"></div>
<py-script output="mpl">
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np

# First create the x and y coordinates of the points.
n_angles = 36
n_radii = 8
min_radius = 0.25
radii = np.linspace(min_radius, 0.95, n_radii)

angles = np.linspace(0, 2 * np.pi, n_angles, endpoint=False)
angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1)
angles[:, 1::2] += np.pi / n_angles

x = (radii * np.cos(angles)).flatten()
y = (radii * np.sin(angles)).flatten()
z = (np.cos(radii) * np.cos(3 * angles)).flatten()

# Create the Triangulation; no triangles so Delaunay triangulation created.
triang = tri.Triangulation(x, y)

# Mask off unwanted triangles.
triang.set_mask(np.hypot(x[triang.triangles].mean(axis=1),
                         y[triang.triangles].mean(axis=1))
                < min_radius)

fig1, ax1 = plt.subplots()
ax1.set_aspect('equal')
tpc = ax1.tripcolor(triang, z, shading='flat')
fig1.colorbar(tpc)
ax1.set_title('tripcolor of Delaunay triangulation, flat shading')

fig1
</py-script>
</pre>
        
 
 

      packages = ["matplotlib", "numpy"]

import matplotlib.pyplot as plt import matplotlib.tri as tri import numpy as np # First create the x and y coordinates of the points. n_angles = 36 n_radii = 8 min_radius = 0.25 radii = np.linspace(min_radius, 0.95, n_radii) angles = np.linspace(0, 2 * np.pi, n_angles, endpoint=False) angles = np.repeat(angles[..., np.newaxis], n_radii, axis=1) angles[:, 1::2] += np.pi / n_angles x = (radii * np.cos(angles)).flatten() y = (radii * np.sin(angles)).flatten() z = (np.cos(radii) * np.cos(3 * angles)).flatten() # Create the Triangulation; no triangles so Delaunay triangulation created. triang = tri.Triangulation(x, y) # Mask off unwanted triangles. triang.set_mask(np.hypot(x[triang.triangles].mean(axis=1), y[triang.triangles].mean(axis=1)) < min_radius) fig1, ax1 = plt.subplots() ax1.set_aspect('equal') tpc = ax1.tripcolor(triang, z, shading='flat') fig1.colorbar(tpc) ax1.set_title('tripcolor of Delaunay triangulation, flat shading') display(fig1, target="graph-area", append=False)

Note: If you are trying to use the <py-script></py-script> on wordpress, using a Custom element block, you need to wrap the code with <pre></pre> otherwise wordpress will texturize the text, changing the characters to some more pleasing to the eye. However the HTML is actually executed by the py-script and it will not understand this link.

How to connect externally from a WSL (Ubuntu) running on a windows 10

I had to move to a Windows 10 computer for work, and even if I’m not working a lot on code and so forth, I need sometime to create an ipython notebook or try to launch some code I’ve got from github.

Having the ability to install the ubuntu distribution via the WSL2, directly form the Microsoft Store is a great help. The ability to use Visual Studio which connects to these “magic” area of the filesystem makes also the editing nice and easy.

Usually I like to go with the console, and I’m using the Windows Terminal, which is able to launch several environments in a native way.

However there is a little snag: you cannot contact the outside world or the internet, because by default the Windows firewall says no.

It’s easy to fix, thogh: Open the PowerShell as Administrator and launch:

`New-NetFirewallRule -DisplayName “WSL” -Direction Inbound -InterfaceAlias “vEthernet (WSL)” -Action Allow`

as shown below

Power Shell running as Admin

After that, you are golden. Unfortunately, for me, I have to re-run that every time I re-boot or come back from a Suspend. I would be very interesting to know if someone figure out how to do it in a permanent way.

Get the OEM key from your windows 10

So I’ve got this new computer with Windows 10 because Baldurs Gate 3 is coming out, and I did not have a tower for quite long time. The windows has been installed by the people where I’ve got it, and there is a second partition where I will install ubuntu. Unfortunately on the first go it did not work due to the NVIDIA card inside, (just a GTX 1060, not the new 30 series that everyone is going crazy about it), but the net has already a solution for it, which I will give it a try ASAP I’ve got time.

At the same time I’ve used it to play Heroes of the Storm and I’ve also tried my first stream on twich.tv at https://www.twitch.tv/brownianmotion1 . I stream HOTS in Italian, and it just a quick foray into that world because I’m a curious person.

I’ve used OBS to stream, and it seems everything was working quite well.

Back to the Ubuntu install, given the first try did not really work, I wanted to take a more cautious approach and save the windows key before I had to reinstall everything again, for safe-keeping.

To my surprise new rigs do not came with a sticker which says which is the windows key associated, but it’s written in the UEFI BIOS directly. When I’ve asked the support of the company where to get it, they told me this was attached only to that mother board, and if I was going to change the motherboard I had to get a new one.

While this makes no sense to me at all, given that I bought a personal license for windows, I was not very clear why I should not know the key of the license I bought.

Quick googling (via ecosia) and I found out this video on youtube which provides the solution in no time:

Open A PowerShell and type  (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey

Once I’ve got it, I’ve saved it on my clipperz.

HIH out there.

Have fun.

 

Opensourcing gardenio & friends

View this post on Instagram

Winter sunset are the best

A post shared by Michele Mattioni (@mattions) on

Some time ago, I’ve described what was the initial work done on the gardenio system to have smart plant monitoring in the house.

Today I’ve open-sourced the code. You can find gardenio on gitlab, and also the code for django website connected to it as well. At the moment the arduino bits have been disbanded, but it’s handy to have it out there as a possible blueprint for projects of this type.

The whole system was run using ROS1 and it’s handy to have it open to be used as an example for the next work that will go towards the Dimitra project.

BTW, if you are interested in collaborating on agritech solutions, which involves automatic robotic system applied to urban and small scale agriculture, just give me a shout.

If you were curios, that’s what the Dimitra project is all about.

Some little changes

View this post on Instagram

Dawn of a new day

A post shared by Michele Mattioni (@mattions) on

Since my old post regarding the smart plants with Arduino and the Rasperry Pi experiment some things have changed, and I think it would be good to write about it.

First of all we have moved country! We left London and the UK, being part of the secret Brexodus tribe which does not get talked about it too much by the media, and we moved to Ancona in Italy. If you wondering, the Brexodus tribe is all the people that decided to leave Brexit land for safer/better places; given the fair amount of people, usually with diverse jobs and across the board, we have renamed this internally the Brexodus, the Exodus from Brexit. We do not of course know each other (unless in a very small amount of groups, but this is a clear phenomenon which will become more clear going forward).

Several reasons did contribute to this decision. We literally moved just before the “original” Brexit deadline was supposed to arrive (the 29th of March), and we actually took off for good on the 21st of March, landing in Italy the same day (of course :)).

We could have gone for settled status in UK maybe, but you never know with the UK Home Office and the UK Government what they will do. To be fairly honest we never really investigated too much what we had to do. We didn’t feel like London was anymore the best place to live. More over our rights have been stripped away in one night via a referendum on which we couldn’t even vote, and which has basically changed everything. Therefore why waste time on that?

Honestly, given the latest news, I have no idea what the UK will do. However we know what Earth will do 😀

From https://bewilderbugs.tumblr.com/post/184300091725/maybe-this-will-be-the-storyline-for-star-trek

When I started this post, I wanted to write about three things not really related:

  1. the move, which I wrote above
  2. some changes on the ads shown here, which made me think about the move
  3. some robotics news I’ve read today that I found interesting (related to the last blog post I wrote, that’s why they pop up)

So here we go with the last two.

Regarding the ads, I used to have an AdSense ad on the sidebar. I’ve set it up long time ago, and if you are interested why, I’ve written in this very old post. Changing country I had to close it down, and I do not feel it would make sense to bring it back, therefore, from today, the Sidebar does not show ads anymore. Given that I run the blog myself on a dedicated server, no more ads on this pages will be shown for the time being.

On the robotics side, as I have written before on the plants post, I’m looking into building an automatic robots for agriculture with wheels, and I’m interested in ROS2 development to do that part. Today I’ve discovered that Acutronics has closed down. I was really interested by the work they were doing, and the arm that they have developed was ROS2 compatible. It seems they did not manage to get enough funding to go ahead. A pity, they were doing a really great job.

That’s all for now.
Have fun!

Smart Plants via Arduino and Rasberry Pi

View this post on Instagram

Smart plant #arduino #iot

A post shared by Michele Mattioni (@mattions) on

I always looked at electronics in wonder, and I always liked circuits. I remember during my high school I have created a project with four light bulbs, powered by a battery: two in series and two parallel to demonstrate how the electricity was splitting between the two. I found it fascinating, but I never managed  to get back into it.

The itch to scratch

I have four plants on the window of my kitchen at the moment: a (now dead :'( ) rosemary, a parsley, an orchid and  a basil. I never knew when to water them. I never knew if I gave too much water, or too little. On top of that, different plants have different needs, so you have to keep track of it and can’t just water equally.

In the past I have discovered that some of the plants were drowning in water, which was collected in the bottom of the pot, making the roots mostly mouldy and in the end causing the plant to die.

On top of understanding the water needs, I wanted to create an automatic water plant system, which would keep the plant well hydrated automatically, while I could follow what was happening from a web interface.

At the same time, I wanted to explore the robotics world, and to have a project where I could use the Robotic Operative System ROS.

Components to create Gardu

After a bit of thinking, I’ve created a Gardu, which is an automatic way to keep track if the soil irrigation, and having the possibility to follow it from afar.

These are the different pieces of the puzzle:

  • ROS based Arduino/RasberryPi (Gardu):
    • 4 soil sensors
    • a 12 volt pump
    • a servo
  • Django powered website (Gardenio) to track the readings and associate the plant

This is the flow:

  1. Gardu acquires analogic read of soil irrigation from a sensor
  2. Gardu makes a post request to the Gardenio website with a unique identifier (which is unique to each Gardu, and it is embedded in the firmware code)
  3. Gardenio stores the value for that sensor, finds the associated plant, and responds with the threshold of minimum soil irrigation value for that plant back to the Gardu.
  4. Gardu process the value: if the read is above the threshold, then Gardu sends the command to water that plant

So far I’ve managed to finish the soil sensor acquisition, while I have an early prototype for the automatic watering.

This summer, while I was away, I could track my plants getting thirsty from far away:

That’s when the rosemary died, eheh.

I’m still sorting out the water pump, due to the problem with the wiring on the circuit. This is the current circuit for now (the servo is not here).

Circuit for the water pump system (missing servo)

The soil sensors part works like a charm and they gave me no real hard time, the servo/pump combination instead it’s a little more complicated to handle.

They need external power, which is provided by the battery, but because they are connected on the same circuit, they do not work reliably at the moment. It seems that a possibile solution would be to use a UBEC.

Once that is done, the servo gets hooked up to a custom designed 3D printed valve that looks like this:

The inner red part rotates, do the top hole in the green part is in axis with the one in the red part, which then is in axis with the blue tube which will be connected with each plant. The idea is that only minimal amount of water will go towards the other plants, and most of it will go to the target plant. You can see it on OnShape here.

After some quick testing, I have a strong feeling that this is not gonna work, and the design may have to change.

So, given the automatic water system is still a work in progress, this time I will also be able to track the thirst of the plants from far away.

For now we are looking ok:

Current status of the plants. Live data at https://gardenio.ideallab.org/garden/gardus/1/

The race is on: will I be back before the plants will go completely dry?How many will I loose this time? Future will tell.

Running wordpress on HTTPS with dokku and let’s encrypt

An nice (unrelated) pic to start 🙂

After dusk pic are pretty.

A post shared by Michele Mattioni (@mattions) on

So the big question… Is your site running HTTPS? If no, you should, if yes well done!

Prologue

This personal blog has been moved from wordpress.com into a personal hosting powered by dokku long time ago. While this has been proved to be pretty nice, I honestly think that wordpress has reached a maturity level, where you can just get away running the software on a PHP powered website (like an Apache with the PHP module or whatever), switch on the automatic updates, and be happy with that.

Basically, install once, and then forget about it.

So while doing the upgrade manually via git it’s not a big issue (here is the little README I wrote to remind myself of the procedure), you still have to do the upgrade once in a while.

All this was always feeling a bit as wasted effort, until I decided that I should have moved the site into HTTPS.

Getting these pesky HTTPS certificates

In few words: HTTPS encrypts the traffic that goes from your web browser to the server that handles the request; to perform the encryption a certificate, provided by the server, it is used. The legitimacy of the certificate is provided by a root certificate authority. While you could issue a certificate by yourself, which would be valid and be perfectly valid from a technical standpoint, your site would still be marked not secure. The catch is that Firefox/Chrome and the other web browsers do come with a list of “root authorities” that they recognise as legit. Therefore, your technically valid HTTPS certificate is not connected to any of this “root” authorities, and therefore not recognised by the web browsers.

For quite he only way to get a HTTPS was to buy one from a seller, who will be able to issue one, connected with their root authority. This usually was either for a certain domain, or a wildcard for all the sub-domains and it was costing around 20/30£ per year, depending on the seller. Note that the validity was usually for a year, therefor you had to manually get a new certificate, and do the reinstall, which usually meant run some commands, and then add it to nginx or apache to be able to serve from https.

So this process was pretty labour intensive, it was costly and most importantly, when the certificate was going to expire, the website was going to be “untrusted” the red bar with the broken lock in the address bar was showing up.

Let’s Encrypt to the rescue

Let’s encrypt it’s a root certificate authority that is able to provide HTTPS certificate. Their goal is to make the internet safer and more secure, therefore they provide the HTTPS certificate for free. More over, while they do not charge for the certificate, they also provide a way to programatically get a certificate and renewed it, in a very easy and straightforward way.

What’s super nice, it’s that dokku has a very nice plugin able to make all the process automatic for the user.

In my case, given that I have already wordpress deployed via dokku I just had to run the following command:

$ dokku config:set --no-restart myapp DOKKU_LETSENCRYPT_EMAIL=your@email.tld

This creates the certificate.

Then you have to encrypt your app. It’s just one more command:

dokku letsencrypt myapp

This one sets up the nginx configuration to re-directs the request to the https site for myapp.

It basically worked like a charm on the first go.

There is also the nifty command

$ dokku letsencrypt:cron-job --add

which will create a cronjob for dokku user to re-fetch and renew the HTTPS certificate in an automatic way.

Pretty neat, and now totally worth it to deploy the wordpress via dokku.