Screenshot of GI Genius from Medtronic.com.

Last month, the FDA announced its first ever authorization of a machine learning tool for automatically detecting polyps from colonoscopy images.

The authorization went to a company named Cosmo Artificial Intelligence, for a product named GI Genius. The product will now be marketed by Medtronic.

In the realm of “AI that makes it real cancer patients”, I would classify this as a big and important milestone.

To make sense of this FDA authorization, consider first that the colonoscopy is an extremely effective procedure for detecting and preventing colorectal cancer. In a normal colonoscopy, a doctor examines the colon via a…


When I started my current job, it was literally just me. N of 1.

Five years later, there are 30 of us. Not huge, but fairly large for a “quasi-academic” group.

To go from 1 to 30 has been a huge adjustment for me, but also for everyone else in the group as well. When we were ~10 people, I was still into most of the details of our work. But, somewhere >15, it all got to be too much. Recognizing that I needed help, I set out on my own course of self-study. I read lots of management books…


Photo by Jenny Hill on Unsplash

FastAPI is a flexible, fast, and easy to learn Python library for creating API endpoints.

Here, I show you how to get up and running with FastAPI in under 5 minutes.

First, make sure you are using Python 3.6+ and install FastAPI via pip:

pip3 install fastapi[all]

You are now ready to create your first endpoint.

As a concrete, but simple example, let’s build an API for a bare-bones Slack clone. It will have four API endpoints:

  • get_status: returns the system status;
  • get_channels: returns a list of channels;
  • post_message: stores a new message; and
  • get_messages: returns a list of messages…

In my previous post, I discussed “serverless” options for deploying FastAPI applications.

The real promise of serverless or “functions as a service (FaaS)” platforms is that they automatically scale based on demand.

But, how can you verify that your FaaS is actually scaling to meet demand? And, do we see real performance gains when using a FaaS platform?

As with my previous post on MongoDB performance options, I think it’s best to verify such questions empirically. We just need a controlled experiment!

For this week’s controlled experiment, I stuck with Microsoft Azure Functions, and I stuck with the bare bones…


Photo by Alex Machado on Unsplash

“Serverless” is not my favorite term.

It implies the complete absence of servers. But of course, serverless actually involves many servers. It’s just that you don’t have to manage these servers yourself, and they are deployed transparently in the background.

I personally prefer the term “functions as a service (FaaS)”. Not as catchy as serverless, but let’s unpack this a bit and consider how it applies to APIs.

First off, APIs are an excellent use case for serverless, as they are usually stateless functions that respond to events. …


When it comes to Python, MongoDB and FastAPI, you have two main options: PyMongo, the official Python driver for MongoDB, or Motor, the asynchronous Python driver for MongoDB.

But, what’s the most performant way to use these libraries, and does Motor provide better performance than PyMongo? This blog post attempts to answer these questions with benchmarking.

The Options

First up, let’s consider three options for connecting to MongoDB:

Option 1: Use PyMongo and create a new MongoClient for each new request.

  • Option 2: Use PyMongo, but this time create a single MongoClient and re-use it for all requests.
  • Option 3: Use Motor…


Photo by NASA on Unsplash

In this latest installment of FastAPI tutorials, we will focus on integrating FastAPI with a MongoDB database backend.

MongoDB is a document oriented NoSQL database that stores JSON documents. As both MongoDB and FastAPI work natively with JSON, they make a good pair.

Getting Started with MongoDB

To get started, you first need to install the community edition of MongoDB. MongoDB provides complete instructions for all platforms, including Mac OS X, Windows and Linux. Next, it helps to familiarize yourself with the Mongo Shell. You should know enough of the basics to use the Mongo Shell for creating new records and then retrieving them.


Photo by Jelleke Vanooteghem on Unsplash

In the next installment of my quick tutorials for learning FastAPI, let’s examine the basics of deploying a FastAPI application to Heroku. Full disclosure, I have no affiliation with Heroku. I just find their Python app deployment extremely simple.

Our goal is to deploy the bare bones Slack clone discussed previously. As you may recall, this API enables you to store and view messages by channel. It’s also intentionally simple, uses an in-memory data structure, and does not connect to a real database. This makes for much simpler code, so we can focus on the FastAPI parts. …


Once you understand the basics of FastAPI (see previous posts 1 and 2), the next step is to consider adding automated tests for your API endpoints.

Fortunately, you can do so via pytest and a TestClient class derived from Starlette.

To get started, let’s consider a bare bones API that returns fruit information. Here is the complete code:

Here I have created a fake database with just three fruit, and a single fruit/id endpoint.

Let’s assume that this API is located in the api package, and we run it like so:

uvicorn api.fruit:app — reload

You can then try…


Photo by Tomáš Malík on Unsplash

FastAPI is an incredibly flexible Python library for creating API endpoints. It is also extremely easy to learn.

Previously, we looked at the very basics of FastAPI, and I introduced an API for a bare-bones Slack clone.

Our API has just four endpoints:

  • get_status: returns the system status;
  • get_channels: returns a list of channels;
  • post_message: stores a new message; and
  • get_messages: returns a list of messages for a specified channel.

Previously, we created the status endpoint, which is just about the simplest endpoint you can create.

Let’s now go up one level in complexity and create the remaining endpoints. …

Ethan Cerami

Director, Knowledge Systems Group @ Dana-Farber Cancer Institute, Boston MA.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store