pfun-cma-model 0.3.2a13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. pfun_cma_model-0.3.2a13/.gitea/workflows/main.yml +15 -0
  2. pfun_cma_model-0.3.2a13/.gitignore +203 -0
  3. pfun_cma_model-0.3.2a13/.trunk/.gitignore +8 -0
  4. pfun_cma_model-0.3.2a13/.trunk/configs/.hadolint.yaml +4 -0
  5. pfun_cma_model-0.3.2a13/.trunk/configs/.isort.cfg +2 -0
  6. pfun_cma_model-0.3.2a13/.trunk/configs/.markdownlint.yaml +10 -0
  7. pfun_cma_model-0.3.2a13/.trunk/configs/.shellcheckrc +7 -0
  8. pfun_cma_model-0.3.2a13/.trunk/configs/ruff.toml +5 -0
  9. pfun_cma_model-0.3.2a13/.trunk/trunk.yaml +30 -0
  10. pfun_cma_model-0.3.2a13/PKG-INFO +244 -0
  11. pfun_cma_model-0.3.2a13/README.md +200 -0
  12. pfun_cma_model-0.3.2a13/docker/Dockerfile +1 -0
  13. pfun_cma_model-0.3.2a13/docker/pfun-cma-model.Dockerfile +46 -0
  14. pfun_cma_model-0.3.2a13/docker/pfun-cma-model.dockerignore +19 -0
  15. pfun_cma_model-0.3.2a13/docker-compose.yaml +30 -0
  16. pfun_cma_model-0.3.2a13/environment.yml +170 -0
  17. pfun_cma_model-0.3.2a13/examples/dash_ui/__init__.py +0 -0
  18. pfun_cma_model-0.3.2a13/examples/dash_ui/assets/toggle.js +28 -0
  19. pfun_cma_model-0.3.2a13/examples/dash_ui/ui.py +193 -0
  20. pfun_cma_model-0.3.2a13/examples/data/llm_training_samples.json +123 -0
  21. pfun_cma_model-0.3.2a13/examples/data/sample_user.json +17 -0
  22. pfun_cma_model-0.3.2a13/examples/data/valid_data.csv +2880 -0
  23. pfun_cma_model-0.3.2a13/examples/dexcom-api.go +56 -0
  24. pfun_cma_model-0.3.2a13/examples/dexcom-api.py +52 -0
  25. pfun_cma_model-0.3.2a13/examples/diagrams/CMA-network-graph.mmd +20 -0
  26. pfun_cma_model-0.3.2a13/examples/diagrams/Healthy-Unhealthy-Comparison.mmd +21 -0
  27. pfun_cma_model-0.3.2a13/examples/diagrams/health-network-graph-general.png +0 -0
  28. pfun_cma_model-0.3.2a13/examples/diagrams/health-network-graph-general.svg +1 -0
  29. pfun_cma_model-0.3.2a13/examples/diagrams/pfun-health-network-graph.mmd +16 -0
  30. pfun_cma_model-0.3.2a13/examples/generate-n-samples.py +52 -0
  31. pfun_cma_model-0.3.2a13/examples/index.html +27 -0
  32. pfun_cma_model-0.3.2a13/examples/interpret-cma-params-llm.py +48 -0
  33. pfun_cma_model-0.3.2a13/examples/interpret-cma-params.py +85 -0
  34. pfun_cma_model-0.3.2a13/examples/notebooks/cma-model-modular-demos.ipynb +1910 -0
  35. pfun_cma_model-0.3.2a13/examples/notebooks/cma-model-tuning.ipynb +148 -0
  36. pfun_cma_model-0.3.2a13/examples/notebooks/dexcom-api-wrapper.ipynb +191 -0
  37. pfun_cma_model-0.3.2a13/examples/notebooks/pfun-health-network-graph.ipynb +446 -0
  38. pfun_cma_model-0.3.2a13/examples/output/fit_result.json +1 -0
  39. pfun_cma_model-0.3.2a13/examples/output/fit_result.png +0 -0
  40. pfun_cma_model-0.3.2a13/pfun-cma-model.code-workspace +29 -0
  41. pfun_cma_model-0.3.2a13/pfun_cma_model/__init__.py +8 -0
  42. pfun_cma_model-0.3.2a13/pfun_cma_model/app.py +224 -0
  43. pfun_cma_model-0.3.2a13/pfun_cma_model/cli.py +124 -0
  44. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/__init__.py +0 -0
  45. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/bounds.py +253 -0
  46. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/calc.py +200 -0
  47. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/calc_gpu.py +49 -0
  48. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/cma.py +712 -0
  49. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/cma_model_params.py +175 -0
  50. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/cma_plot.py +138 -0
  51. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/cma_posthoc.py +98 -0
  52. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/data_transfer.py +47 -0
  53. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/data_utils.py +256 -0
  54. pfun_cma_model-0.3.2a13/pfun_cma_model/engine/fit.py +382 -0
  55. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/__init__.py +0 -0
  56. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/decorators.py +13 -0
  57. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/errors.py +19 -0
  58. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/middleware.py +98 -0
  59. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/pathdefs.py +49 -0
  60. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/sessions.py +45 -0
  61. pfun_cma_model-0.3.2a13/pfun_cma_model/misc/types.py +23 -0
  62. pfun_cma_model-0.3.2a13/pfun_common/__init__.py +0 -0
  63. pfun_cma_model-0.3.2a13/pfun_common/config.py +76 -0
  64. pfun_cma_model-0.3.2a13/pfun_common/enums.py +10 -0
  65. pfun_cma_model-0.3.2a13/pfun_common/mysteries.py +106 -0
  66. pfun_cma_model-0.3.2a13/pfun_common/utils.py +70 -0
  67. pfun_cma_model-0.3.2a13/pfun_data/__init__.py +0 -0
  68. pfun_cma_model-0.3.2a13/pfun_data/data/cma_goal_response.json +605 -0
  69. pfun_cma_model-0.3.2a13/pfun_data/data/llm_training_samples.json +123 -0
  70. pfun_cma_model-0.3.2a13/pfun_data/data/sample_user_profile.json +17 -0
  71. pfun_cma_model-0.3.2a13/pfun_data/data/valid_data.csv +2880 -0
  72. pfun_cma_model-0.3.2a13/pfun_data/utils.py +19 -0
  73. pfun_cma_model-0.3.2a13/pyproject.toml +87 -0
  74. pfun_cma_model-0.3.2a13/scripts/__init__.py +0 -0
  75. pfun_cma_model-0.3.2a13/scripts/full-rebuild.sh +29 -0
  76. pfun_cma_model-0.3.2a13/scripts/get_cma_model_params_schema.py +23 -0
  77. pfun_cma_model-0.3.2a13/scripts/install-via-conda.sh +3 -0
  78. pfun_cma_model-0.3.2a13/scripts/serve_dev.sh +3 -0
  79. pfun_cma_model-0.3.2a13/scripts/test-fit-endpoint.sh +77 -0
  80. pfun_cma_model-0.3.2a13/tests/test_cma_model_params.py +90 -0
  81. pfun_cma_model-0.3.2a13/tests/test_cma_sleepwake.py +109 -0
  82. pfun_cma_model-0.3.2a13/tests/test_data_utils.py +31 -0
  83. pfun_cma_model-0.3.2a13/tests/test_fit_model.py +114 -0
  84. pfun_cma_model-0.3.2a13/tox.ini +3 -0
  85. pfun_cma_model-0.3.2a13/uv.lock +3539 -0
@@ -0,0 +1,15 @@
1
+ name: pfun-cma-model CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+
7
+ jobs:
8
+ ProjectTest:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Set up Python 3.11
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.11"
@@ -0,0 +1,203 @@
1
+ # Specifies intentionally untracked files to ignore when using Git
2
+ # http://git-scm.com/docs/gitignore
3
+
4
+ # custom
5
+ /*.env
6
+ /audio_output/
7
+ *.pem
8
+
9
+
10
+ #: NPM stuff
11
+
12
+ *~
13
+ *.sw[mnpcod]
14
+ .tmp
15
+ *.tmp
16
+ *.tmp.*
17
+ *.sublime-project
18
+ *.sublime-workspace
19
+ .DS_Store
20
+ Thumbs.db
21
+ UserInterfaceState.xcuserstate
22
+ $RECYCLE.BIN/
23
+
24
+ *.log
25
+ log.txt
26
+ npm-debug.log*
27
+
28
+ /.idea
29
+ /.ionic
30
+ /.sass-cache
31
+ /.sourcemaps
32
+ /.versions
33
+ /.vscode/*
34
+ !/.vscode/extensions.json
35
+ /coverage
36
+ /dist
37
+ /node_modules
38
+ /platforms
39
+ /plugins
40
+ /www
41
+
42
+ # # Standard Python ignores
43
+ # Byte-compiled / optimized / DLL files
44
+ __pycache__/
45
+ *.py[cod]
46
+ *$py.class
47
+
48
+ # C extensions
49
+ *.so
50
+
51
+ # Distribution / packaging
52
+ .Python
53
+ _build/
54
+ build/
55
+ develop-eggs/
56
+ dist/
57
+ downloads/
58
+ eggs/
59
+ .eggs/
60
+ lib/
61
+ lib64/
62
+ parts/
63
+ sdist/
64
+ var/
65
+ wheels/
66
+ share/python-wheels/
67
+ *.egg-info/
68
+ .installed.cfg
69
+ *.egg
70
+ MANIFEST
71
+
72
+ # PyInstaller
73
+ # Usually these files are written by a python script from a template
74
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
75
+ *.manifest
76
+ *.spec
77
+
78
+ # Installer logs
79
+ pip-log.txt
80
+ pip-delete-this-directory.txt
81
+
82
+ # Unit test / coverage reports
83
+ htmlcov/
84
+ .tox/
85
+ .nox/
86
+ .coverage
87
+ .coverage.*
88
+ .cache
89
+ nosetests.xml
90
+ coverage.xml
91
+ *.cover
92
+ *.py,cover
93
+ .hypothesis/
94
+ .pytest_cache/
95
+ cover/
96
+
97
+ # Translations
98
+ *.mo
99
+ *.pot
100
+
101
+ # Django stuff:
102
+ *.log
103
+ local_settings.py
104
+ db.sqlite3
105
+ db.sqlite3-journal
106
+
107
+ # Flask stuff:
108
+ instance/
109
+ .webassets-cache
110
+
111
+ # Scrapy stuff:
112
+ .scrapy
113
+
114
+ # Sphinx documentation
115
+ docs/_build/
116
+
117
+ # PyBuilder
118
+ .pybuilder/
119
+ target/
120
+
121
+ # Jupyter Notebook
122
+ .ipynb_checkpoints
123
+
124
+ # IPython
125
+ profile_default/
126
+ ipython_config.py
127
+
128
+ # pyenv
129
+ # For a library or package, you might want to ignore these files since the code is
130
+ # intended to run in multiple environments; otherwise, check them in:
131
+ # .python-version
132
+
133
+ # pipenv
134
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
135
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
136
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
137
+ # install all needed dependencies.
138
+ #Pipfile.lock
139
+
140
+ # poetry
141
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
142
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
143
+ # commonly ignored for libraries.
144
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
145
+ #poetry.lock
146
+
147
+ # pdm
148
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
149
+ #pdm.lock
150
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
151
+ # in version control.
152
+ # https://pdm.fming.dev/#use-with-ide
153
+ .pdm.toml
154
+
155
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
156
+ __pypackages__/
157
+
158
+ # Celery stuff
159
+ celerybeat-schedule
160
+ celerybeat.pid
161
+
162
+ # SageMath parsed files
163
+ *.sage.py
164
+
165
+ # Environments
166
+ .env
167
+ .venv
168
+ env/
169
+ venv/
170
+ ENV/
171
+ env.bak/
172
+ venv.bak/
173
+
174
+ # Spyder project settings
175
+ .spyderproject
176
+ .spyproject
177
+
178
+ # Rope project settings
179
+ .ropeproject
180
+
181
+ # mkdocs documentation
182
+ /site
183
+
184
+ # mypy
185
+ .mypy_cache/
186
+ .dmypy.json
187
+ dmypy.json
188
+
189
+ # Pyre type checker
190
+ .pyre/
191
+
192
+ # pytype static type analyzer
193
+ .pytype/
194
+
195
+ # Cython debug symbols
196
+ cython_debug/
197
+
198
+ # PyCharm
199
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
200
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
201
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
202
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
203
+ #.idea/
@@ -0,0 +1,8 @@
1
+ *out
2
+ *logs
3
+ *actions
4
+ *notifications
5
+ plugins
6
+ user_trunk.yaml
7
+ user.yaml
8
+ tools
@@ -0,0 +1,4 @@
1
+ # Following source doesn't work in most setups
2
+ ignored:
3
+ - SC1090
4
+ - SC1091
@@ -0,0 +1,2 @@
1
+ [settings]
2
+ profile=black
@@ -0,0 +1,10 @@
1
+ # Autoformatter friendly markdownlint config (all formatting rules disabled)
2
+ default: true
3
+ blank_lines: false
4
+ bullet: false
5
+ html: false
6
+ indentation: false
7
+ line_length: false
8
+ spaces: false
9
+ url: false
10
+ whitespace: false
@@ -0,0 +1,7 @@
1
+ enable=all
2
+ source-path=SCRIPTDIR
3
+ disable=SC2154
4
+
5
+ # If you're having issues with shellcheck following source, disable the errors via:
6
+ # disable=SC1090
7
+ # disable=SC1091
@@ -0,0 +1,5 @@
1
+ # Generic, formatter-friendly config.
2
+ select = ["B", "D3", "D4", "E", "F"]
3
+
4
+ # Never enforce `E501` (line length violations). This should be handled by formatters.
5
+ ignore = ["E501"]
@@ -0,0 +1,30 @@
1
+ version: 0.1
2
+ cli:
3
+ version: 1.13.0
4
+ plugins:
5
+ sources:
6
+ - id: trunk
7
+ ref: v1.1.0
8
+ uri: https://github.com/trunk-io/plugins
9
+ lint:
10
+ enabled:
11
+ - bandit@1.7.5
12
+ - black@23.7.0
13
+ - checkov@2.3.356
14
+ - git-diff-check
15
+ - hadolint@2.12.0
16
+ - isort@5.12.0
17
+ - markdownlint@0.35.0
18
+ - osv-scanner@1.3.6
19
+ - prettier@3.0.1
20
+ # - ruff@0.0.282
21
+ - shellcheck@0.9.0
22
+ - shfmt@3.6.0
23
+ - terrascan@1.18.3
24
+ - trivy@0.44.0
25
+ - trufflehog@3.46.3
26
+ runtimes:
27
+ enabled:
28
+ - go@1.19.5
29
+ - node@18.12.1
30
+ - python@3.10.8
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: pfun-cma-model
3
+ Version: 0.3.2a13
4
+ Summary: A Python package for the Physiofunctional CMA model, a generative model that functionally replicates neuroendocrine dynamics.
5
+ Project-URL: homepage, https://github.com/rocapp/pfun-cma-model
6
+ Author-email: Robbie Capps <rocapp@gmail.com>
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: boto3>=1.28.57
9
+ Requires-Dist: botocore>=1.31.57
10
+ Requires-Dist: click>=8.1.7
11
+ Requires-Dist: fastapi[standard]>=0.115.3
12
+ Requires-Dist: graphql-core>=3.2.3
13
+ Requires-Dist: gunicorn>=23.0.0
14
+ Requires-Dist: jinja2>=3.1.2
15
+ Requires-Dist: matplotlib>=3.8.0
16
+ Requires-Dist: numba>=0.58.0
17
+ Requires-Dist: pandas>=2.1.1
18
+ Requires-Dist: paramiko>=3.3.1
19
+ Requires-Dist: pfun-path-helper>=0.1.2
20
+ Requires-Dist: plotly>=5.18.0
21
+ Requires-Dist: pydantic==2.4.2
22
+ Requires-Dist: pyyaml>=6.0.1
23
+ Requires-Dist: requests>=2.32.4
24
+ Requires-Dist: scikit-learn>=1.3.2
25
+ Requires-Dist: scipy>=1.11.3
26
+ Requires-Dist: setuptools>=78.1.1
27
+ Requires-Dist: tabulate>=0.9.0
28
+ Requires-Dist: uvicorn==0.32.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: click>=8.1.7; extra == 'dev'
31
+ Requires-Dist: fastapi[standard]>=0.115.12; extra == 'dev'
32
+ Requires-Dist: ipykernel>=6.25.2; extra == 'dev'
33
+ Requires-Dist: ipython>=8.16.1; extra == 'dev'
34
+ Requires-Dist: notebook>=7.4.3; extra == 'dev'
35
+ Requires-Dist: pandas-stubs>=2.2.3.250527; extra == 'dev'
36
+ Requires-Dist: pytest>=6.0; extra == 'dev'
37
+ Requires-Dist: tox-poetry-installer>=0.10.3; extra == 'dev'
38
+ Requires-Dist: types-requests>=2.32.4.20250611; extra == 'dev'
39
+ Requires-Dist: types-tabulate>=0.9.0.20241207; extra == 'dev'
40
+ Requires-Dist: zappa>=0.58.0; extra == 'dev'
41
+ Provides-Extra: ui
42
+ Requires-Dist: dash>=2.18.2; extra == 'ui'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # pfun-cma-model
46
+
47
+ _PFun CMA model repo._
48
+
49
+ ## Development notes
50
+
51
+ - **[TODO]** Resolve issues in app.py routes.
52
+ - **[TODO]** Get docker compose build working...
53
+ - Using `uv` for super fast dependency management, usage, and publishing.
54
+
55
+ ### Create a dedicated virtual environment
56
+
57
+ ```bash
58
+
59
+ uv venv
60
+
61
+ ```
62
+
63
+ ### Install fastapi with the correct version
64
+
65
+ ```bash
66
+
67
+ # install fastapi cli for 'uvx'
68
+ uv add fastapi --extra standard
69
+
70
+ # run the dev server with:
71
+ uv run fastapi dev
72
+ ...
73
+
74
+ ```
75
+
76
+ ### Run tests locally
77
+
78
+ ```bash
79
+
80
+ uvx tox
81
+
82
+ ```
83
+
84
+ ### To add a development dependency
85
+
86
+ ```bash
87
+
88
+ # e.g., 'uv add --dev types-requests'
89
+ $ uv add --dev ...
90
+
91
+ ```
92
+
93
+ ### Updating the environment
94
+
95
+ ```bash
96
+
97
+ uv sync
98
+
99
+ ```
100
+
101
+ ### Debugging the app locally (run as a local FastAPI server)
102
+
103
+ ```bash
104
+
105
+ $ uv run fastapi dev pfun_cma_model/app.py --port 8001
106
+
107
+ ```
108
+
109
+ ## Run CLI examples
110
+
111
+ ```bash
112
+
113
+ # show usage statement for pfun-cma-model CLI
114
+ $ uv run pfun-cma-model
115
+ ...
116
+
117
+
118
+ # fit the model, output results
119
+ $ uv run pfun-cma-model run-fit-model --plot
120
+ ...
121
+
122
+ ```
123
+
124
+ ## CMA Model Description
125
+
126
+ ### Model Parameters
127
+
128
+ | Parameter | Type | Default | Lower Bound | Upper Bound | Description |
129
+ | --------- | -------------------------- | ----------------- | ----------- | ----------- | ----------------------------------------- |
130
+ | t | Optional[array_like] | None | N/A | N/A | Time vector (decimal hours) |
131
+ | N | int | 24 | N/A | N/A | Number of time points |
132
+ | d | float | 0.0 | -12.0 | 14.0 | Time zone offset (hours) |
133
+ | taup | float | 1.0 | 0.5 | 3.0 | Circadian-relative photoperiod length |
134
+ | taug | float | 1.0 | 0.1 | 3.0 | Glucose response time constant |
135
+ | B | float | 0.05 | 0.0 | 1.0 | Glucose Bias constant |
136
+ | Cm | float | 0.0 | 0.0 | 2.0 | Cortisol temporal sensitivity coefficient |
137
+ | toff | float | 0.0 | -3.0 | 3.0 | Solar noon offset (latitude) |
138
+ | tM | Tuple[float, float, float] | (7.0, 11.0, 17.5) | N/A | N/A | Meal times (hours) |
139
+ | seed | Optional[int] | None | N/A | N/A | Random seed |
140
+ | eps | float | 1e-18 | N/A | N/A | Random noise scale ("epsilon") |
141
+
142
+ ### Example Fitted Parameters
143
+
144
+ | Parameter | Value | Example Description (Human provided) |
145
+ | --------- | ------------- | ------------------------------------------------------------------------------ |
146
+ | d | -2.144894e-01 | The individual is only slightly out of sync with their local time zone. |
147
+ | taup | 4.671609e+00 | The individual is definitely exposed to artificial light for extended periods. |
148
+ | taug | 1.097094e+00 | The individual's glucose response is within a normal range. |
149
+ | B | 1.288179e-01 | The individual has a bias towards higher glucose levels. |
150
+ | Cm | 0.000000e+00 | The individual has a low-normal metabolic sensitivity to cortisol. |
151
+ | toff | 0.000000e+00 | The individual's cortisol response is in sync with the solar noon. |
152
+
153
+ ### Example ChatGPT Output
154
+
155
+ ```markdown
156
+ Based on the given model parameters and their example fitted values, we can make several clinically and physiologically relevant observations about the individual:
157
+
158
+ 1. **Time Zone Offset (d)**: The value is -0.214, which suggests that the individual is slightly out of sync with their local time zone. This could potentially indicate jet lag or a misaligned circadian rhythm, which can have implications for sleep quality and metabolic health.
159
+
160
+ 2. **Circadian-relative Photoperiod Length (taup)**: The value is 4.67, which is significantly higher than the default of 1.0 and also exceeds the upper bound. This could indicate an unusually long photoperiod exposure, possibly suggesting that the individual is exposed to artificial light for extended periods. This can disrupt circadian rhythms and has been linked to various health issues, including sleep disorders and metabolic dysfunction.
161
+
162
+ 3. **Glucose Response Time Constant (taug)**: The value is 1.097, which is close to the default. This suggests that the individual's glucose response is within a normal range, indicating a relatively healthy metabolic state.
163
+
164
+ 4. **Glucose Bias Constant (B)**: The value is 0.129, which is higher than the default of 0.05. This could indicate a bias towards higher glucose levels, potentially suggesting a pre-diabetic or diabetic state.
165
+
166
+ 5. **Cortisol Temporal Sensitivity Coefficient (Cm)**: The value is -1.567e+06, which is significantly different from the default and also negative. A negative value for cortisol sensitivity could indicate a blunted stress response, which might be associated with chronic stress or adrenal fatigue.
167
+
168
+ 6. **Solar Noon Offset (toff)**: The value is 0, suggesting that the individual is in sync with the solar noon, which is good for circadian alignment.
169
+
170
+ 7. **Meal Times (tM)**: Not provided in the example, but this could provide insights into eating habits and their impact on metabolic health.
171
+
172
+ 8. **Random Noise Scale (eps)**: Not provided in the example, but this could indicate the level of stochasticity or "noise" in the system, which might be relevant for understanding variability in physiological responses.
173
+
174
+ Overall, the individual appears to have some circadian misalignment and potential metabolic issues, particularly related to glucose regulation and stress response. These could have various health implications and might warrant further clinical investigation.
175
+ ```
176
+
177
+ ### Example ChatGPT Diagram
178
+
179
+ ```mermaid
180
+ graph TB
181
+ Healthy["Healthy Individual"]
182
+ Unhealthy["Sample Individual"]
183
+ style Healthy fill:#99cc99
184
+ style Unhealthy fill:#ff6666
185
+ Healthy --> A1["Normal Circadian Rhythm"]
186
+ Healthy --> A2["Optimal Glucose Regulation"]
187
+ Healthy --> A3["Balanced Cortisol Levels"]
188
+ Healthy --> A4["Healthy Stress Response"]
189
+ Unhealthy --> B1["Disrupted Circadian Rhythm"]
190
+ Unhealthy --> B2["Poor Glucose Regulation"]
191
+ Unhealthy --> B3["Elevated Cortisol Levels"]
192
+ Unhealthy --> B4["Poor Stress Response"]
193
+ A1 -->|Clinical Implication| C1["Reduced Risk of Metabolic Disorders"]
194
+ A2 -->|Clinical Implication| C2["Reduced Risk of Diabetes"]
195
+ A3 -->|Clinical Implication| C3["Reduced Risk of Stress-related Disorders"]
196
+ A4 -->|Clinical Implication| C4["Reduced Risk of Mental Health Issues"]
197
+ B1 -->|Clinical Implication| D1["Increased Risk of Metabolic Disorders"]
198
+ B2 -->|Clinical Implication| D2["Increased Risk of Diabetes"]
199
+ B3 -->|Clinical Implication| D3["Increased Risk of Stress-related Disorders"]
200
+ B4 -->|Clinical Implication| D4["Increased Risk of Mental Health Issues"]
201
+ B1 -->|Model Parameters| E1["d: -0.214"]
202
+ B1 -->|Model Parameters| E2["taup: 4.67"]
203
+ B2 -->|Model Parameters| E3["taug: 1.097"]
204
+ B2 -->|Model Parameters| E4["B: 0.129"]
205
+ B3 -->|Model Parameters| E5["Cm: -1.567e+06"]
206
+ ```
207
+
208
+ ### Example Non-PFun ChatGPT Response
209
+
210
+ ```markdown
211
+ Based on the analysis of your CGM data, here's a personalized report on your metabolic health:
212
+
213
+ - **Average Glucose:** 120.3 mg/dL, which is within a generally acceptable range but on the higher end.
214
+ - **Minimum Glucose:** 95.0 mg/dL, indicating good management of low glucose episodes.
215
+ - **Maximum Glucose:** 262.0 mg/dL, suggesting some episodes of significantly elevated glucose.
216
+ - **High Glucose Episodes:** 321 instances where your glucose levels were flagged as high.
217
+ - **Low Glucose Episodes:** Occurrences of low glucose are less frequent.
218
+ - **Total Readings:** There were numerous readings, indicating a comprehensive monitoring period.
219
+ - **Standard Deviation of Glucose:** 17.7, which reflects moderate variability in your glucose levels.
220
+
221
+ This report suggests overall decent glucose management, but the high glucose episodes and maximum glucose level indicate potential areas for improvement. Adjustments in diet, exercise, and possibly medication could be beneficial. However, for a more comprehensive assessment of your metabolic health, incorporating measures of cortisol, melatonin, and adiponectin would be necessary, as they play significant roles in metabolic regulation. Always consult with your healthcare provider for personalized medical advice.
222
+ ```
223
+
224
+ ### Example ChatGPT Response with PFun Parameters
225
+
226
+ ```markdown
227
+ The additional details you provided, including model parameters and example fitted values, offer valuable insights into your metabolic health, particularly concerning your circadian rhythm and glucose metabolism.
228
+
229
+ 1. **Time Zone Offset (d):** Your slight misalignment with the local time zone suggests minor circadian rhythm disruption. This could be due to travel, work schedule, or lifestyle habits.
230
+
231
+ 2. **Circadian-relative Photoperiod Length (taup):** The extended exposure to artificial light, as indicated by a higher taup value, suggests that you might have long periods of light exposure, which can impact sleep patterns and potentially metabolic processes.
232
+
233
+ 3. **Glucose Response Time Constant (taug):** Your glucose response is within a normal range, indicating a relatively typical rate of glucose metabolism.
234
+
235
+ 4. **Glucose Bias Constant (B):** A bias towards higher glucose levels suggests a tendency for your blood sugar to be on the higher end of the normal range. This could be influenced by diet, physical activity, and overall health.
236
+
237
+ 5. **Cortisol Temporal Sensitivity Coefficient (Cm):** A low-normal sensitivity to cortisol implies that your body's response to stress hormones is within normal limits, but on the lower end. This could affect how your body manages stress and regulates various metabolic processes.
238
+
239
+ 6. **Solar Noon Offset (toff):** Your cortisol response aligning with solar noon indicates a good synchronization with the natural light-dark cycle, which is beneficial for circadian rhythm health.
240
+
241
+ 7. **Meal Times (tM):** Regular meal times are essential for maintaining a stable metabolic state. Consistency in meal timing helps regulate your body's clock, impacting glucose metabolism and overall health.
242
+
243
+ In summary, your data suggests a well-regulated glucose metabolism with a tendency towards higher glucose levels. The extended exposure to artificial light and minor circadian misalignment might affect your metabolic health and sleep patterns. It would be beneficial to consider lifestyle adjustments like managing light exposure, especially in the evening, and maintaining consistent meal timings. Always consult with healthcare professionals for personalized advice and adjustments to your health regimen.
244
+ ```