Skip to content

feat: implement AI crisis detection and emergency support intervention pipeline#173

Merged
Piyushydv08 merged 2 commits into
Piyushydv08:mainfrom
Sumitsutharss:feat/crisis-intervention-170
Jun 6, 2026
Merged

feat: implement AI crisis detection and emergency support intervention pipeline#173
Piyushydv08 merged 2 commits into
Piyushydv08:mainfrom
Sumitsutharss:feat/crisis-intervention-170

Conversation

@Sumitsutharss

Copy link
Copy Markdown
Contributor

🏷️ PR Type

  • ✨ Feature

🔗 Related Issue

Closes #170


📝 Rationale / Motivation

This PR integrates the existing AI crisis classification pipeline into the story submission workflow and provides proactive emergency support for users submitting high-risk stories.

The implementation improves platform safety by detecting crisis situations, storing classification metadata, and displaying immediate support resources when necessary.


✨ Description of Changes

Frontend

  • Added reusable EmergencyModal component
  • Integrated emergency intervention flow into ShareStory.tsx
  • Extracted helpline resources into shared constants

Backend

  • Enhanced classify-crisis.cjs to return structured classification data
  • Added support for risk_reason
  • Added robust JSON parsing and fallback handling

Screenshot

Screenshot 2026-06-05 175320

Firestore

  • Stores:

    • risk_level
    • risk_reason
    • classified_at

🧪 Testing Instructions

  1. Run the application using:
netlify dev
  1. Submit a normal story.

Expected:

  • Story saves successfully
  • No emergency modal displayed
  1. Submit a high-risk story such as:

"I am in immediate danger. Someone is threatening me. I need help urgently."

Expected:

  • Classified as HIGH risk
  • Emergency support modal displayed
  • Helpline resources shown
  • Firestore document saved with classification metadata

👀 Impact Assessment

  • Improves user safety and crisis response
  • Activates AI-powered intervention workflow
  • No breaking changes
  • No security regressions
  • Fully compatible with existing Firebase infrastructure

⚡ Checklist

  • Code follows project guidelines
  • Tested locally
  • Related issue linked
  • No new warnings/errors introduced
  • User-facing changes documented
  • Production build passes successfully

@netlify

netlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

👷 Deploy request for safevoiceforwomen pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b2fee08

@github-actions github-actions Bot added the gssoc'26 Contribution for Girlscript Summer of Code'26 label Jun 5, 2026
@Piyushydv08 Piyushydv08 merged commit 11ef655 into Piyushydv08:main Jun 6, 2026
3 checks passed
@Piyushydv08 Piyushydv08 added level:intermediate GSSoC: Intermediate difficulty - 35 pts type:feature GSSoC: New feature type:performance GSSoC: Performance improvements type:design GSSoC: UI or UX design changes type:refactor GSSoC: Code refactoring type:accessibility GSSoC: Accessibility improvements gssoc:approved PR approved by Admin labels Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR approved by Admin gssoc'26 Contribution for Girlscript Summer of Code'26 level:intermediate GSSoC: Intermediate difficulty - 35 pts type:accessibility GSSoC: Accessibility improvements type:design GSSoC: UI or UX design changes type:feature GSSoC: New feature type:performance GSSoC: Performance improvements type:refactor GSSoC: Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Implement AI Crisis Detection & Emergency Support Intervention Pipeline

2 participants