-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation/15 07 26/sphinx and uml #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0a8800f
adding the initial role in of sphinx documentation
MJC598 8c518aa
bump to respond v2.5.0, updating some docs
MJC598 8a09845
converting from reST to numpy docs
MJC598 0de39ff
initial push of architecture docs
MJC598 8d432f2
reversing for compile
MJC598 9aba7bd
stop trying to check doc coverage
MJC598 b43eba0
temporary fix for integration testing so coverage passes
MJC598 d342f56
Update docs/source/index.rst
MJC598 a5e9192
Addressing PR comments
MJC598 ab5abe3
Update docs/source/index.rst
MJC598 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Minimal makefile for Sphinx documentation | ||
| # | ||
|
|
||
| # You can set these variables from the command line, and also | ||
| # from the environment for the first two. | ||
| SPHINXOPTS ?= | ||
| SPHINXBUILD ?= sphinx-build | ||
| SOURCEDIR = source | ||
| BUILDDIR = build | ||
|
|
||
| # Put it first so that "make" without argument is like "make help". | ||
| help: | ||
| @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
|
||
| .PHONY: help Makefile | ||
|
|
||
| # Catch-all target: route all unknown targets to Sphinx using the new | ||
| # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
| %: Makefile | ||
| @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| @ECHO OFF | ||
|
|
||
| pushd %~dp0 | ||
|
|
||
| REM Command file for Sphinx documentation | ||
|
|
||
| if "%SPHINXBUILD%" == "" ( | ||
| set SPHINXBUILD=sphinx-build | ||
| ) | ||
| set SOURCEDIR=source | ||
| set BUILDDIR=build | ||
|
|
||
| %SPHINXBUILD% >NUL 2>NUL | ||
| if errorlevel 9009 ( | ||
| echo. | ||
| echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
| echo.installed, then set the SPHINXBUILD environment variable to point | ||
| echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
| echo.may add the Sphinx directory to PATH. | ||
| echo. | ||
| echo.If you don't have Sphinx installed, grab it from | ||
| echo.https://www.sphinx-doc.org/ | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| if "%1" == "" goto help | ||
|
|
||
| %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
| goto end | ||
|
|
||
| :help | ||
| %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
|
||
| :end | ||
| popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Configuration file for the Sphinx documentation builder. | ||
| # | ||
| # For the full list of built-in configuration values, see the documentation: | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
|
||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| # Add the src directory to the Python path | ||
| sys.path.insert(0, str(Path('../..', 'src').resolve())) | ||
|
|
||
| project = 'respondpy' | ||
| copyright = '2026, Syndemics Lab at Boston Medical Center ' | ||
| author = 'Matthew Carroll, Dimitri Baptiste' | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
|
||
| extensions = [ | ||
| 'sphinx.ext.autodoc', | ||
| 'sphinx.ext.napoleon', | ||
| 'myst_parser' | ||
| ] | ||
|
|
||
| templates_path = ['_templates'] | ||
| exclude_patterns = [] | ||
|
|
||
|
|
||
| # -- Options for HTML output ------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
|
||
| html_theme = 'alabaster' | ||
| html_static_path = ['_static'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # Architecture | ||
|
|
||
| This page summarizes the public surface and runtime flow of respondpy. | ||
|
|
||
| ## Public API | ||
|
|
||
| ```mermaid | ||
| flowchart LR | ||
| subgraph Pkg[respondpy package] | ||
| data[data] | ||
| discount[discount] | ||
| cwise_product[cwise_product] | ||
| cwise_min[cwise_min] | ||
| calculate_life_years[calculate_life_years] | ||
|
|
||
| History[History] | ||
| Model[Model] | ||
| build_model[build_model] | ||
| add_transitions_to_model[add_transitions_to_model] | ||
| build_model_transitions[build_model_transitions] | ||
|
|
||
| Simulation[Simulation] | ||
| build_simulation[build_simulation] | ||
|
|
||
| Transition[Transition] | ||
| transition_factory[transition_factory] | ||
| build_timestep_transition[build_timestep_transition] | ||
| end | ||
|
|
||
| build_simulation --> Simulation | ||
| build_model --> Model | ||
| add_transitions_to_model --> Model | ||
| build_model_transitions --> Model | ||
| transition_factory --> Transition | ||
| build_timestep_transition --> Transition | ||
| ``` | ||
|
|
||
| ## Execution Diagram | ||
|
|
||
| ```mermaid | ||
| flowchart LR | ||
| A[Input initialized with DB + sim.conf] --> B["build_simulation(input_data, cohort_ids)"] | ||
| B --> C{Iterate cohort ids} | ||
| C --> D["build_model(input_data, cohort_id)"] | ||
| D --> E["input_data.select_parameter(INITIAL_COHORT, cohort_id, time=1)"] | ||
| E --> F["Model.set_state(initial_population)"] | ||
| F --> G["build_model_transitions(model, input_data, cohort_id)"] | ||
| G --> H["build_timestep_transition(timestep, input_data, cohort_id)"] | ||
| H --> I["migration transition"] | ||
| H --> J["intervention transition"] | ||
| H --> K["behavior transition"] | ||
| H --> L["overdose transition"] | ||
| H --> M["background death transition"] | ||
| I --> N["add_transitions_to_model"] | ||
| J --> N | ||
| K --> N | ||
| L --> N | ||
| M --> N | ||
| N --> O["Simulation.add_model(model)"] | ||
| O --> P["Simulation.run()"] | ||
| P --> Q["get_model_sparse_histories() -> History objects"] | ||
| ``` | ||
|
|
||
| ## UML Library Flow | ||
|
|
||
| ```mermaid | ||
| sequenceDiagram | ||
| autonumber | ||
| actor User | ||
| participant In as Input | ||
| participant BS as build_simulation() | ||
| participant BM as build_model() | ||
| participant BMT as build_model_transitions() | ||
| participant BTT as build_timestep_transition() | ||
| participant Sim as Simulation | ||
| participant Mod as Model | ||
| participant Tr as Transition | ||
| participant Hist as History | ||
|
|
||
| User->>In: create Input(path or db_path/conf_path) | ||
| User->>BS: build_simulation(In, cohort_ids) | ||
| loop for each cohort_id | ||
| BS->>BM: build_model(In, cohort_id) | ||
| BM->>In: select_parameter(INITIAL_COHORT, cohort_id, time=1) | ||
| BM->>Mod: set_state(initial_population) | ||
| BM->>BMT: build_model_transitions(Mod, In, cohort_id) | ||
| loop for each timestep | ||
| BMT->>BTT: build_timestep_transition(timestep, In, cohort_id) | ||
| BTT-->>BMT: [migration, intervention, behavior, overdose, mortality] | ||
| BMT->>Mod: add_transition(Transition...) | ||
| end | ||
| BS->>Sim: add_model(Mod) | ||
| end | ||
| User->>Sim: run() | ||
| User->>Sim: get_model_sparse_histories() | ||
| Sim-->>Hist: return per-model History objects | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # How-To Load Data | ||
|
|
||
| Loading data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| .. respondpy documentation master file, created by | ||
| sphinx-quickstart on Wed Jul 15 14:57:47 2026. | ||
| You can adapt this file completely to your liking, but it should at least | ||
| contain the root `toctree` directive. | ||
|
|
||
| Welcome to respondpy's documentation! | ||
| ======================= | ||
|
|
||
| **respondpy** is a Python library for wrapping and interacting with the `RESPOND simulation model`_ C++ API. It provides a convenient and Pythonic interface for users to access the functionality of RESPOND, enabling seamless integration with Python applications. | ||
|
|
||
| .. _RESPOND simulation model: https://github.com/SyndemicsLab/respond.git | ||
|
|
||
| .. note:: | ||
| This project is under active development, and the API may change in future releases. Users are encouraged to check the documentation for updates and refer to the source code for the latest features. | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 2 | ||
|
|
||
| explanations/architecture | ||
| how_to/data_loading | ||
| references/wrapper_typing | ||
| tutorials/base_respond | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Wrapper Typing | ||
|
|
||
| How the wrapper typing works between Python and C++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Building and Running Base RESPOND | ||
|
|
||
| Tutorial 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.