Skip to content
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

Feature - Sub-compartments #84

Closed
Quantalabs opened this issue Jul 22, 2021 · 6 comments · Fixed by #116
Closed

Feature - Sub-compartments #84

Quantalabs opened this issue Jul 22, 2021 · 6 comments · Fixed by #116
Assignees
Labels
enhancement New feature or request src Directly related to the source code of the package Status: Claimed Issue has been claimed

Comments

@Quantalabs
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, sub-compartments in models are not supported. This prevents users from having more advanced models, perhaps a SIR model with an asymptomatic and symptomatic sub-compartments for the infected compartment, or even two sub-compartments for recorded and actual case data.

Describe the solution you'd like
Adding a simple way to include sub-compartments in a model, which will allow users to include more complex models like the examples above.

Describe alternatives you've considered
Users could instead create two separate compartments for each sub-compartment, however now if #83 is implemented, plotting will plot those as separate compartments, so in stacked charts, the plots will have an infected category, and then a symptomatic category, and asymptomatic category, all plotted separately.

Additional context
This feature should most likely be implemented before #83, or otherwise the issue will be reopened once finished.

@Quantalabs Quantalabs added enhancement New feature or request src Directly related to the source code of the package Status: Available Available for claiming labels Jul 22, 2021
@Quantalabs
Copy link
Member Author

/claim

@github-actions github-actions bot added Status: Claimed Issue has been claimed and removed Status: Available Available for claiming labels Jan 3, 2022
@github-actions
Copy link

github-actions bot commented Jan 3, 2022

Thank you @Quantalabs for claiming this issue! 🎉

Please reference this issue when you submit your Pull Request and make sure you follow the contributing guidelines.

@Quantalabs Quantalabs pinned this issue Jan 4, 2022
@Quantalabs
Copy link
Member Author

My proposal for this is we make comp a submodule of a larger comp module (yes this is a breaking change, but we already are planning to release v3, see #115) and create another submodule called sub in comp for submodules. The submodules will be like compartments, but can only be a percentage of the larger compartment. The model will look like the following (when exported into JSON):

{
  "compartments": {
    "S": {
      "equation": "S-(B*S*I/p)"
    },
    "I": {
      "equation": "I+(B*S*I/p)-(u*I)",
      "compartments": {
        "Asymptomatic": {
          "percent": 10,
        },
       "Symptomatic": {
          "percent": 90,
        }
      }
    },
    "R": {
      "equation": "R+(u*I)"
    }
  },
  "key": {
    "S": 10000,
    "B": 0.3,
    "I": 100,
    "R": 0,
    "p": 10100,
    "u": 0.2
  }
}

@Quantalabs
Copy link
Member Author

Quantalabs commented Jan 5, 2022

I've decided to disregard the idea to have a sub-compartment, but instead add a method in the compartment classes called .addSub(). The JSON structure will stay.

@Quantalabs
Copy link
Member Author

With 88cb0c2 we have the initial code for subcompartments.

@Quantalabs
Copy link
Member Author

Sub compartments are now officially implemented with f8e2399, which will be merged into master soon.

@Quantalabs Quantalabs mentioned this issue Jan 5, 2022
4 tasks
Quantalabs added a commit that referenced this issue Jan 5, 2022
* Fix rates in tests

* Add subcompartments

Adds the initial code for subcompartments to be worked on in future commits, rebuilds code, and adds testing for subcompartments.

* Fix bug in subcompartments

Fix minor bug in subcompartments that returned an object as population, even when there were no subcompartments.

* Remove unneeded testing file

* Fix deepsource errors

* Rebuild code and fix final deepsource error

* Fix another deepsource error
@Quantalabs Quantalabs unpinned this issue Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request src Directly related to the source code of the package Status: Claimed Issue has been claimed
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant