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

Bug: Mira Model Edit Fix rename state and possibly rename transition #84

Closed
Tom-Szendrey opened this issue Feb 16, 2024 · 2 comments · Fixed by #86
Closed

Bug: Mira Model Edit Fix rename state and possibly rename transition #84

Tom-Szendrey opened this issue Feb 16, 2024 · 2 comments · Fixed by #86
Assignees
Labels
bug Something isn't working

Comments

@Tom-Szendrey
Copy link
Contributor

The mira code being called in rename state and potentially rename transition doesnt work as intended.
Start with SIR
Add state A
Rename to state S

Expected result:

{
    "id": "S",
    "name": "Susceptible",
    "grounding": {
        "identifiers": {
            "ido": "0000514"
        },
        "modifiers": {}
    },
    "units": {
        "expression": "person",
        "expression_mathml": "<ci>person</ci>"
    }
}

Actual result:

{
    "id": "S",
    "name": "Susceptible",
    "grounding": {
        "identifiers": {
            "ido": "0000514"
        },
        "modifiers": {}
    },
    "units": {
        "expression": "person",
        "expression_mathml": "<ci>person</ci>"
    }
},
{
    "id": "S",
    "name": "S",
    "grounding": {
        "identifiers": {},
        "modifiers": {}
    }
},
@Tom-Szendrey Tom-Szendrey self-assigned this Feb 16, 2024
@Tom-Szendrey Tom-Szendrey added the bug Something isn't working label Feb 16, 2024
@liunelson
Copy link
Member

Here's a replacement rename function: https://github.com/liunelson/mira/blob/nliu/experiment/notebooks/nliu/rename_state.py#L109

I hate to have such a long-winded code snippet but it seems necessary to handle all the cases (whether or not the old or new name exists):

    """
    Given a TemplateModel model and the old & new name of a state/concept therein, 
    1. if the old name doesn't exist, do nothing
    2. if the new name is unused, replace the name of that state/concept
    3. if the new name is used, replace the old-name concept by the new-name concept
    
    Apply same replacement to the rate laws, observable expressions, and initials.
    """

@liunelson
Copy link
Member

Do we need similar troubleshooting with the transition rename function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants