Skip to content

Update readme.md with moesif implementation instructions and configs#150

Open
Akila94 wants to merge 2 commits intowso2:mainfrom
Akila94:moesif-analytics-instructions
Open

Update readme.md with moesif implementation instructions and configs#150
Akila94 wants to merge 2 commits intowso2:mainfrom
Akila94:moesif-analytics-instructions

Conversation

@Akila94
Copy link
Copy Markdown
Member

@Akila94 Akila94 commented Nov 14, 2025

Update readme.md with moesif implementation instructions and configs

  • This PR updates the readme file and sample configurations file with updated instructions including moesif analytics data publishing.

Summary by CodeRabbit

  • Documentation

    • Expanded analytics docs to cover publishing to OpenSearch and Moesif dashboards, with step-by-step setup, deployment guidance, dashboard import notes, and updated wording/notes.
    • Added Moesif-specific workflow, account/config guidance, and sample configuration snippets.
  • New Features

    • Added a publisher option for analytics enabling data delivery to OpenSearch and Moesif dashboards.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 14, 2025

Walkthrough

Documentation and a sample config were updated to add explicit publishing workflows for OpenSearch and Moesif dashboards; README reorganized into stepwise sections and a new publisher field was added to the sample TOML, resulting in an additional analytics block.

Changes

Cohort / File(s) Summary
Analytics Documentation
fhir-service/resources/analytics_README.md
Title changed to reference OpenSearch and Moesif Dashboards. Added explicit publishing sections for OpenSearch and for Moesif, stepwise setup (Docker guidance, dashboard import, account/config snippets), notes about data fields (x-jwt-assertion), guidance on Config.toml placement, and restructured headings. Wording adjusted to reference dashboards and publishing.
Analytics Configuration
fhir-service/resources/analytics_sample_config.toml
Added a new analytics configuration block including publisher = "opensearch" plus sample publisher settings (appId, url, frequency, batchSize, retries, store). Resulted in duplicated analytics table headers / two analytics blocks in the sample config.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant FHIR_Service as FHIR Service
  participant Interceptor as AnalyticsResponseInterceptor
  participant Publisher as Publisher Dispatcher
  participant OpenSearch as OpenSearch
  participant Moesif as Moesif

  Client->>FHIR_Service: API request/response
  FHIR_Service->>Interceptor: emit analytics event (includes x-jwt-assertion)
  Interceptor->>Publisher: enqueue/publish event (reads Config.toml publisher)
  alt publisher == "opensearch"
    Publisher->>OpenSearch: bulk index events (async)
    OpenSearch-->>Publisher: ack / error
  else publisher == "moesif"
    Publisher->>Moesif: send batched events (HTTP)
    Moesif-->>Publisher: ack / error
  end
  Publisher-->>Interceptor: publish status
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify duplicated TOML table headers in fhir-service/resources/analytics_sample_config.toml do not break parser or clarify intended single vs multiple tables.
  • Confirm sample publisher fields (appId, url, frequency, batchSize, retries, store) match runtime configuration keys and expected types.
  • Check README instructions (Docker OpenSearch commands, dashboard import steps) for accuracy and any missing required steps or credentials exposure.

Poem

🐰 I hopped through docs with a twitch and a grin,
Added two paths where the metrics flow in.
To OpenSearch I dug, to Moesif I leapt,
Dashboards awake from the data we've kept. 📈✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and lacks most required template sections such as Purpose, Goals, Approach, User stories, Release notes, Documentation, and others specified in the repository template. Complete the PR description by filling out all required template sections including Purpose, Goals, Approach, User stories, Release notes, Documentation, and other applicable sections to provide comprehensive context for review.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: updating documentation with Moesif implementation instructions and configurations alongside existing OpenSearch support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fhir-service/resources/analytics_sample_config.toml (1)

1-50: Remove duplicate TOML table header [ballerinax.health.fhirr4.analytics].

The configuration has conflicting definitions: lines 1–13 define the original [ballerinax.health.fhirr4.analytics] block with OpenSearch credentials, and lines 17–20 redefine the same table with only a publisher field. In TOML, redefining a table header invalidates the first definition or causes a parse error. The refactoring should consolidate these into a single, coherent analytics block with the publisher field, moving OpenSearch-specific credentials to [ballerinax.health.fhirr4.openSearch].

Apply this diff to fix the TOML structure:

-# Sample configuration for Patient Access API Metrics with FHIR R4 Analytics
-[ballerinax.health.fhirr4.analytics]
-enabled = true
-attributes = ["fhirUser", "client_id", "iss"]
-url = "http://localhost:9200/patient_access/_doc" # Opensearch format: <hostname>/<index>/_doc
-username = "admin"
-password = "Strong@pass@432"
-
-[ballerinax.health.fhirr4.analytics.moreInfo]
-enabled = true
-url = "http://localhost:8082/more_info"
-username = "admin"
-password = "MoreInfo@987"
-
-
 # Sample configuration for Patient Access API Metrics with FHIR R4 Analytics
 [ballerinax.health.fhirr4.analytics]
 enabled = true # Enable or disable analytics publishing
 attributes = ["fhirUser", "client_id", "iss"]
 publisher = "opensearch" # applicable values are either "moesif" or "opensearch"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c826bcf and 9ef5b65.

📒 Files selected for processing (2)
  • fhir-service/resources/analytics_README.md (3 hunks)
  • fhir-service/resources/analytics_sample_config.toml (1 hunks)
🧰 Additional context used
🪛 LanguageTool
fhir-service/resources/analytics_README.md

[grammar] ~69-~69: Ensure spelling is correct
Context: ...Opensearch index fields will be created acording to the attributes sent in the first log...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~82-~82: Ensure spelling is correct
Context: ...esif application and copy the generated applicaiton ID. #### Step 2: Run the patient-acces...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~113-~113: Ensure spelling is correct
Context: ...abled. Once the job is started, all the pupublished data in the database will be published ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🪛 markdownlint-cli2 (0.18.1)
fhir-service/resources/analytics_README.md

80-80: Heading levels should only increment by one level at a time
Expected: h3; Actual: h4

(MD001, heading-increment)

🔇 Additional comments (1)
fhir-service/resources/analytics_README.md (1)

1-116: Documentation restructuring looks comprehensive.

The README has been well-restructured to support both OpenSearch and Moesif dashboards. The documentation clearly separates configuration steps for each platform, provides sample configurations, and explains the dual-dashboard publishing workflow. The alignment with the configuration file changes (analytics publisher field selection) is logical and well-documented.

Copy link
Copy Markdown

@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 (1)
fhir-service/resources/analytics_README.md (1)

1-115: Standardize capitalization of "OpenSearch" product name.

The product name appears as both "Opensearch" (lowercase 's') and "OpenSearch" (capitalized 'S'). The official product name is "OpenSearch" with a capital 'S'. Standardizing this throughout improves professional presentation and clarity.

Search and replace instances to use consistent capitalization:

  • Line 1, 40, 52, 75: Change "Opensearch" → "OpenSearch"
  • Line 61: Change open_search_dashboard_hostopensearch_dashboard_host (for consistency in variable naming)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ef5b65 and f940bbd.

📒 Files selected for processing (1)
  • fhir-service/resources/analytics_README.md (3 hunks)

Comment on lines +75 to +76
### Sample Opensearch Dashboard for Patient Access API Metrics
![Sample Dashboard](analytics_sample_opensearch_dashboard.png)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify image file exists and is properly referenced.

The image reference uses a relative path. Ensure the file analytics_sample_opensearch_dashboard.png exists in the same directory as this README, otherwise the image won't render in documentation viewers.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the referenced image file and other auxiliary files exist.

# Check if image file exists
fd "analytics_sample_opensearch_dashboard.png" fhir-service/resources/

# List all files in the analytics resources directory to confirm structure
ls -la fhir-service/resources/ | grep -E "(analytics|opensearch|moesif)"

Length of output: 584



---

🏁 Script executed:

```shell
#!/bin/bash
# Description: Check for capitalization inconsistency in "Opensearch" vs "OpenSearch"

# Search for both variants in the analytics_README.md file
echo "=== Searching for 'Opensearch' (lowercase 's') ==="
rg -n "Opensearch" fhir-service/resources/analytics_README.md

echo ""
echo "=== Searching for 'OpenSearch' (correct capitalization) ==="
rg -n "OpenSearch" fhir-service/resources/analytics_README.md

echo ""
echo "=== Product name in section headings and references ==="
rg -n "Sample (Opensearch|OpenSearch)" fhir-service/resources/analytics_README.md

Length of output: 2398


Verify image file and fix product name capitalization.

The image file analytics_sample_opensearch_dashboard.png exists and will render correctly. However, the product name capitalization is inconsistent throughout the document. The official product name is "OpenSearch" (capital 'S'), but most references use "Opensearch" (lowercase 's'). Update all instances of "Opensearch" to "OpenSearch" for consistency and accuracy—this includes line 75's subsection heading and 14+ other occurrences throughout the file.

🤖 Prompt for AI Agents
In fhir-service/resources/analytics_README.md around lines 75-76, the subsection
heading and many other occurrences use the incorrect product name capitalization
"Opensearch"; the image file analytics_sample_opensearch_dashboard.png is valid
and does not need change. Replace every instance of "Opensearch" (about 14+
occurrences) with the correct "OpenSearch" throughout the file (including the
subsection heading at line 75), and update any filenames or alt text only if
they intentionally reference the product name (leave the existing image filename
unchanged unless you choose to rename it consistently).

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.

1 participant