Skip to content

Add questionnaire-json skill for generating CARE Questionnaire …#16308

Draft
yash-learner wants to merge 1 commit intodevelopfrom
add-questionniare-json-skill
Draft

Add questionnaire-json skill for generating CARE Questionnaire …#16308
yash-learner wants to merge 1 commit intodevelopfrom
add-questionniare-json-skill

Conversation

@yash-learner
Copy link
Copy Markdown
Member

@yash-learner yash-learner commented Apr 23, 2026

Proposed Changes

https://openhealthcarenetwork.atlassian.net/browse/ENG-37?focusedCommentId=10303

Fixes #issue_number

  • Change 1
  • Change 2
  • Additional context if needed

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Copilot AI review requested due to automatic review settings April 23, 2026 22:25
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 23, 2026

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit f6bc34a
🔍 Latest deploy log https://app.netlify.com/projects/care-ohc/deploys/69ea9c6cefd3400008fcb8af
😎 Deploy Preview https://deploy-preview-16308.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fba06531-3ff5-4197-ba38-c2d5f590c0e9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-questionniare-json-skill

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

@github-actions
Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@github-actions
Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ⏭️ Skipped

No test-related files were changed in this PR.

Tests are skipped when changes don't affect:

  • tests/**
  • src/**
  • package.json
  • playwright.config.ts

Run: #8498

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new GitHub Copilot “skill” document to guide generation of CARE-compatible Questionnaire JSON, intended to be importable via the care_fe Questionnaire import flow.

Changes:

  • Introduces .github/skills/questionnaire-json.skill.md with a detailed questionnaire JSON schema, authoring workflows (one-shot vs guided), and coding guidance (LOINC/SNOMED/UCUM).
  • Documents enable_when usage, structured questions, and styling/repeats conventions.
  • Provides a worked example questionnaire JSON and “hard rules” for code/value set usage.

Comment on lines +4 to +25
Generate valid CARE Questionnaire JSON (importable via care_fe) from a
short spec or via a guided step-by-step interview. Handles schema,
enable_when, structured questions, and SNOMED/LOINC/UCUM coding via
Snowstorm.
when_to_use: >
User asks to "generate a questionnaire", "build a form", "create
questionnaire JSON", or wants help authoring/importing a CARE
questionnaire.
---

# CARE Questionnaire JSON Generation

---
applyTo:
- "src/components/Questionnaire/**"
- "src/types/questionnaire/**"
- "**/*.questionnaire.json"
description: >
Generate valid CARE Questionnaire JSON that can be imported into care_fe via
the questionnaire import flow. Covers schema, question types, enable_when,
structured questions, choice/quantity coding (SNOMED CT, LOINC, UCUM via
Snowstorm / FHIR R4 valuesets), and two authoring flows (one-shot + guided).
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This file has two separate YAML frontmatter blocks (the initial name/description/when_to_use block and this later applyTo/description block). Most tooling that consumes frontmatter expects a single block at the top; consider merging these into one frontmatter section so the skill metadata and applyTo are reliably parsed.

Suggested change
Generate valid CARE Questionnaire JSON (importable via care_fe) from a
short spec or via a guided step-by-step interview. Handles schema,
enable_when, structured questions, and SNOMED/LOINC/UCUM coding via
Snowstorm.
when_to_use: >
User asks to "generate a questionnaire", "build a form", "create
questionnaire JSON", or wants help authoring/importing a CARE
questionnaire.
---
# CARE Questionnaire JSON Generation
---
applyTo:
- "src/components/Questionnaire/**"
- "src/types/questionnaire/**"
- "**/*.questionnaire.json"
description: >
Generate valid CARE Questionnaire JSON that can be imported into care_fe via
the questionnaire import flow. Covers schema, question types, enable_when,
structured questions, choice/quantity coding (SNOMED CT, LOINC, UCUM via
Snowstorm / FHIR R4 valuesets), and two authoring flows (one-shot + guided).
Generate valid CARE Questionnaire JSON that can be imported into care_fe via
the questionnaire import flow. Covers schema, question types, enable_when,
structured questions, choice/quantity coding (SNOMED CT, LOINC, UCUM via
Snowstorm / FHIR R4 valuesets), and two authoring flows (one-shot + guided).
when_to_use: >
User asks to "generate a questionnaire", "build a form", "create
questionnaire JSON", or wants help authoring/importing a CARE
questionnaire.
applyTo:
- "src/components/Questionnaire/**"
- "src/types/questionnaire/**"
- "**/*.questionnaire.json"

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +58
```jsonc
{
"version": "1.0", // string, defaults to "1.0", frozen
"slug": "questionnaire", // optional; kebab-case; 5–25 characters; must be unique on the server
"title": "Human readable title", // required, non‑empty after trim
"description": "", // optional
"type": "custom", // keep as "custom" unless told otherwise
"status": "draft", // "active" | "retired" | "draft"
"subject_type": "encounter", // "patient" | "encounter"
"styling_metadata": {}, // free dict, see §6
"questions": [ /* Question[] */ ],
"tags": [], // optional list of tag UUIDs
"organizations": [] // required on create via API; OMIT for
// import-only JSON unless the user gives
// explicit organization UUIDs
}
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The documented top-level JSON schema here doesn't match what care_fe actually exports/imports: QuestionnaireBase/QuestionnaireCreate don't include top-level type or styling_metadata, and the editor’s JSON download/import flow doesn’t round-trip tags/organizations from JSON (it maps only title/description/status/version/subject_type/questions/slug). To avoid users generating “valid” JSON that care_fe ignores/rejects, please align this section with src/types/questionnaire/questionnaire.ts and the import mapping in src/components/Questionnaire/QuestionnaireEditor.tsx (or explicitly call out which fields are ignored by care_fe import/export).

Copilot uses AI. Check for mistakes.
Comment on lines +225 to +231
Operator/type matrix:

- **boolean**: `exists`, `equals`, `not_equals` — `answer` is `true|false`.
- **string / choice**: `equals`, `not_equals` — `answer` is string.
- **integer / decimal / quantity**: `greater`, `less`,
`greater_or_equals`, `less_or_equals`, `equals`, `not_equals` —
`answer` is numeric.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

For boolean enable_when, this doc says answer should be true|false, but care_fe’s questionnaire editor stores boolean conditions as "Yes"/"No" strings and isQuestionEnabled normalizes boolean response values to "Yes"/"No" before comparing. If authors follow this doc and emit true/false, boolean enable_when will not evaluate correctly in the frontend. Please update the boolean row to use "Yes"/"No" (or document the frontend/backend discrepancy).

Copilot uses AI. Check for mistakes.
Comment on lines +245 to +246
`symptom`, `diagnosis`, `encounter`, `appointment`, `time_of_death`,
`files`, `charge_item`.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The structured question type allowlist is missing service_request, which is a supported StructuredQuestionType in care_fe (see STRUCTURED_QUESTIONS in src/components/Questionnaire/data/StructuredFormData.tsx). Please include it here so the skill doesn’t incorrectly reject/omit that valid structured type.

Suggested change
`symptom`, `diagnosis`, `encounter`, `appointment`, `time_of_death`,
`files`, `charge_item`.
`service_request`, `symptom`, `diagnosis`, `encounter`, `appointment`,
`time_of_death`, `files`, `charge_item`.

Copilot uses AI. Check for mistakes.
Comment on lines +307 to +315
You may query the project's Snowstorm server to validate or discover codes:

- Base: `http://165.22.211.144/fhir`
- List code systems: `GET /CodeSystem`
- Lookup: `GET /CodeSystem/$lookup?system=<system>&code=<code>`
- Search SNOMED: `GET /ValueSet/$expand?url=<valueset-url>&filter=<term>&count=20`
- Search LOINC: `GET /ValueSet/$expand?url=http://loinc.org/vs&filter=<term>`
- Search UCUM units: `GET /CodeSystem/$lookup?system=http://unitsofmeasure.org&code=<ucum>`

Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

This hard-codes a Snowstorm base URL to an HTTP IP address. That endpoint may not be stable/accessible for all contributors, and encouraging HTTP calls has security/operational downsides. Consider referencing the CARE valueset endpoints the app actually uses (valueSetApi.expand etc.) or documenting this as an example with a configurable/HTTPS URL.

Copilot uses AI. Check for mistakes.
@yash-learner yash-learner changed the title feat: add questionnaire-json skill for generating CARE Questionnaire … Addd questionnaire-json skill for generating CARE Questionnaire … Apr 23, 2026
@yash-learner yash-learner changed the title Addd questionnaire-json skill for generating CARE Questionnaire … Add questionnaire-json skill for generating CARE Questionnaire … Apr 26, 2026
@parvathyns-creator
Copy link
Copy Markdown

@nihal467 this looks fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants