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

[Backend] Update the importer to include adding a discussion section in each new analysis #155

Conversation

JmScherer
Copy link
Collaborator

@JmScherer JmScherer commented Dec 12, 2023

Checklist before requesting a review

  • I have performed a self-review of my code.
  • My code follows the style guidelines enforced by static analysis tools.
  • If it is a core feature, I have added thorough tests.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.

Pull Request Details

https://www.wrike.com/open.htm?id=1206943181

Changes made:

This pull request is intended to create consistency with how Analysis documents are created

  • Updates the PhenotipsImporter.py to add both the discussions and supporting_evidence_files keys to every uploaded analysis.
    • Assigns to empty arrays
  • Updates the existing fixtures to include the keys
    • Consistent fixture data to have empty arrays if no entries

To Review:

  • Static Analysis by Reviewer
  • Deploy and upload a new analysis for local Rosalution
    To check this run the following commands:
    # from the root of Rosalution
    docker compose down
    docker system prune -a --volumes
    
    docker compose up --build -d
  • Does the Analysis have the new fields upon upload?
    # Find the container name running mongo
    docker ps
    
    docker exec -it <mongo_container_name> mongosh rosalution_db
    
    Example:
    
    docker exec -it rosalution-rosalution-db-1 mongosh rosalution_db
    
    # Ensure the fields were created on upload
    
    db.analyses.find({"name": "CPAM0042"})
  • All Github Actions checks have passed.

Screenshot 2023-12-12 at 1 33 08 PM

Screenshot 2023-12-12 at 1 33 18 PM

Screenshot 2023-12-12 at 1 37 55 PM

…iscussions field. Updated the analyses fixture to include these fields as well
@JmScherer JmScherer added the enhancement New feature or request label Dec 12, 2023
@JmScherer JmScherer self-assigned this Dec 12, 2023
Copy link
Collaborator

@SeriousHorncat SeriousHorncat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imported case and it successfully added and it included both of the attributes as expected.

rosalution_db> db.analyses.find({"name": "CPAM0042"})
[
  {
    _id: ObjectId("657cb1d57f0888d94a655ef6"),
    name: 'CPAM0042',
    description: '',
    nominated_by: '',
    genomic_units: [
      {
        gene: 'JAK2',
        transcripts: [ { transcript: 'NM_004972.3' } ],
        variants: [
          {
            hgvs_variant: 'NM_004972.3:c.1694G>C',
            c_dot: 'c.1694G>C',
            p_dot: 'p.Arg565Thr',
            build: 'GRCh37',
            case: [ [Object], [Object] ]
          }
        ]
      }
    ],
    sections: [
      {
        header: 'Brief',
        content: [
          { type: 'section-text', field: 'Nominator', value: [] },
          { type: 'section-text', field: 'Participant', value: [] },
          { type: 'section-text', field: 'Phenotype', value: [] },
          {
            type: 'section-text',
            field: 'ACMG Classification',
            value: []
          },
          {
            type: 'section-text',
            field: 'ACMG Classification Criteria',
            value: []
          },
          {
            type: 'section-text',
            field: 'ACMG Criteria To Add',
            value: []
          },
          { type: 'section-text', field: 'Decision', value: [] }
        ]
      },
      {
        header: 'Clinical History',
        content: [
          {
            type: 'section-text',
            field: 'Clinical Diagnosis',
            value: []
          },
          {
            type: 'section-text',
            field: 'Affected Individuals Identified',
            value: []
          },
          { type: 'section-text', field: 'Sequencing', value: [] },
          { type: 'section-text', field: 'Testing', value: [] },
          { type: 'section-text', field: 'Systems', value: [] },
          {
            type: 'section-text',
            field: 'Additional Details',
            value: []
          }
        ]
      },
      {
        header: 'Pedigree',
        attachment_field: 'Pedigree',
        content: [ { type: 'images-dataset', field: 'Pedigree', value: [] } ]
      },
      {
        header: 'JAK2 Gene To Phenotype',
        attachment_field: 'JAK2 Gene To Phenotype',
        content: [
          {
            type: 'images-dataset',
            field: 'JAK2 Gene To Phenotype',
            value: []
          },
          {
            type: 'section-text',
            field: 'HPO Terms',
            value: [
              'HP:0000155: Oral ulcer; HP:0000217: Xerostomia; HP:0000365: Hearing impairment; HP:0000508: Ptosis; HP:0000716: Depressivity; HP:0000872: Hashimoto thyroiditis; HP:0000988: Skin rash; HP:0000992: Cutaneous photosensitivity; HP:0001097: Keratoconjunctivitis sicca; HP:0001337: Tremor; HP:0001369: Arthritis; HP:0001370: Rheumatoid arthritis; HP:0001596: Alopecia; HP:0001701: Pericarditis; HP:0001882: Leukopenia; HP:0001903: Anemia; HP:0002035: Rectal prolapse; HP:0002102: Pleuritis; HP:0002315: Headache; HP:0002583: Colitis; HP:0003401: Paresthesia; HP:0005681: Juvenile rheumatoid arthritis; HP:0030880: Raynaud phenomenon; HP:0100543: Cognitive impairment; HP:0100654: Retrobulbar optic neuritis'
            ]
          }
        ]
      },
      {
        header: 'JAK2 Molecular Mechanism',
        content: [
          {
            type: 'section-text',
            field: 'JAK2 Molecular Mechanism',
            value: []
          }
        ]
      },
      {
        header: 'JAK2 Function',
        attachment_field: 'JAK2 Function',
        content: [
          { type: 'images-dataset', field: 'JAK2 Function', value: [] }
        ]
      },
      {
        header: 'Model Goals',
        content: [
          {
            type: 'section-text',
            field: 'Model of Interest',
            value: []
          },
          { type: 'section-text', field: 'Goals', value: [] },
          {
            type: 'section-text',
            field: 'Proposed Model/Project',
            value: []
          },
          {
            type: 'section-text',
            field: 'Existing Collaborations',
            value: []
          },
          {
            type: 'section-text',
            field: 'Existing Funding',
            value: []
          }
        ]
      }
    ],
    discussions: [],
    supporting_evidence_files: [],
    timeline: [
      {
        event: 'create',
        timestamp: ISODate("2023-12-15T20:06:45.667Z"),
        username: '3bghhsmnyqi6uxovazy07ryn9q1tqbnt'
      }
    ]
  }
]

@JmScherer JmScherer merged commit 7fcd650 into feature-collab-analysis-discussion Dec 15, 2023
8 checks passed
@JmScherer JmScherer deleted the update-phenotips-importer-with-new-fields branch December 15, 2023 20:47
JmScherer added a commit that referenced this pull request Feb 9, 2024
* [Frontend] Create a new discussion component to be displayed in an Analysis view (#139)

* Updating the paper to include the country for each affiliation which is required for publication.

* Updated the system tests workflow to use electron (#140)

* Added a DiscussionsSection.vue in AnalysisView components, updated the analysis model to return an injected discussion object, and updating the styling of the buttons to match figma more closely

* The discussion collapse works

* Looks ready for a pull request

* Tests should be working now

* Left out the node test

* Updating CSS in a few places

* Updating the DiscussionSection values

---------

Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>

* Created a discussions property in each of the analyses with several posts within them. Removed the temp fixture used in the frontend (#141)

* Fixed frontend unit test with AnalysisView

* fixed line too long

* Missed the updated json

* Changed formatting on the /etc/fixtures/analyses.json

* removed the etc/.certificate files

* Displaying discussion posts (#150)

* New Discussions post button, text field, and save/publish buttons

* Creating temporary discussion API mock api endpoints to test integrating them into the frontend

* Displaying posts from an analysis

* Hooked up the discussion post to the backend and return a mock discussions post. Added styling to the discussion posts

* Updated CSS to alternate discussion post colors

* Added more unit test coverage on the frontend and linted

* Added system tests and data-test attributes to go along with it

---------

Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>

* [Frontend] Clicking the "New Discussion" button opens a field below the header line divider to enter an opinion (#151)

* New Discussions post button, text field, and save/publish buttons

* Displaying posts from an analysis

* Added more unit test coverage on the frontend and linted

* Toggles New Discussion Field

* added system and unit tests for the discussion section

* forgot to add the system test

* Minor CSS fixes

* [Backend] Add a new route and repository to handle an incoming post and save it in Mongo (#153)

* Added a new collection to update a new post along with a test and linting

* Fixing python unit test

* Integration test and linting

* Updated the analysis_collection add_discussion_post function to use pymongo find_one_and_update function to simplify how posts are added to discussions in analyses

* linting

* New migration script to ensure both supporting_evidence_files and discussions keys are added to each analysis object in the analyses collection (#154)

* Updated phenotips importer to include supporting_evidence_files and discussions field. Updated the analyses fixture to include these fields as well (#155)

* Adding context menu to discussion posts (#156)

* added actions to the discussion post context menus

* Changed the backend user object to send back the clientId in the basic user object, this is used to check if the user made a post and present a context menu

* new ContextMenu.vue duplicates the DropDownMenu.vue functionality and turns it from hover to click. This is not quite right

* lots of changes: swapped dropdown and contextmenu icons, contextmenu will now open on click and close when unfocused or an action is taken on the menu. ContextMenu styling changes

* Fixed frontend test

* Lots of fixes, trying to figure out how to test this

* Frontend linting

* Removed a .only in front end test

* [Backend] Remove and edit post route and methods to update and delete a post from the discussion section (#157)

* Added a delete route and delete post analysis collection function

* Added a new route for editing a post and matching collection function, also added error checking for different situations in modifying discussion posts in an analysis

* Change responsibilities of routes and put helper function to find discussion post in analysis model

* proper error handling for discussion posts in progress

* Removed the discussion fixtures and properly gets the discussion posts from the analysis

* Finished integration and unit tests for updating and deleting a discussion post

* Formatting/linting

* Fixed integration test

* Added unit and integration tests for analysis model and routers

* Update backend/src/routers/analysis_discussion_router.py

Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>
Signed-off-by: James Scherer <james.m.scherer@gmail.com>

* Update backend/tests/integration/test_analysis_routers.py

Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>
Signed-off-by: James Scherer <james.m.scherer@gmail.com>

* linting

---------

Signed-off-by: James Scherer <james.m.scherer@gmail.com>
Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>

* [Frontend] The vertical '...' context menu functions to delete posts (#158)

* Frontend discussion post deletion working, complete with notification dialog

* Adding a system test for successfully deleting a new discussion post

* fixing frontend unit tests and adding an extra system test

* Linting

* Changed the delete action in the context menu to have an emit key and chain the emits down the section to be called in the view to delete a post

* Linting and changing var names

* Lots of frontend unit tests, but not yet finished

* Added more tests and linting

* Fixed issue with contextId being renamed

* Removed console log

* [Frontend] The vertical '...' context menu functions to edit posts (#160)

* Frontend discussion post deletion working, complete with notification dialog

* Adding a system test for successfully deleting a new discussion post

* fixing frontend unit tests and adding an extra system test

* Linting

* Changed the delete action in the context menu to have an emit key and chain the emits down the section to be called in the view to delete a post

* Linting and changing var names

* Lots of frontend unit tests, but not yet finished

* Added more tests and linting

* Fixed issue with contextId being renamed

* Removed console log

* Edit post emit chain working and backend is saving properly, it's just the discussion content is the same as what's posted

* Now editing a post works, it edits the post in place

* More styling for the post editing

* Frontend linting

* Frontend tests and linting

* Added system tests for post editing

* Update .github/workflows/system-tests.yml

Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>
Signed-off-by: James Scherer <james.m.scherer@gmail.com>

* Update backend/src/routers/analysis_router.py

Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>
Signed-off-by: James Scherer <james.m.scherer@gmail.com>

* skipping the a test in rosalution_analysis to match main, will come back later

---------

Signed-off-by: James Scherer <james.m.scherer@gmail.com>
Co-authored-by: Angelina Uno-Antonison <ange.unoantonison@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants