Skip to content

Add Documentation#5

Merged
t0mdavid-m merged 5 commits intodevelopfrom
feature/user-guide-update
Apr 28, 2025
Merged

Add Documentation#5
t0mdavid-m merged 5 commits intodevelopfrom
feature/user-guide-update

Conversation

@t0mdavid-m
Copy link
Copy Markdown
Member

@t0mdavid-m t0mdavid-m commented Apr 24, 2025

Summary by CodeRabbit

  • New Features

    • Added a comprehensive, interactive User Guide page to the application, accessible from the main navigation menu.
    • The User Guide includes step-by-step instructions, annotated screenshots, and guidance for using FLASHDeconv and FLASHTnT tools.
  • Documentation

    • Introduced a detailed Markdown-based user guide covering all major features and workflows.
    • Enhanced in-app documentation display with support for embedded images and error handling for missing content.
  • Chores

    • Removed the legacy documentation viewer to streamline and update the user documentation experience.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 24, 2025

Walkthrough

The changes introduce a new "User Guide" page into the Streamlit application's navigation, referencing a new Python module that dynamically renders a Markdown-based user guide with embedded images and error handling for missing assets. The Markdown file for the user guide is added, providing comprehensive documentation for users. An old multi-page documentation viewer Python file is deleted, consolidating documentation into the new user guide system. No changes are made to exported or public entities, and no modifications to control flow outside of the documentation navigation are introduced.

Changes

File(s) Change Summary
app.py Updated the navigation to add a "User Guide" page entry under the "FLASHApp" section, referencing the new user_guide.py script. A trailing comma was added to the previous entry.
content/user_guide.md Added a comprehensive Markdown user guide for FLASHDeconv and FLASHTnT, including instructions, annotated screenshots, and references.
content/user_guide.py Added a new Streamlit page that reads and renders the Markdown user guide, processes Markdown image syntax, displays images with captions, and provides error messages for missing files or images.
content/TODO_Update/documentation.py Deleted the previous Streamlit-based documentation viewer, which provided a multi-page interface for various documentation topics, file reading and rendering, and a download button for a Windows executable archive.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant StreamlitApp
    participant user_guide.py
    participant user_guide.md
    participant ImagesFolder

    User->>StreamlitApp: Select "User Guide" from navigation
    StreamlitApp->>user_guide.py: Load page
    user_guide.py->>user_guide.md: Read Markdown content
    loop For each line in Markdown
        alt Markdown image syntax
            user_guide.py->>ImagesFolder: Load referenced image
            alt Image found
                user_guide.py->>StreamlitApp: Display image with caption
            else Image missing
                user_guide.py->>StreamlitApp: Display warning
            end
        else Regular Markdown
            user_guide.py->>StreamlitApp: Render Markdown line
        end
    end
    StreamlitApp->>User: Display user guide with images and text
Loading

Poem

🐇
A guide now hops into the stream,
With images bright and Markdown gleam.
The docs are fresh, the old ones gone,
New pages guide you right along.
If pictures hide, a warning shows—
But knowledge in abundance grows!
📖✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (12)
content/user_guide.md (9)

30-30: Use proper Markdown link formatting.

Replace the bare URL with proper Markdown link formatting for better readability and accessibility.

-4. If you want to know more about each parameter go to this link: https://openms.de/FLASHDeconv
+4. If you want to know more about each parameter, visit the [FLASHDeconv documentation](https://openms.de/FLASHDeconv).
🧰 Tools
🪛 LanguageTool

[style] ~30-~30: Consider using an alternative to strengthen your wording.
Context: ...* for deconvolution accuracy. 4. If you want to know more about each parameter go to...

(WANT_KEEN)

🪛 markdownlint-cli2 (0.17.2)

30-30: Bare URL used
null

(MD034, no-bare-urls)


133-134: Vary sentence structure for better readability.

Consecutive sentences starting with the same word make the text repetitive.

-3. Click the **"Database"** tab to upload the necessary **FASTA** database files.
-4. Click **"Add Database"** to confirm the upload.
+3. Click the **"Database"** tab to upload the necessary **FASTA** database files.
+4. Select **"Add Database"** to confirm the upload.
🧰 Tools
🪛 LanguageTool

[style] ~134-~134: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... necessary FASTA database files. 4. Click "Add Database" to confirm the uploa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


131-137: Use consistent image captions.

Multiple images use the same generic caption "Download Results" despite showing different features.

-![Download Results](/static/images/flashTnT_upload.png)
+![FLASHTnT Upload](/static/images/flashTnT_upload.png)

-![Download Results](/static/images/flashTnT_databaseupload.png)
+![FLASHTnT Database Upload](/static/images/flashTnT_databaseupload.png)
🧰 Tools
🪛 LanguageTool

[style] ~134-~134: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... necessary FASTA database files. 4. Click "Add Database" to confirm the uploa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 markdownlint-cli2 (0.17.2)

137-137: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)


154-155: Use consistent image captions.

Multiple images use the same generic caption.

-![Download Results](/static/images/flashtnt_configure.png)
-![Download Results](/static/images/flashTnT_configure2.png)
+![FLASHTnT Configuration](/static/images/flashtnt_configure.png)
+![FLASHTnT Advanced Configuration](/static/images/flashTnT_configure2.png)

166-166: Use consistent image captions.

Generic caption needs to be more specific.

-![Download Results](/static/images/flashtnt_run.png)
+![FLASHTnT Workflow Run](/static/images/flashtnt_run.png)

181-181: Use consistent image captions.

Generic caption needs to be more specific.

-![Download Results](/static/images/layoutmanager_tnt.png)
+![FLASHTnT Layout Manager](/static/images/layoutmanager_tnt.png)

190-190: Use consistent image captions.

Generic caption needs to be more specific.

-![Download Results](/static/images/FlashTnT_Viewer.png)
+![FLASHTnT Viewer Interface](/static/images/FlashTnT_Viewer.png)

199-199: Use consistent image captions.

Generic caption needs to be more specific.

-![Download Results](/static/images/manual_result_upload.png)
+![Manual Result Upload](/static/images/manual_result_upload.png)

210-210: Use consistent image captions.

Generic caption needs to be more specific.

-![Download Results](/static/images/download_tnt.png)
+![FLASHTnT Download Page](/static/images/download_tnt.png)
content/user_guide.py (3)

18-18: Unnecessary f-string.

The f-string doesn't contain any interpolated variables.

-    st.error(f"🚨 Error: Could not find {md_file}")
+    st.error("🚨 Error: Could not find " + str(md_file))

35-36: Use alt text for captions.

The image caption could use the alt text from the Markdown image syntax instead of just the filename.

-        image_name = line[start:end].split("/")[-1]
-        image_path = image_folder / image_name
+        image_path_str = line[start:end]
+        image_name = image_path_str.split("/")[-1]
+        image_path = image_folder / image_name
+        
+        # Extract alt text for caption
+        alt_start = line.find("![") + 2
+        alt_end = line.find("](")
+        caption = line[alt_start:alt_end] if alt_start < alt_end else image_name

And update the image display code:

-            st.image(str(image_path), caption=image_name, width=800)
+            st.image(str(image_path), caption=caption, width=800)

31-42: Handle image widths dynamically.

Currently, there's inconsistent image width handling (300px for the custom image vs 800px for all others). Consider making widths dynamic based on image content or user preferences.

         # Markdown-style image (e.g., ![alt text](path/to/image.png))
         elif line.strip().startswith("!["):
             start = line.find("(") + 1
             end = line.find(")")
             image_name = line[start:end].split("/")[-1]
             image_path = image_folder / image_name
+            
+            # Set appropriate width based on image type
+            if "configure" in image_name.lower():
+                width = 700  # Configuration screenshots often need more detail
+            elif "viewer" in image_name.lower() or "layout" in image_name.lower():
+                width = 800  # Full UI screenshots
+            else:
+                width = 600  # Default width for other images
 
             if image_path.exists():
-                st.image(str(image_path), caption=image_name, width=800)
+                st.image(str(image_path), caption=image_name, width=width)
             else:
                 st.warning(f"⚠️ Missing image: {image_name}")
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0bab4b0 and e38160c.

⛔ Files ignored due to path filters (20)
  • content/FLASHTnT/img.png is excluded by !**/*.png
  • content/FLASHTnT/img_1.png is excluded by !**/*.png
  • content/FLASHTnT/img_2.png is excluded by !**/*.png
  • static/images/FlashTnT_Viewer.png is excluded by !**/*.png
  • static/images/download_tnt.png is excluded by !**/*.png
  • static/images/flashTnT_configure2.png is excluded by !**/*.png
  • static/images/flashTnT_databaseupload.png is excluded by !**/*.png
  • static/images/flashTnT_upload.png is excluded by !**/*.png
  • static/images/flashdeconv_configure.png is excluded by !**/*.png
  • static/images/flashdeconv_download.png is excluded by !**/*.png
  • static/images/flashdeconv_example_data.png is excluded by !**/*.png
  • static/images/flashdeconv_layout_manager.png is excluded by !**/*.png
  • static/images/flashdeconv_manual_upload.png is excluded by !**/*.png
  • static/images/flashdeconv_run.png is excluded by !**/*.png
  • static/images/flashdeconv_upload.png is excluded by !**/*.png
  • static/images/flashdeconv_viewer.png is excluded by !**/*.png
  • static/images/flashtnt_configure.png is excluded by !**/*.png
  • static/images/flashtnt_run.png is excluded by !**/*.png
  • static/images/layoutmanager_tnt.png is excluded by !**/*.png
  • static/images/manual_result_upload.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • app.py (1 hunks)
  • content/TODO_Update/documentation.py (0 hunks)
  • content/user_guide.md (1 hunks)
  • content/user_guide.py (1 hunks)
💤 Files with no reviewable changes (1)
  • content/TODO_Update/documentation.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
content/user_guide.py (1)
src/common/common.py (1)
  • page_setup (91-228)
🪛 LanguageTool
content/user_guide.md

[style] ~30-~30: Consider using an alternative to strengthen your wording.
Context: ...* for deconvolution accuracy. 4. If you want to know more about each parameter go to...

(WANT_KEEN)


[style] ~134-~134: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... necessary FASTA database files. 4. Click "Add Database" to confirm the uploa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🪛 markdownlint-cli2 (0.17.2)
content/user_guide.md

30-30: Bare URL used
null

(MD034, no-bare-urls)


137-137: Heading style
Expected: atx; Actual: setext

(MD003, heading-style)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-openms
  • GitHub Check: build-full-app
🔇 Additional comments (2)
content/user_guide.md (1)

16-16:

Details

❌ Incorrect review comment

Verify image paths are correct.

The image path uses lowercase "images" while the Python code looks for them in "static/Images" (with uppercase I).

Check that the image paths match the actual directory structure:


🏁 Script executed:

#!/bin/bash
# Check image folder structure and case sensitivity
ls -la static/
if [ -d "static/Images" ]; then
  echo "Directory 'static/Images' exists"
  ls -la static/Images | head -n 10
elif [ -d "static/images" ]; then
  echo "Directory 'static/images' exists"
  ls -la static/images | head -n 10
else
  echo "Neither 'static/Images' nor 'static/images' directory exists"
fi

Length of output: 989


🏁 Script executed:

#!/bin/bash
# Search for any references to an uppercase “Images” folder in the codebase
rg -n "/static/Images"

Length of output: 22


Image path is correct – no uppercase “Images” directory detected

The markdown reference uses /static/images and the filesystem only contains static/images. A search for any /static/Images references in the codebase returned no matches, so there’s no case mismatch to address. No changes needed.

Likely an incorrect or invalid review comment.

app.py (1)

9-11: LGTM: Clean navigation integration.

The User Guide page is properly integrated into the navigation structure with appropriate icon and title.

t0mdavid-m and others added 2 commits April 24, 2025 11:11
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
content/user_guide.py (3)

21-39: Consider a more robust approach to Markdown rendering

The current line-by-line approach may not correctly render multi-line Markdown elements like lists, code blocks, or blockquotes that require context from surrounding lines.

Instead of processing line-by-line, consider:

-# Process Markdown content and replace image references
-for line in content:
-
-    # Markdown-style image (e.g., ![alt text](path/to/image.png))
-    if line.strip().startswith("!["):
-        start = line.find("(") + 1
-        end = line.find(")")
-        image_name = line[start:end].split("/")[-1]
-        image_path = image_folder / image_name
-
-        if image_path.exists():
-            st.image(str(image_path), caption=image_name, width=800)
-        else:
-            st.warning(f"⚠️ Missing image: {image_name}")
-
-    # Normal markdown text
-    else:
-        st.markdown(line)
+# Read the entire content
+markdown_content = ""
+
+# Process Markdown content and replace image references
+for line in content:
+    # Markdown-style image (e.g., ![alt text](path/to/image.png))
+    if line.strip().startswith("!["):
+        # First, render any accumulated markdown
+        if markdown_content:
+            st.markdown(markdown_content)
+            markdown_content = ""
+        
+        # Then handle the image
+        start = line.find("(") + 1
+        end = line.find(")")
+        image_name = line[start:end].split("/")[-1]
+        image_path = image_folder / image_name
+
+        if image_path.exists():
+            st.image(str(image_path), caption=image_name, width=800)
+        else:
+            st.warning(f"⚠️ Missing image: {image_name}")
+    # Normal markdown text
+    else:
+        markdown_content += line
+
+# Render any remaining markdown content
+if markdown_content:
+    st.markdown(markdown_content)

This approach accumulates regular Markdown content and only interrupts to render images, which should preserve proper Markdown formatting.


25-30: Improve image path extraction

The current image extraction logic is simple but might break with complex Markdown syntax. It doesn't handle cases with escaped parentheses or when multiple images are on the same line.

Consider using a more robust approach with regular expressions:

-    # Markdown-style image (e.g., ![alt text](path/to/image.png))
-    if line.strip().startswith("!["):
-        start = line.find("(") + 1
-        end = line.find(")")
-        image_name = line[start:end].split("/")[-1]
-        image_path = image_folder / image_name
+    # Markdown-style image (e.g., ![alt text](path/to/image.png))
+    import re
+    image_pattern = r'!\[.*?\]\((.*?)\)'
+    if line.strip().startswith("!["):
+        match = re.search(image_pattern, line)
+        if match:
+            image_path_str = match.group(1)
+            image_name = image_path_str.split("/")[-1]
+            image_path = image_folder / image_name

31-34: Consider responsive image sizing

Setting a fixed width of 800 pixels for all images might not be optimal for all screen sizes and images.

Consider using Streamlit's responsive options or conditionally setting width based on image size:

-        if image_path.exists():
-            st.image(str(image_path), caption=image_name, width=800)
-        else:
-            st.warning(f"⚠️ Missing image: {image_name}")
+        if image_path.exists():
+            # Either use responsive sizing or set a percentage of container width
+            st.image(str(image_path), caption=image_name, use_column_width="auto")
+        else:
+            st.warning(f"⚠️ Missing image: {image_name}")

The use_column_width="auto" option will make the image responsive while maintaining its aspect ratio.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e38160c and 30bb5c3.

📒 Files selected for processing (1)
  • content/user_guide.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
content/user_guide.py (1)
src/common/common.py (1)
  • page_setup (91-228)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-full-app
  • GitHub Check: build-openms
🔇 Additional comments (2)
content/user_guide.py (2)

1-7: Nicely structured page setup! 👍

Good job using the common page_setup() function for consistent UI configuration across the app, and setting a clear title for the user guide.


13-19: Good error handling for missing files

The implementation properly handles the case where the Markdown file doesn't exist and provides a clear error message to the user.

@t0mdavid-m t0mdavid-m merged commit 7acbb09 into develop Apr 28, 2025
5 checks passed
@t0mdavid-m t0mdavid-m deleted the feature/user-guide-update branch May 7, 2025 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants