Last month, the FDA announced its first ever authorization of a machine learning tool for automatically detecting polyps from colonoscopy images.
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…
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:
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…
“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. …
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.
First up, let’s consider three options for connecting to MongoDB:
Option 1: Use PyMongo and create a new MongoClient for each new request.
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.
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.
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. …
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
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:
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. …
Director, Knowledge Systems Group @ Dana-Farber Cancer Institute, Boston MA.