JuliaCon 2023

Building a web API for dispersion modeling with Genie.jl
2023-07-26 , 32-124

For the real-time online risk assessment in case of hazardous material release into the atmosphere, Genie.jl has been used to build a web service to run atmospheric dispersion models upon client requests that follow the OpenApi specification. Typical issues related to web API development have been addressed (authentication, DB management, server-to-client communication...). Moreover, multiple Julia packages for running dispersion models and operating on geospatial data have been developed.


An atmospheric transport and dispersion modeling framework for the online impact assessment of CBRN-type incidents (Chemical, Biological, Radiological and Nuclear) is currently being developed by the Royal Military Academy of Belgium and is hosted on the European Weather Cloud system. The backend of the framework is entirely written with Julia and uses Genie.jl to serve a REST API following the OpenApi specification (OAS). The goal of this presentation is twofold:

  • describing how Genie.jl has been set up along with OAS to provide authentication, API testing, DB management, server-to-client communication and routing logics,
  • showing the modeling ecosystem that has been built in Julia to support the framework.

Genie.jl is a comprehensive framework for building full-stack web applications in Julia. Due to the complexity of this modeling framework, the computing and data management parts are decoupled from the frontend GUI, and Genie.jl is used to set up a server listening to specific routes defined and documented following the OpenApi specification. It uses SwaggerUI.jl to render a user-friendly version of the API documentation. A JSON Web Token authentication standard has been implemented to authenticate the client requests to the API, and relies on JSONWebTokens.jl. Database management and interaction are handled by the ORM layer of Genie SearchLight.jl.

Besides the web development-related part of the project, various new packages for atmospheric transport and dispersion modeling have been developed, along with utility packages for geospatial computing:

  • ATP45.jl is a Julia implementation of a simple military prediction procedure in case of CBRN-type incidents
  • Flexpart.jl is a Julia interface to the FLEXPART Lagrangian dispersion model. It provides the FLEXPART executable in the Julia ecosystem with BinaryBuilder.jl.
  • GaussianDispersion.jl is a Julia implementation of Gaussian dispersion models.
  • EcRequests.jl interfaces the ECMWF services to retrieve weather forecast data.
  • GRIBDatasets.jl provides a high-level interface to read GRIB encoded files, a widely used data format for storing meteorological fields. It has been integrated as a source for Rasters.jl, giving a powerful way of operating on this data format in Julia.

These packages will be briefly described and some typical usage examples will be shown.

Tristan Carion is a PhD student at the mechanical department of the Royal Military School in Belgium and Gent University. He's working on uncertainty quantification for atmospheric dispersion modelling using ensemble forecasts and sensitivity analysis. He's also using Julia and Typescript to develop a Web-based application running in the European Weather Cloud, that provides atmospheric dispersion modelling capabilities with fast access to ECMWF forecasts.