My Summer Internship and Writing My First Django App
My Summer Position
This summer, I’m doing a research internship in sunny Singapore. In particular, I’m working at the Institute of High Performance Computing (IHPC), a research institute under the parent company that is the Agency for Science, Technology and Research, known as A*STAR.
To many who are probably unfamiliar, A*STAR “is Singapore’s lead public sector agency that spearheads economic-oriented research to advance scientific discovery and develop innovative technology”. It’s a pretty cool environment, and I am working on some machine learning projects with my supervisor.
As an AI Research Intern, the projects in which I’m involved are mostly about automating patient diagnosis through Machine Learning and Computer Vision.
My First Django Web App
My first task this summer was to create a ‘proof-of-concept’ web application that would demonstrate to hospitals the use of a lung cancer identification algorithm our team developed. This algorithm is a neural net that takes in a set of DICOM images. A dicom image (Digital Imaging and Communications in Medicine) is the standard output format for X-Ray and CAT scans. An image is 2-D slice, and a set of images from a CAT scan gives a 3-D rendering of, say, a lung. Our algorithm then spits out the xyz-coordinates of where the cancerous tumors might be located in said lung.
Tumor identification is traditionally done by the human eye, so it is hoped that our program can automate the process. What’s needed now is a web-based platform to serve our program to the customers. That is my job to build.
To my delight, there already exists an open-source medical image viewer in JavaScript lying around on GitHub. We fondly call it the Papaya Viewer. No need to reinvent the wheel then!
With a good overview of the problem, I could zoom in on the specifications. I need to develop a web-application that:
- Lets the user upload a set of dicom files
- Runs our cancer-identification program server-side
- Displays the dicom images with Papaya, with additional buttons that let the user zoom in onto regions identified by our detection algorithm.
My web development being experience close to naught (this was before I built this website), I got to work looking up possible tools I could use. I knew it had to be dynamic application, so my choices included Ruby on Rails and Django. Since I fell in love with the sheer awesomeness of Python last semester writing OS projects (synchronization & network programming), I went with Django. (I might do a future post about why I think Python is great, and why it replaced Java as my language of choice)
The amazing quality of Django’s documentation got me up to speed quickly, and a day of tutorials and fiddling later, I was quickly building my first web application.
I’d show you how beautiful it looks, but in reality though, it’s a proof-of-concept, and minimally viable demo, so we’re wasting no time dressing it up. It’s only crucial that it works. Which it wonderfully does.
My Takeaways
But most important to me personally, is that I learned the process of creating and deploying a web application, such as url management, utilizing modularity in HTML templates, and how MVC is applied in web development.
I also learned what a framework like Django was about. It’s like the inverse of an API, where instead of you calling the the API, the framework calls your code (see Inversion of Control). It’s an MVC pattern with the C already in place, and you only worry about the M and the V; a chef-for-hire where where you just provide the ingredients. It is awesome.
Django does seem a bit of an overkill for the present state of my application. After all, my site has only two pages, one for uploading, and one for viewing, which sounds like a couple of HTML and static files.
However, Django is made to be flexible and extensible. If I get the chance to return to this project, potential new features I want to add include a database to store patient data, visible to each authenticated user. And for that, Django is perfect.
Leave a comment