Category Archives: Software

Creating extendable Web Application with Pyramid, PCA and Jinja2

Pyramid is a great framework for developing web applications that also supports the development of “Extensible” and “Pluggable” ones based on certain rules. However, there is no much documentation on how to create such type of applications.

CKAN is an excellent example of a web application that can be extended or modified using plugins. It relies on PyUtilib Component Architecture (PCA) to declare a series of interfaces and extension points that then are used by plugins to hook in. It also implements a series of Jinja2 extension (notably CKAN_EXTENDS) that allows easily template inheritance between CKAN and connected plugins.

CKAN however is developed using Pylons which is now superseded by Pyramid and coupled to its complexity makes it difficult to grasp how to apply such extensibility to Pyramid web applications.

I took the time to look into the CKAN code, the PCA documentation and Jinja2 and I came with an example that applies a modified version of CKAN extensible system to a simple Pyramid application. It can be used as a starter to develop more complex extendable web applications. The example (pcaexample) is based on a “pyramid-cookiecutter-alchemy” Cookiecutter. The code also includes an example of a plugin that is based on a “pyramid-cookiecutter-starter”. It uses Pyramid 1.8.3 with PyUtilib 5.4.1.

You can get the code here.

Cheers,

Carlos

Making one Qt5 application to connect to both MySQL server and embedded

QT5 usually builds with a MySQL driver that connect to a server. The documentation also provides information on how to achieve an embedded connection however, there is no much information on how to have a Qt application using both the embedded and server connection. The example below show how to achieve it:

MySQL Dual Connection (Embedded / Server) with QT5

Cheers,

QLands

Exporting Formhub data to JSON files

Few weeks ago we installed FormHub in one of our servers at ILRI. Formhub is an online system for aggregating ODK data coming from mobile devices. The data is stored in a Mongo Database. Although Formhub provides exporting features to CSV and Excel it does not provide exporting to more interoperable formats like JSON.

I created a small Python program that connects to a Formhub database and extracts survey data into a directory using the Survey ID as filter. Each data submission is exported as a JSON file using the UUID as file name.

You can get it from here

The long-awaited post and ODK Viewer

I have been programming software for the past 18 years, had a web-server for the past 10, it is until now that I started a blog about programming and it took me ages to decide on my first post. Quite ridiculous!

Nevertheless I think I can share one of the latest tools I have been working on.

ODK Viewer is a tool for Android devices to visualize ODK (Open Data Kit) data in tabular form. It allows loading, visualizing and editing ODK XML data.

You can grab the code and the APK @ https://github.com/ilri/odkviewer