My summaries from the sixth Python meetup in Leiden (NL).
His first experience with Mongodb was when he had to build a patient data warehouse based on literature. He started with postgres, but the fixed table structure was very limiting. Mongodb was much more flexible.
Postgres is a relational database, Mongodb is a document database. Relational: tables, clearly defined relationships and a pre-defined structure. Document/nosql: documents, flexible relationships and a flexible structure.
Nosql/document databases can scale horizontally. Multiple servers, connected. Relational databases have different scaling mechanisms.
Why is mongo such a nice combination with python?
The PyMongo package is great and has a simple syntax.
It is easily scalable
Documents are in BSON format (“binary json”) which is simple to use and pretty efficient.
He showed example python code, comparing a mysql example with a Mongodb version. The Mongodb version did indeed look simpler.
The advantage of Mongodb (the freedom) also is its drawback: you need to do your own validation and your own housekeeping, otherwise your data slowly becomes unusable.
Mathijs is now only using Mongodb, mostly because of the speed of development he enjoys with it.
He showed a couple of videos of drummers. Some with and some without “blast beats”. In metal (if I understood correctly) it means both a lot of base drum, but essentially also a “machine gun” on tne snare drum. He likes this kind of music a lot, so he wanted to analize it programmatically
He used the demucs library for his blast beat counter project. Demucs separates different instruments out of a piece of music.
With fourier transforms, he could analyse the frequencies. Individual drum sounds (snare drum hit, base drum hit) were analysed this way.
With the analysed frequency bits, they could recognise them in a piece of music and count occurrences and pick out the blast beats. He had some nice visualisations, too.
He was asked to analyze “never gonna give you up” from Rick Ashley :-) Downloading it from youtube, separating out the drums, ananlysing it, visualising it: it worked! Nice: live demo. (Of course there were no blast beats in the song.)
Live demo time again! He build a quick jekyll site (static site generator) and he’s got a small hetzner server. Just a bit of apache config and he’s got an empty directory that’s being hosted on a domainname. He quickly did this by hand.
Next he added his simple code to a git repo and uploaded it to github.
A nice trick for Github actions are self hosted runners. They’re easy to install, just follow the instructions on Github.
The runner can then run what’s in your github’s action, like “generate files with jekyll and store them in the right local folder on the server”.
The runner runs on your server, running your code: a much nicer solution than giving your ssh key to Github and having it log into your server. You also can use it on some local computer without an external address: the runner will poll Github instead of it being Github that sends you messages.
The auto-deploy worked. And while he was busy with his demo, two PRs with changes to the static website had already been created by other participants. He merged them and the site was indeed updated right away.
My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):