File size: 4,656 Bytes
073bb25 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
import uuid
import numpy as np
from sqlalchemy.exc import IntegrityError, SQLAlchemyError
from backend.scripts.db.session import SessionLocal
from backend.scripts.migration_schemas.resources_models import Resource
def seed_resources():
session = SessionLocal()
resources = [
Resource(
id=str(uuid.uuid4()),
name="Primary Crisis Hotline",
phone="1010",
operation_hours="24/7",
description="Operated by the Bhutan Youth Development Fund (YDF) and the Ministry of Health, this helpline offers support for mental health issues and suicide prevention.",
category="mental health",
type="helpline",
source="bhutanyouth.org",
website="https://bhutanyouth.org"
),
Resource(
id=str(uuid.uuid4()),
name="Emergency Line",
phone="112",
operation_hours="24/7",
description="The national emergency number is for immediate assistance and is accessible via mobile and landline.",
category="emergency",
type="helpline",
source="National Emergency Services",
website="moh.gov.bt"
),
Resource(
id=str(uuid.uuid4()),
name="Mental Health Support Line",
phone="1098",
operation_hours="24/7",
description="National helpline for children and vulnerable groups. Provides mental health support.",
category="mental health, children",
type="helpline",
source="National Helpline Directory",
),
Resource(
id=str(uuid.uuid4()),
name="Sherig Counselling Services (MoE)",
phone="17861294",
operation_hours="Weekdays 9am–5pm",
description="Counselling helpline for students and youth, staffed by trained school counselors.",
category="youth, education, counseling",
source="moe.gov.bt",
website="https://sites.google.com/moe.gov.bt/sherigcounsellingservices",
type = "helpline"
),
Resource(
id=str(uuid.uuid4()),
name="PEMA (Psychosocial Education and Mental Health Awareness)",
phone="1010",
website="https://thepema.gov.bt/",
description="PEMA is the national nodal agency for mental health promotion and services, offering counselling, crisis intervention, and rehabilitation. They also have a helpline and offer walk-in services.",
type="organization"
),
Resource(
id=str(uuid.uuid4()),
name="RENEW (Respect, Educate, Nurture, and Empower Women)",
phone="+975 2 332 159",
website="https://renew.org.bt/",
description="Founded by Her Majesty Gyalyum Sangay Choden Wangchuck in 2004, RENEW is a non-profit organization supporting women.",
type="organization"
),
Resource(
id=str(uuid.uuid4()),
name="Jigme Dorji Wangchuck National Referral Hospital",
phone="+975 17 32 24 96",
website="https://jdwnrh.gov.bt/",
description="This hospital has a psychiatric ward, providing specialized mental health services.",
type="organization"
),
Resource(
id=str(uuid.uuid4()),
name="Bhutan Board for Certified Counselors (BBCC)",
description="Accredits and supports professional counselors in Bhutan. Promotes ethical and culturally sensitive counseling.",
phone=None,
website="https://www.counselingbhutan.com",
address="Thimphu",
type="organization"
),
Resource(
id=str(uuid.uuid4()),
name="Institute of Traditional Medicine Services",
description="Provides traditional Bhutanese medical treatments, including mental and spiritual healing.",
phone=None,
website=None,
address="Langjophakha, Thimphu",
type="organization"
)
]
try:
for resource in resources:
session.add(resource)
session.commit()
print(f"✅ Inserted {len(resources)} resources into DB.")
except IntegrityError as e:
session.rollback()
print(f"⚠️ Duplicate detected, skipping existing entries: {str(e)}")
except SQLAlchemyError as e:
session.rollback()
print(f"❌ Failed to seed: {str(e)}")
finally:
session.close()
def main():
seed_resources()
if __name__ == "__main__":
main()
|