Day 1 Lightning Talks

This video features Alex Gomez Martin, Amiel Kollek, Can Bolukbas, Chris Cave Ayeland, Colm O'Connor, David Seddon, Kio Smallwood, Markus Holtermann, Nicholas Noe and Ronny Vedrilla at DjangoCon Europe 2023 in Edinburgh, Scotland.

Day 1 Lightning Talks
0:48:58
Published June 6, 2023
787 views

Lightning talks from DjangoCon Europe, 29th May 2023
https://pretalx.com/djangocon-europe-2023/talk/KETTEE/

Why Django is the web framework of choice for research software engineering
by Chris Cave Ayeland
https://youtu.be/ECpY36IcLkc?t=3

Salsa moves deconstructed - a finite state machine perspective
An unusual perspective on understanding the underlying structure of salsa moves with finite state machines.
by Can Bolukbas
https://youtu.be/ECpY36IcLkc?t=352

PyCamp
It's an event done in Spain in which 30 people rent a home in the woods and collaborate on projects decided on the first day.
by Alex Gomez Martin
https://youtu.be/ECpY36IcLkc?t=639

Write your own timeseries database for fun and profit
How building something really difficult helps you learn and grow.
by Kio Smallwood
https://youtu.be/ECpY36IcLkc?t=845

Traceable migrations with reversion
Django Reversion provides great traceability with version history on all objects, but it doesn't work for data migrations! See q quick fix for traceable migrations.
by Amiel Kollek
https://youtu.be/ECpY36IcLkc?t=1232

Layered architectures in Django
How do you stop your projects from tangling into spaghetti? Layers!
by David Seddon
https://youtu.be/ECpY36IcLkc?t=1383

Django pony express
How to save your day by using class-based emails in Django
by Ronny Vedrilla
https://youtu.be/ECpY36IcLkc?t=1658

iNaturalist
A quick overview of iNaturalist, a platform/mobile app that eveyone to record useful biodiversity data everywhere they go and learn more about nature.
by Nicholas Noe
https://youtu.be/ECpY36IcLkc?t=1842

How to make writing docs less of a chore
by Colm O'Connor
https://youtu.be/ECpY36IcLkc?t=2134

Pushing to survive
by Markus Holtermann
https://youtu.be/ECpY36IcLkc?t=2440

Summary

The presenters cover a range of practical ideas: research software engineering and Django’s role in building maintainable research tools; modelling salsa as a finite-state machine; the collaborative PyCamp format; compact storage techniques for time-series data; recording Django data-migration changes with Django Reversion; layered architecture enforced with Import Linter; class-based emails and test helpers in Pony Express; citizen science with iNaturalist; and generating tests and documentation from one Strict YAML specification. The final presentation gives basic first-aid guidance for assessing responsiveness and breathing, opening the airway, calling emergency services, and beginning CPR when necessary, but the transcript cuts off during that explanation.

Key takeaways

  • Research software engineering treats software quality, sustainability, and impact as essential parts of doing good research, with Django serving as a common web framework at Imperial College.
  • Salsa can be represented as three positional states with nine possible transitions, giving dancers a way to analyse variety and repetition in their movements.
  • PyCamp brings developers together for several days of collaborative projects, learning, and informal social time, with participation kept flexible rather than tightly scheduled.
  • Time-series data can be compressed through binary encoding, scaling, differencing, run-length encoding, and variable-length integers; one production archive reportedly stored 58 billion points at about 1.09 bytes per point.
  • Django projects can gain traceability through Reversion-aware data migrations, modularity through layered dependencies and Import Linter, and reusable email handling and testing through class-based email abstractions.
  • Strict YAML can serve as a shared specification from which executable Playwright tests and user documentation are generated, while iNaturalist demonstrates how phone observations can contribute biodiversity data to research.

Summarised automatically from the transcript.

Transcript

7,903 words · auto-generated Show

Automatically transcribed, so expect mistakes in names and technical terms.

0:08

Speaker 1: Thank you very much. It's my uh my first time at Django Con, so thank you for the uh the applause before speaking. It's very nice Um so yeah, as I say it's my first time and I'm all by myself, so do come take height if I look lonely. Um but and I'm gonna confess Um the the the main reason I'm doing this talk is that I just want to talk to you about software engine research software engineering for a few minutes, and then I'll tag some Django stuff on at the end. Out of interest, has anyone come across the term research software engineering before? Yeah, we got a smattering of hands. I thought there was some. There's probably some of you out there, I imagine. We are everywhere. Um It's quite a simple idea really. It's uh it's research plus software engineering. It's not a very innovative name, perhaps, um, but it kind of represents the I the idea that um

0:54

Speaker 1: research involves developing an awful lot of software We should probably do that well, right? Um and it's a very simple name, but it's I think it's you can't really overemphasize the level to which the name has been really, really key for us. So there've always been this sort of, well not always, but you know, since since uh sort of computing and programming became something that happened in research, there's always been this class of person in the academic system who had this gr skill set around developing software, but they were just never able to progress within the academic system because that's not how the the rewards are structured, right? You you can't get very far. by spending your time being good at programming. You have to spend your time writing papers and getting grants and doing all that stuff. About eleven years ago, I think someone came along and and uh and said

1:41

Speaker 1: uh like in a workshop in London, I think basically a group bunch of people in this situation came together and they invented this term, research software engineering. And that is Basically, we've been the catalyst for this um for this kind of grassroots movement that's kind of sprung up across academia with this mission around improving the quality, sustainability, and the impact of software that is developed as a part of research. It's going pretty well. Um so we can say you know uh eleven years ago in London the fur the the idea was first coined. This now uh really is uh uh you know a large number of organizations uh across uh across the world in various places. And um and what has sprung up around this as well is what we call RSE groups. Which are basically teams embedded within universities that have uh a focus on software engineering within uh the institution

2:31

Speaker 1: and sort of working with um with with partners in the research space to help them develop software. There are some groups all over the world and the UK has been a real place where this idea has really taken hold. So um these are not necessary beliefs to be a research software engineer, and these are certainly not universal beliefs amongst research software engineers, but I would certainly argue these are pretty typical. And things that you all find uh people often believe. Um and so we you know we see ourselves as quite aligned with the concepts on open source and we're interested very much in that mindset around how we can collaborate rather than necessarily compete. And um And that uh that basically software is fundamental to research and good software engineering is fundamental to good research.

3:25

Speaker 1: Very briefly, just gonna whip through a couple of things about how we do RC at Imperial. So, you know, different countries and institutions have all kind of come up with their own kind of model for how to uh how to actually do it. We're a growing team. We're currently less than 10, but we're we're doing a good job of tying on lots of new roles and uh we hope to breach that soon. Some of the larger teams in the UK are uh 30, 40 people. We basically work as a consultancy service inside the college, so uh academic groups stump up cash and we uh we work with them. And we have this, so this sort of funded body of work is kind of our main thing, but we also have this very general remit around improving the quality of software that is developed at the college. And one of our and we kind of get this mix of people coming in, some people coming in from kind of like a programming software engineering background, but also a lot of people coming in from the academic research kind of background,

4:18

Speaker 1: much like myself. What and uh what we what we kind of end up working on is a is a really, really broad range of stuff, probably too broad a range of stuff, um, but it kind of means we're we're a team of generalists doing everything from um graphical user interface developments to supercomputing. So what does Django makes sense for us? And Django is our kind of go-to uh framework for uh for anything we need to stick up on the web. So that means it's uh it's kind of our our our common language and and uh and and something that uh a vast majority of our work i ends up being done in, uh

5:03

Speaker 1: although we do still have a bit of Fortran floating around. We are usually time resource constrained, but we do want to do things right. So perfectionist with deadlines sounds pretty bang on with what we want to do. Uh and it's really important that we have something standard across the team. We have a lot of people who've never done web development before. Introducing them to multiple web frameworks would be Tricky versus just one. And the built-in guardrails to Django make it really great. The kind of standard ways of doing things, the uh the important the emphasis on security, all good. And of course it's open source, which is Awesome. And it's e kind of easy to get people started on as well in that we have you have that great tutorials and uh easy things to get going. I'm just gonna leave a few things there as I am done.

5:48

Speaker 2: Fantastic. On time

5:56

Speaker 3: Hello. Today I'll be talking about deconstructing SASA moves with finite state machine perspective. What is salsa? It's a lively, rhythmic, and social partner dance. By social dance I mean there is no choreography needed. You can improvise along the way. There are two roles, leader and follower. Leader leads the dance by giving signals and follower receives the signals and acts accordingly. By the way, this is me and my partner from a dance competition. Why sauce is important to me? Because while I'm dancing, I can express how I feel freely.

6:42

Speaker 3: And also I can socialize after working from home. And lastly, I can get my body moving after a whole day of sitting. So uh let's start with finite state machine. It helps us to describe systems with um cute circles which are called states and arrows which are called transitions So for example, when the light bulb is switched off, when it's not emitting light, when you switch it on, you you go to the on state. And it starts to emit light, and when you switch it off, it doesn't emit light, so it's back to the off state. Let's construct the same for salsa. In salsa, follower determines the line that the dance will be made on.

7:31

Speaker 3: So with this information, there are only three positions that the leader can be. And we'll inspect those. The first one is basic position. Basically, leader is on the line. Let's see from examples. These are again from competition. I am on the line that my partner sets on and direction doesn't matter in this finite state machine. And the next uh state is cross-position. In cross position, you're out of the line because you your partner a your uh foldover will cross across the line. That's why it's called like that And the important part here is that leader is above the line. So this is a cross

8:16

Speaker 3: position. When you see it like that, it makes sense In reverse cross position it is similar, but you are below the line as a leader. And it is like that So like these are the all states of salsa. There are only three states. And let's uh talk about transition between them. For example, if you are in basic position, you can move to each state, also including basic position itself. And when you do this for all three states, there are total of nine transitions that you can find. And I assure you, every dance move on the dance wall is one of these nine transitions.

9:04

Speaker 3: And let's inspect from this video sorry I am on the line here, it's basic position. I am out of line, uh above the line actually, it's cross position I am back at being on the line and now I'm below the line which is reverse cross position and I am then I am in a basic position So after constructing this finite state machine, to get better in salsa, you can do two things. You can count the dance moves, you know, for each transition and identify the bottlenecks. For example, when you're

9:50

Speaker 3: transitioning from basic to reverse cross and you only have one dance move there, you can add learn new dance moves and you can increase the variety, it looks better And also don't repeat yourself. You can replace the repeated dance moves with the moves in the same transition. And uh for example if you are using uh one specific tense move while transitioning from reverse cross to basic you can use the other ones to add some variety again So this sums up my transition. You can think salsa as only three states and every dense move is one of those nine transitions. The rest is the story of you and your partner. Thank you for listening.

10:45

Speaker 4: Hi, I'm Alex. I'm pretty nervous because I haven't talked in public since my education, which was too many years ago, let's say And I'm going to talk about an event that to my knowledge only happens in Spain at the moment and has happened in the past in Argentina, which is the PyCamp. What is the PyCamp? The PyCamp is basically like the sprints of this conference, yours more more way more. It's this year for example was 30 people living in like a holiday house for four days, sharing room, sharing food, sharing everything, and then working together on projects. For example On the first day, sorry, on the first day we decide on what projects to choose

11:31

Speaker 4: So everybody that wants proposes a project. Don't ask why he's wearing that. That's not relevant. It's not a very serious event in case you haven't noticed. And the first day is pro everybody proposes, then we vote and then there is like a small schedule mate. Like which days are going to be each projects and everybody chooses what they want to work in. It's not strict, it's not at all strict like you can be edit free, you can go and just lay in the sun four days, nobody will mind. There is even a place where you where the tables that these are the tables where people want to stay alone in their own and that those are the roles And for example, this year we m uh one of the projects was a laser tag, which we somehow we managed to work in two days

12:20

Speaker 4: actually. I don't have actually a video of the lesser tag, but this is for example the connections and this is the the live when we were trying to play. It's like it's Okay, this wasn't good. Each flyer was a bad programming language, let's say , or the one that we don't agree, and we were just shooting each other with laser pointers. which it had a bikis which was it was too slow the live the live training so we got tired before we end before anybody died in game. Really tired. And it's pretty fit like the entire house is

13:05

Speaker 4: at to us It you you the food is done, everything is done, you just go there and do whatever you want. For example, this year it was my first time attending and I only coded half of one morning. Every time else I was just talking to people, learning stuff. I did a small project I lit a small project in Django, which was mostly following the tutorial with some people that were completely new to it and helping them And there this is the house, for example, it was up to us. And the here's the repository where I share everything that you can see in case anyone wants to scan wants to scan it And if anyone has any questions or wants to get in contact or wants to organize something similar in their country, which we will be

13:52

Speaker 4: the organizers of the PyCamp, which I'm not one of them, but in contact with them, we'll be very happy to help. Eh, feel free to find me and ask. That's all

14:12

Speaker 5: All right, thank you. Um my name's Keo. I work for a company called Flexaticity based right here in Edinburgh. Uh shout out to my boys Wherever you are. I'm on uh Fostadon. org as Sakenra. Um that's how to contact me and um I have written my own time series database um just to store some of the data that we deal with at Flexatricity which is an energy company So why do you need time series data? What's special about it? I was looking at uh parquet, which is a file format for storing um uh various kinds of data, data frames

14:57

Speaker 5: like uh you would use in pandas. Um and I was reading Facebook's Gorilla paper about how to compress um time series data and I thought I could do that So let's have a look at some graphs. Every presentation needs a graph, and this is one of graphs that we have in flexatricity. So it's a set of samples where each sample has an exact time of when it was measured. Samples usually from some kind of analog measuring device like a temperature, a frequency, power, flow rate. It might be a digital signal like on or off. or the state of a relay. These measurements might be coming in very rapidly from many different sources at once, and they need to be cataloged, summarized, and stored

15:42

Speaker 5: compactly, especially if you don't want to throw anything away. For a long time flexodricity has never thrown anything away. We're rethinking that now. Usually timestamps are sent like an isost string. Uh values as a floating point number, decimal strings, takes up some space. The timestamps are generally always in increasing order and usually with a fixed interval between them, like a sample rate. multiple samples associated with a single timestamp, quite a lot depends on this being true for aligning the data for multiple different sensors. And the values are samples of continuously varying quantity.

16:29

Speaker 5: Sharp discontinuities are usually an error or indicate something wrong, so they happen rarely. So you can store data sequentially in different ways. You can do it column-oriented or row-based. So keeping row data together means you can fast get all the columns for a particular timestamp at s at once. And this is how most relational database systems work. The only problem is it's difficult to make it compact because there's a lot of variety, the different kinds of values. They're slow if you just want a subset of columns. But if you keep the column values together

17:16

Speaker 5: adjacent, they're easy to compact because each value is related. You can do fast range queries for a single column. So like months worth of data for a single column is really trivial. And it's easy to summarize along the time axis. So you can do minimum, maximum, average. You can do statistical stuff over a much larger chunk of data than, you know, without having to go through each row. They're slow if you want to do multiple columns at once. So that's a trade-off you need to be aware of. And you have to store the timestamp once for each column. This is how I compact the data. This is based on Gorilla. Storing a timestamp takes a lot of space, so

18:02

Speaker 5: storing a number is a decimal string. The total of that is 30 bytes. So we could store it as a native binary format, number of milliseconds since Unix time, encode that in eight bytes as an int. The problem is most values can't be accurately represented. So if I pack that as a 32-bit float, what I get back out isn't exactly the same value, is it? But at 16 bytes it's much better. Let's see, can we go smaller? Yes, we can. The trick is we can scale it. So the timestamp is the same as before, but this time we're scaling the value to an integer. because we don't care about the fourth decimal place.

18:47

Speaker 5: We just multiply it by a thousand, we've got an integer, and then we can pack it into a 16-bit integer. So much less space Then we can take advantage of the relatedness between the values so we can uh do a difference between consecutive values and get much smaller integers that take less space to write. So we can also do double differencing as you can see. And then we can also do run length encoding, identical values. You can say there are four trues and then one false. Takes up much less space. We can also do variable length binary encoding. So we can prefix values and say this is a one-byte value, this is a two-byte

19:37

Speaker 5: value. For example, I can sp compress all of those numbers into just a few bytes there. So we actually use this crazy experiment in production. The total size of the archive is 61 gigabytes. The total number of data points is 58 billion. Bytes per data point 1. 09 which I think is better than Gorilla. Number of sites that we collect data from, 13. The longest time, 791 days. This is back six months ago when I give you run enough

20:16

Speaker 2: time if you're just if you're just wrapping up.

20:19

Speaker 5: Yep, sure. It's really good to do this to learn a new thing.

20:34

Speaker 6: All right. Um thanks very much. Um so my name's Amiel. I'm a software engineer at Lindis Health, and I'm gonna be oh. I'm sorry. Um I think I was using a different version of these slides. That was for something else. I was editing it. Let me just let me just do this. Oh sorry. So embarrassing. I'm so sorry. I don't stand by that. Okay, um sorry, my talk is uh version control is important because mistakes happen and it's good to know what the previous version was. So, version control is especially important for us, Lindis Health. We work in clinical trials. That means that we need to have really good traceability for all our data. If any data changes, we need to know who changed it and why and what it was before.

21:21

Speaker 6: So, the problem? I'm lazy. I don't really want to figure out how to have version control across all the objects in my Django app. Um also I'm lazy, I didn't think of any of the problems. But um thankfully there's a solution for me if I'm lazy, which is using Django Reversion. So it's uh an app that or a library that'll allow you to have version control just built in automatically. Any change is made, it's recorded. Awesome. Great. There's still a problem though. It doesn't work out of the box for data migration. So if you change data within a migration, You won't have that version history, which for us is really, really important, so it's a real problem if we don't have that version history. The solution is you can write a quick context manager that'll handle creating the reversion objects for you within the data migration.

22:07

Speaker 6: So when I say write a context manager, I mean copy a bunch of code from Django version into a context manager, because like I said, I'm kind of lazy. Um so here's what I did. Created this context manager, a migration revision, to set it up, getting a bunch of models ready. You can create a user if you don't have one, and then create this method here, save object, which will replace object. save inside migrations. Then here we have a bunch of stuff to make it work as a context manager and keep track of all the revisions that are happening within a migration. And here's what it looks like in practice. Within a migration, if I want to make a change that's recorded as part of a version, I have migration revision, as migration revision. I'm ch taking this book, I'm changing the publisher, I'm using migration revision save object instead of book.

22:54

Speaker 6: save, and then I'll have a full history of anything that happened during the migration. And that's it, very quick.

23:09

Speaker 7: Hello, yeah, so I'm David Sedden. Uh I love layers, I've loved layers for many years. Maybe you will soon in a couple of minutes. Um so I work for Kraken Technologies. We're one of the sponsors. Uh if you haven't heard of Kraken, uh we're part of Octopus Energy. Um and Can I ask anyone what the significance of this number might be? Any guesses? Shout something out. I'll give you a clue. It's related to our code base. It's the number of modules in our code base. Okay? We've got a really big code base, and it means that we've had to learn how to control complexity and to think as software architects.

23:55

Speaker 7: And that's what layers gives you. So this is a sort of picture of a kind of classic Django project. Maybe you've got a handful of apps. uh and they've got some interdependencies with them and um you know we might start with something like this uh but you know maybe maybe the app might need to know about that as well and maybe that one might need to know about that and suddenly you got this Who uh can relate to this? Has anyone got yeah basically everyone uh because this is what our software inevitably becomes like if you don't control the relationship between your modules and that's what layers is all about. So what can we do about it? We can impose constraints upon these relationships.

24:41

Speaker 7: So layers is a architectural pattern which just talks about I mean in this picture it's Django apps, but it could be anything, it could be any software component. It could be like microservices or it could be Python modules, could be anything. But the idea is you just have a list, an ordered list of different components. and the dependencies between them flow downwards. So it's like a metaphor. So at the bottom, you've got your first app that's like the foundation and then the next one sits on top of that, the next one on top of that, and so on. And the ones lower down don't know directly about the ones above them. Pretty simple idea. Just to sort of try to make this a bit more concrete. So here we've got a module called blue and that imports green.

25:27

Speaker 7: So this is all I'm talking about here with these diagrams. You know Blue 's got an arrow towards green it kind of means imports or knows about. So for Python, or particularly for a Django project Maybe this is what a layered Django project looks like. You've got a load of apps, they're all kind of siblings of each other, and the imports between them are only going to go in one direction. Now you may ask, well what happens though if the dependencies go in the other direction? What do you do about it? The answer is something called inversion of control. If you haven't come across it, uh it's a really powerful technique. It's not that hard. You're probably very used to it because you've worked with Django, and Django's got lots of inversion of control in it. But basically In this case, if we didn't want blue to know about green directly, we'd sort of do this kind of plug-in

26:14

Speaker 7: mechanism where it kind of indirectly knows about it by green plugging into it. There's some links in my blog or you can search here if you want to hear a talk about it. Finally, how do we enforce it? Linting. We've got this linter called import linter. You can install it, uh pip install import linter, and you can define a contract That describes the layers. So here we have uh three layers: blue is the top layer, green is the bottom middle layer, yellow is the bottom layer. And then if you put this in your continuous integration pipeline or whatever, um uh and then you run it, um if you if someone introduces an import from

26:59

Speaker 7: say green to blue, then it will fail And so that that can allow you to like impose these constraints, which means you keep a modular and easy to work with code base despite it gaining more and more complexity So that's what I wanted to communicate. I appreciate I've just scratched the surface, but come and talk to me more about them or have a look at my blog if you like. And I encourage you to give layers a try, even if you're working with quite small code bases. I use it for everything. Thank you.

27:34

Speaker 2: Thank you, Davis.

27:44

Speaker 8: Okay, um today I want to show you a small package I created uh a couple of weeks ago. Um and basically it's how class-based emails will save your day, at least if you work with emails and Django. Um I work at a company at M uh named Ambient, uh it's in Cologne and Okay, I'm still there. Um and uh we work with Django since 2010, so quite a while. And uh in my time I've worked for about with about 20. Um 20 uh Django applications and they always always had the same problems like um HTML and plaintext, you have like two templates, it's not dry. Uh you have global variables uh which you have to declare for every email. Uh emails weren't unit tested and it was kind of tedious. And so I created this package.

28:30

Speaker 8: Which should probab hopefully help you with this. Well, this is the Django Docs about emails, and that's more or less it. Um and it um yeah it misses a couple of things like internationalization, logging, you know you have an email template, maybe you want to have additional headers. It's all documented how to do it, but it felt a little bit uh tedious and not dry And so similar to class-based views, there are class-based emails. On the right you see an example. And it encapsulates all the low-level stuff, like from this page here. Um so you don't have to worry about it how Django actually sends D mails. Um it you don't have to have duplicated templates for the plain text and the HTML part Um it's less code, um, it's testable. I come to this in a second, and it's super easy and fast to create new emails without you know having to think about all the stuff you have in your application.

29:22

Speaker 8: And um yeah, the key features, um it's uh clean, you can you have you can create a setup, uh you have logging of internationalization, attachments. Um you have uh HTML conversion to text if you want. Uh you can customize everything like with Django views, um like via inheritance and there's more stuff referred to the docs. I actually wrote docs for this, so Um and uh yeah about unit testing. Um if you have ever worked with the Django uh test mailbox object, it's kind of hard to work with this. Um so I built a wrapper, it's part of this package, which basically um You can work with the outbox like a Django Clary set. So if you want to see, hey, does my test send emails? Is the email with the subject

30:08

Speaker 8: Like this, you can basically do a filter or you can uh you can make assertions, you can make an assert for both parts, for the HTML part, and uh the plaintext part, and all the stuff you know from the ORM And in the case if you're wondering why it's called Pony Express, um there was an uh pony-based mailing service in the US. And um yeah, as you know, the pony is a jungle musket, so it's an ingenious name, right? And uh yeah, feel free to try it out and thanks for listening.

30:38

Speaker 2: Thank you, Brody. Thank you.

30:48

Speaker 5: So um I think some of you are probably familiar with this game Pokemon Go where people Take the smartphone and go outside looking for virtual uh creatures and animals. Um I think that if you really want to go out with your smartphone, I have a better suggestion. uh which is use something like iNaturalist which is a citizen science project where basically you will looking for real creatures real animals plants mushrooms uh whatever um There are important in the in this kind of data, this kind of BC data, you have three important things. What is there, where is it, and when when uh is it observed You can have more things like the live stage, who observed the anonymity, things like that, but really the what, when

31:38

Speaker 5: and where are the three main questions So if you go to iNaturalist. org, you have a website. You can explore kind of data and previous observations by other people on a lot of different angles, like all the observations in Edinburgh uh species I observed myself, details about a given uh species of um of ladybird, those kind of things. What is interesting

32:04

Speaker 8: and the better way to use it I think is to use a mobile app which exists for Android and iOS.

32:10

Speaker 6: Because if you remember those true three important points, what, where and when, it's quite easy to capture good data with a smartphone because your phone perfectly knows where you are It knows what time is it, and you have some source like the camera that allows you to take pictures and prove that the the organism or the plant in that case that you observed. um has been uh has been really there. Um

32:39

Speaker 5: I'd say that the when and where

32:42

Speaker 6: questions are quite easy. The what is much more um touchy and difficult because people uh have opinions.

32:50

Speaker 5: Sometimes it's really difficult to distinguish species, so I

32:53

Speaker 6: naturalist has a mechanism for that. Uh when you add your s your observation you can say what you have seen. Sometimes it will be something generic, sometimes it will be something very detailed because you you know your your topic

33:05

Speaker 5: you will have to to upload some proof generate a picture and then the community can uh can refine and can discuss and you can have those kind of exchanges and people after a few exchanges generally where you have specialists chiming in and you have um you agree to some uh community identification Uh the benefits to do that, uh I think the first one for me, I think that's really something fun. You can

33:31

Speaker 8: become curious, you explore your surroundings, you learn a lot about uh about the species you observe because you will want to say, oh this is that kind of ladybird and not that kind. You will have to spend time on Wikipedia or other sources to

33:45

Speaker 7: to really learn things and the more you learn the more you you're interested in nature the more you respect it so it's something really really fun uh the data is really useful in the real world because once

33:56

Speaker 8: It attains some some quality and is

33:59

Speaker 5: considered research grade by iNaturalist and is published to a big data aggregator, which is called GBIF.

34:07

Speaker 6: And then there it's it's used uh basically by by everybody uh that needs uh biodiversity data for for research.

34:14

Speaker 7: You can see here the the the the

34:17

Speaker 6: INERALIS data set on GBIF because JBIF is an aggregator and has data from many sources and there are currently six sixty two million uh observations and it is used in 3,600 scientific publications that are referring to this data for this research. Yeah, and there is there is more to that of course. Sometimes people uh gather together and have a big event called uh Bayoblitz where you go to a place at a given time and everybody is looking uh with a phone in a situation like that for for um to really have a good uh a good cartography of what happens there. Uh there is a huge community on iNaturalist with uh no With discussion forums, people are

35:03

Speaker 6: developing and customizing cameras to to take pictures of very specific things like bacteria. And of course, since we uh it's a community of developers here, uh iNaturalist can be also accessed via APIs, Python packages are available

35:19

Speaker 5: and many many more things to to have fun use at. Yeah, and I'm not affiliated with them. I'm just a fan, so I wanted to share. Thank you

35:39

Speaker 7: Thank you for the foot stomping. Uh is it here? Cool. Hi, my name's Colm. I'm a Python developer. I'm the author of a library, Python library called Strict YAML.

35:50

Speaker 8: I made it because YAML is kind of nice to look at, but it can be painful to edit. And I wrote this library strict YAML, so it's nice to look at and it's also nice to edit. So I'm not here to talk about that. Let's build a feature in a Django to do app. So we start off with specification. Given that I'm logged in, when I want to add buy bread to my to-do list, and then I should see buy bread on the to-do list. Very, very simple. Don't really need docs for this, but you know, I can't do anything more complicated without having going over on the talk. So let's build the app. Um with the app, we've got a Django app where we log in. This is a Django app. You log in and then you add to do you add Bibread to the to-do list and then it appears on the to-do list. All very simple. What's the next thing you do? Well, then you write a test.

36:36

Speaker 8: Who here's used playwright Cool. Quite a number of you. So this is a playwright test. So you start off by loading the um

36:44

Speaker 3: the web page and then you fill in uh admin password login adbread and then at the end you you do arrange as act assert the normal testing pattern and then at the end you check to see that the thing you added at the bottom is there. So that's one test you could write. Now comes the tedious part. You have to write the how-to docs So I find the great um uh Daniela

37:07

Speaker 8: 's uh DiaTex uh documentation framework is great. This this is like how I fit all of my docs into um uh for any app I write, for any project I write. This one fits into the how -to guide. So we're gonna have a how to uh add an item to my to-do list And um I think I've got the docs here. This is the kind of docs we want. So when you enter text admin non-usname, login, then you see this login thing that's and then you enter text Add bread and then you should see our bread appearing down here. All very simple and quite common and worked with a lot of people who've written lovely dogs like that for me.

37:46

Speaker 3: This is where we get to the point where if you write this, you have the three stages of documentation grief. One, anger. They're only gonna go out of date anyway. Two, bargaining. Maybe I can get ChatGPT to write it. You can't. Three, acceptance. Either screw riding with

38:04

Speaker 6: docs, I'm not gonna do it, or fine, I will do it, and I will get really bored But what if you could write a specification once and you got your specification, you got your test, and you got your docs? You'd have to um write your docs not in like Python. You'd have to write your tests not in Python. You'd have to write your specification not in Python. You'd have to it in something else. So I propose Strict YAML. So this is an example equivalent to the Python test I showed you over on. So we've got a little description at the top We got a um given the story is based on logging in here, based on. And then you have a series of steps following that, like I entered.

38:46

Speaker 8: the text in the to-do text, add bread, click add, and then it should appear, add bread. It should say the first one at the bottom but it's cut off. And then you add some um

38:58

Speaker 3: step, some code for these steps, so you can execute these steps. These are the ones from from this particular test. And um The first one loads the website and the second one it enters the text. It's all very simple stuff. But this is the the you also you always need some code to execute your tests. And then the third the third part is you need something to take this and then to generate the docs.

39:21

Speaker 8: So this is Ginger2. So you have this Ginger2

39:25

Speaker 3: which writes out the docs that I showed you earlier When the website's loaded, show an image from screenshot from the test that was generated from Playwright. Enter text using the text from the YAML doc. Click on the item referenced in the YAML doc. This means you can like rewrite uh your code and you can run make changes to your test and then

39:53

Speaker 6: once you write a t run a test You will get docs out the other side. Right, right. Waiting for a fake test to run. And here we've got some nice docs of a little video of it at the top and the changes that I've made in the test and the screenshots you see include this change.

40:20

Speaker 8: This is what I call triality. You can do test-driven development with a spec. It means you can do once you've written the feature, it's already documented, and it means that docs are up to date by definition. Thank you.

40:46

Speaker 3: Yeah, until

40:47

Speaker 7: uh a couple of minutes ago the first sentence in here was asked uh Mark to come up on the stage and lay on the back next to me. It's not in here anymore for the reason he just mentioned. So for about a year and a half now I've uh started volunteering uh in the disaster relief unit in Germany. and also doing a bit of medical and civilian protection. And as part of my involvement there, I went just recently went through a 12-day

41:13

Speaker 8: medical

41:15

Speaker 7: first aid training. And that included similar to what Toby mentioned this morning, a lot of repetition, a lot of practice to actually do things. So something that I figured might actually help some of you. I don't know who of you may have gone through a first aid calls at some point, maybe doing um getting a driver's license, which is something you need to do in Germany,

41:40

Speaker 8: going through a first aid course there.

41:42

Speaker 7: And yeah, so I figured I'll give you a bit of basics in general first aid. When you see a person laying somewhere or lying somewhere and you have no clue if they are still alive, well, how do you know if they are conscious

41:58

Speaker 6: Well, you take a look at them and then you get a very good first impression. Are they pale? Are they blue? Are they just

42:04

Speaker 8: is the face just completely sweat wet? Or are

42:09

Speaker 6: they

42:09

Speaker 8: is the

42:10

Speaker 7: the skin wrinkly dry? These are indications for medical professionals which they can then derive more information from. then you talk to address them, talk to them. Hey, are you awake? Are you can

42:25

Speaker 6: I can you talk to me? And if they don't, you start to gently grab them by the shoulders and like

42:31

Speaker 7: shake them a bit. Um like not heavily, don't smash their hat

42:36

Speaker 3: on the ground. That's not gonna be helpful. But just try to wake them up. If they wake up, good, great, they're awake, they're conscious. Check if they're alright, but go on your merry way. If they're not, if they don't respond, there's essentially one thing you need to check now. Are they still breathing? And there's essence essentially three things you need to do in that regard. First of all, in order for you to uh to breathe, your airways, so

43:05

Speaker 6: mouth and

43:06

Speaker 7: throat, need to be empty, need to be free. You do that by well just opening their mouth and see if there's something in there. If there's not, great. If there is, try taking it out

43:19

Speaker 6: If it's empty, then you need to make sure that they can actually breathe and there's nothing blocking somewhere down in their throat that you can't see. And a practice or a trial for all of you, when you keep your head at a neutral position, you can breathe and you can swallow. Now

43:35

Speaker 7: if you recline your head all the way, try swallowing. You can't. You can't really anyway. And that's the thing you need um and the

43:49

Speaker 6: human or the the way the body is built to prevent you from choking

43:54

Speaker 8: on vomit or anything that may come from your stomach.

43:58

Speaker 7: So in order for the person to keep breathing, you need to recline the head all the way, which is further than you think it might be So you recline the head and then you listen for breath. Two to three breaths within ten

44:16

Speaker 6: seconds. If you hear them, if you can feel them on your on your cheese uh chests, uh on your on your cheeks

44:22

Speaker 7: Great if you can't

44:24

Speaker 8: consider

44:24

Speaker 3: they are not breathing anymore, which means you need to perform CPR. CPR is um a process of you pushing their chest such that you make the blood flow through their body But before you start pushing somehow, yell for help because you will need that. It's exhausting. Trust me, we've done that for 20 minutes in the morning to wake up. A couple of times. Then get out your phone or get the other person or other persons who are there, get have them get out the phone and call for emergency services. That's one one two in most of Europe. That's triple nine in the UK if I'm not uh not wrong.

45:10

Speaker 3: It's nine eleven in the States. But honestly, in most countries, you can pi pretty much pick any of those r three numbers and it's probably just gonna work.

45:19

Speaker 8: But

45:19

Speaker 7: still like it's probably better to j remember those numbers. Um also on Android if you pa um push the power button on your phone several times and you enable the feature, it's just gonna call the emergency services

45:32

Speaker 6: So

45:32

Speaker 7: I'm sure and um Apple has a similar feature. Um enable that

45:37

Speaker 6: it can help quite a lot. So put the phone on speaker next to you if you're alone.

45:42

Speaker 8: And then the next thing is that you need to find the person's center of the chest, which is about

45:47

Speaker 3: here, and you start pushing. Stretch your arms and push. Like in many movies you see people like pushing like this. That's not gonna work. You need to push with your hole upper body because the chest is fairly strong and you will need to push five six centimeters

46:10

Speaker 7: or third of the chest of the person's chest in order for the resuscitation to actually work At 120 beats per minute, so twice a second. There's plenty of YouTube videos with um suggestions for songs that you can thing in your head like staying alive staying alive um yeah and you don't stop ever

46:34

Speaker 6: if you need if you're starting to get exhausted

46:36

Speaker 7: switch with with another person have

46:39

Speaker 8: them come to the other side, count down from five

46:41

Speaker 7: five, four, three, two, one and have them take over. You try to not stop for more than ten seconds because then you start building up the pressure in the blood vessels All from scratch. Which is also while from the American Heart Associate Association, you wouldn't do s um like mouth-to-mouth breathing anymore

47:04

Speaker 8: Um that essentially means all the blood pressure drops again.

47:09

Speaker 7: And then if you're not alone, have somebody get an AED because that can be also life-saving. Now they are alive or they they still breathe and that's where Mark would have been my useful dummy here where he would have uh put somebody in the recovery position

47:28

Speaker 6: There's essentially two positions. Um

47:30

Speaker 7: the old one, which people um probably learned years ago. Um

47:36

Speaker 3: it's fine, it's slightly more stable when when a person lays on the floor, but it's Bit more complex to do. The new one is frankly much easier for somebody who doesn't do it regularly and doesn't practice it regularly. And it also works Fairly regardless of the weight of the other person. So as a explicit like contrast example, even a very thin small curtain can flip over a person which is like four times their weight just because the angle of the the leg that you see in the la in the third um picture is a lever that's just Let's them fairly easily flip their entire body onto the side. Once you flip the person onto the side, remember what you had about breathing.

48:26

Speaker 3: S recline their neck and check for breathing once a minute.

48:31

Speaker 8: As long as they keep breathing, great. And you I hope you now call 911 or the appropriate number and have EMT Take over at some point, but keep checking for their breathing. If they don't, flip them back CPR back where we just were

Questions this talk answers

What is research software engineering?

Research software engineering combines research with professional software engineering. It aims to improve the quality, sustainability, and impact of software developed for research, and has grown into a worldwide movement with dedicated university groups.

Discussed at 1:41

Why does Imperial’s research software engineering team use Django?

Django is the team’s standard framework for web work, giving people—including those new to web development—one familiar approach with built-in security, conventions, guardrails, tutorials, and open-source support.

Discussed at 5:03

How can salsa dancing be represented as a finite state machine?

The follower’s line creates three possible leader positions: basic, cross, and reverse cross. Each dance move is one of the nine possible transitions between those states, including staying in the same state.

Discussed at 6:42

How can a finite state machine help someone improve their salsa dancing?

Counting transitions can reveal bottlenecks where there are too few moves, so dancers can learn more options. They can also replace repeated moves with alternatives from the same transition.

Discussed at 9:50

What is PyCamp?

PyCamp is a multi-day collaborative coding retreat, similar to conference sprints but much larger: participants live together, share meals and space, propose and vote on projects, and work on whatever interests them.

Discussed at 10:45

Why is time-series data difficult to store efficiently?

It may contain rapidly arriving measurements from many sources, each with timestamps and values that need to be catalogued without throwing data away. Timestamps and numeric values can consume substantial space, even though the data often has useful regularities such as fixed intervals and slowly changing values.

Discussed at 14:57

How can time-series data be compressed?

The talk describes storing timestamps in binary, scaling values into integers, then applying delta or double-delta encoding, run-length encoding, and variable-length binary encoding. These techniques exploit the fact that adjacent measurements and timestamps are usually closely related.

Discussed at 18:02

How can Django Reversion track changes made in data migrations?

Django Reversion does not automatically record changes made inside data migrations, so the speaker uses a custom context manager. The migration wraps its changes in that context and calls a replacement for `save()` that creates the needed revision history.

Discussed at 22:07

What is the layers pattern for Django projects?

Layers arrange applications or modules in an ordered stack, with dependencies flowing downward from higher layers to lower ones. Lower-level components do not directly depend on components above them, which helps control complexity and preserve modularity.

Discussed at 24:41

How do you enforce architectural layers in a Python or Django codebase?

Define the permitted layer relationships as an Import Linter contract and run it in continuous integration. An import that violates the direction of dependency then causes the check to fail.

Discussed at 26:14

What problems do class-based emails solve in Django?

They encapsulate email-sending details, avoid duplicated HTML and plain-text templates, and make emails easier to create, customize, log, internationalize, and attach files to. They also make email code easier to test.

Discussed at 28:30

How can Django emails be tested with Pony Express?

The package wraps Django’s test mailbox so the outbox can be queried like a Django QuerySet. Tests can filter messages and assert their subject, HTML body, and plain-text body.

Discussed at 30:08

What information is most important when recording a nature observation in iNaturalist?

The three key pieces are what was observed, where it was observed, and when. A smartphone can capture the location and time automatically, while a photograph provides evidence of the organism.

Discussed at 30:50

How does iNaturalist identify a species when the observer is unsure?

The observer submits a description and photographic evidence, after which the community can refine and discuss the identification. Specialists may contribute until the community agrees on an identification.

Discussed at 32:53

How can one specification generate tests and documentation?

The speaker proposes writing the behavior once in Strict YAML, including the steps and their implementation. Playwright executes those steps as a test, while a Jinja2 template generates the corresponding how-to documentation and screenshots.

Discussed at 36:10

What is the benefit of generating documentation from end-to-end tests?

The documentation is updated whenever the test or specification changes, so it stays aligned with the implemented behavior by definition. This combines the specification, automated test, and documentation into what the speaker calls “triality.”

Discussed at 38:40

How do you check whether an unconscious person is responsive?

Look at them for signs of their condition, speak to them, and gently shake their shoulders. If they respond, check that they are all right; if they do not, check whether they are breathing.

Discussed at 41:42

How do you check whether an unresponsive person is breathing?

Clear the mouth if necessary, tilt the head back to open the airway, and listen and feel for two or three breaths within ten seconds. If there are no signs of breathing, treat the person as not breathing and begin the emergency response.

Discussed at 43:24

What should you do if an unresponsive person is not breathing?

Call for help, contact emergency services, and begin CPR, which uses chest compressions to circulate blood. The talk gives 112 for much of Europe, 999 in the UK, and 911 in the United States.

Discussed at 44:24

Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.

More videos by Alex Gomez Martin, Amiel Kollek, Can Bolukbas, Chris Cave Ayeland, Colm O'Connor, David Seddon, Kio Smallwood, Markus Holtermann, Nicholas Noe and Ronny Vedrilla

More videos from DjangoCon Europe