Skip to content

Backend Python Modules

OSM Login Python

A way to consistently implement OSM login (via underlying OAuth2) in our applications.

TM Extractor

The TM Extractor script is designed to trigger extraction requests for Tasking Manager projects.

OSM Raw Data

OMS Raw Data supports the creation of data extracts into GeoJson or a Postgres database. There is more detail on these modules on the project website).

PostgresClient()

This program extracts data from a local postgres data, or via a remote database. A boundary polygon is used to define the area to be covered in the extract.

MapImporter()

Imports data into a postgres database that is using the raw-data-api schema. This currently supports three input formats, Geojson, all OSM formats, and Parquet files from Overture.

QueryConfig()

This reads a config file in YAML format that describes the database query. This is used to generate the queries for the different database sources.

Overture()

Parses Overture Parquet files and creates a data structure of the data so it can be imported into postgres, or generate an output GeoJson file.


OSM Fieldwork

Various utility programs useful for field data collection using ODK Collect. These modules are used extensively in FMTM for all the backend data processing.

There is more detail on these modules on the project website).

BaseMapper()

This makes basemaps of satellite imagery for ODK Collect and OsmAnd.

CSVDump()

Converts the CSV files downloaded from ODK Central into OSM XML and GeoJson so they can be edited in JOSM or QGIS.

JsonDump()

Converts the JSON files downloaded from ODK Central into OSM XML and GeoJson so they can be edited in JOSM or QGIS.

FilterData()

This scans an XLSForm, and removes all features from the data extract that are not in the choices sheet. This is required to use the data extract in ODK Collect.

MakeExtract()

For ODK Collect, this makes the filtered data extract using osm-rawdata and FilterData().

OdkCentral()

This supports working with the REST API for ODK Central.

OsmFile()

Produces OSM XML out files.


FMTMSplitter

A splitting algorithm using PostGIS to divide an idea into task areas, factoring in prominent map features (roads, rivers, etc).

The division is configurable via various parameters.

fAIr Utilities

Various machine learning utils used within the fAIr backend.


Conflator

This is a project for conflating external data sets with OpenStreetMap data.

There is more detail on these modules on the project website

ConflateBuildings()

Conflate buildings from external datasets like the Microsoft or Google building footprints.

ConflatePOI()

Conflate POIs from external datasets like ODK Collect.


TM Admin

This is a project for profile management of Tasking Manager style projects.

TmAdminManage

This class and utility program handles creating the data type files, and the database tables. It also support migration as the database schema changes.

DBSupport

Base class for database functions, used by the generated wrapper classes.

Generator

This class reads in the YAML config file for a database table, and generates the protobuf files, SQL files, and Python class.

ProtoBuf

Used by generator for protobuf specific file creation.

Wrapper Classes

These wrapper classes are generated from the YAML config file, and contain all the columns from the database table as a Python class. This is used to create, update, and query the database tables.

  • UsersDB()
  • TeamsDB()
  • ProjectsDB()
  • TasksDB()
  • OrganizationsDB()