How dhis2-chap/chap-core works
Project type and purpose
• This repository is the “Chap modelling platform,” a Python-based modeling framework with:
• A core library (chap_core/) implementing data ingestion, preprocessing, forecasting, evaluation and simulation.
• Multiple adapters (CLI, REST API, GluonTS, R, Python external models).
• A RESTful service layer with asynchronous task processing (Celery/RQ).
• Docker-based deployment and orchestration via docker-compose.
• It’s primarily a backend modeling toolkit and service platform, not a UI-driven full-stack app.
File structure
• Top-level directories/files:
• chap_core/: business logic, adapters, services, database, models, runners, simulation, testing utilities.
• rest_api_src/: the FastAPI (or similar) service, Celery tasks, routers, data models.
• external_models/: examples of containerized or scripted models in R, Python, Stan, MLflow.
• scripts/: utility and tutorial scripts showing common workflows (data cleaning, evaluation, prediction).
• compose*.yml, Dockerfile*: container definitions for API, workers, integration tests.
• tests/: unit, integration, end-to-end tests for every component.
• Architectural cues:
• A hexagonal/clean architecture—core logic decoupled from transport via “adaptors.”
• Asynchronous worker pattern (Celery/RQ) for long-running tasks.
• Pluggable external model interfaces (via MLproject, Docker, Python/R wrappers).
• Persistent storage via a relational database and local cache layers.
README for insights
• Confirms it’s a modeling platform with documentation site and GitHub workflows for building images, testing, publishing.
• Mentions CLI (chap-cli), API, external models, and developer documentation.
Detail
• Every layer from client entry point, through adapters, core modules, DB/cache, to external services.
• Don’t omit auxiliary components like local cache manager, logging, and Docker helper functions—they clarify operational concerns.