# Project export: Settling

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: Immigrants/refugees face language barriers, legal complexities, and difficulties in finding employment and support networks. We aim to fill this gap by offering personalized assistance.
- Devpost: https://devpost.com/software/settling
- GitHub: https://github.com/PopsicleSnow/CalHacks-Settling
- Video: https://www.youtube.com/embed/Xc8O5xi_DI0?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 1 GitHub contributor(s) — Kuljit Uppal (3 commits)

## Devpost submission (written by the team)

### Inspiration

The inspiration behind Settling stems from the real-life challenges faced by immigrants and refugees. We observed that many existing platforms offer generic information, but there’s a clear gap when it comes to _ personalized, long-term solutions _ . Immigrants encounter obstacles like language barriers, legal confusion, job market restrictions, and isolation. We wanted to create a tool that not only provides resources but grows with the user, adapting to their changing needs as they settle and integrate into a new country. Since many of us have personal experience dealing with immigration, from finding jobs to dealing with paperwork, this project is close to our hearts. It aims to solve many of the problems we and others we know have encountered.

### What it does

Settling is a personalized immigration and integration assistant designed to guide users through every stage of their journey. It offers tailored support in several key areas: Personalized chatbot interface: Engages users with compassion, offering advice and answering questions. Job matching and career planning: Recommends job opportunities based on personal details such as visa status, education, skills, and location. Documentation assistance: Provides personalized guidance for legal paperwork, with interactive document summaries and next steps for visa processing. Educational resources: Recommends relevant courses and training programs to help users upskill for better job opportunities.

### How we built it

We built Settling using a combination of cutting-edge technologies: Frontend/Backend: Developed with Reflex for scalability and flexibility. Database: Firebase was used for secure user authentication and storing personalized data. APIs: We implemented OpenAI’s GPT-4 and Google's Gemini Pro to provide a fully personalized experience from onboarding to job recommendations.

### Challenges we ran into

One of the main challenges was integrating multiple APIs into one seamless user experience which proved tricky, as we had to align them to the user’s data without overwhelming the app’s performance. Additionally, fine-tuning the job-matching algorithm to account for visa complexities was a time-consuming process as well as fully personalizing career paths and document analysis.

### Accomplishments we're proud of

We’re incredibly proud of the personalized job-matching and documentation assistance features. These offer practical and personalized help for non-tech savvy individuals, directly addressing some of the most stressful parts of the immigration process. We used Reflex to build a secure and scalable backend to protect sensitive user data, which was a major accomplishment.

### What we learned

We learned a great deal about the complexities immigrants face beyond just paperwork—especially the difficulties in navigating job markets and connecting with community support. Some of our group members have gone through the same process, so a lot of what we already know was reinforced. On the technical side, we gained valuable experience in integrating multiple services and APIs, improving our skills in machine learning, natural language processing, and secure database management.

### What's next

Moving forward, we plan to refine Settling based on user feedback from the hackathon. We want to expand the job-matching feature to include more industries and improve our algorithm to account for regional visa restrictions. We would also like to integrate a multilingual text-to-speech web socket based tool that will make user conversations more authentic. Additionally, we aim to broaden our partnerships with community organizations to create an even more robust support network to connect immigrants with employers. Long-term, we see Settling evolving into a tool that can be customized for use in various countries, adapting to the unique immigration policies and job markets worldwide.

## README (from the GitHub repository)

# Settling
Immigrants and refugees face numerous challenges when settling in a new country, including language barriers, legal complexities, and difficulties in finding suitable employment and support networks. While existing resources provide general information, there's a clear need for a more personalized, comprehensive, and long-term solution. Our app aims to fill this gap by offering tailored assistance throughout the integration process, helping immigrants and refugees thrive in their new home in the long term. 

## Installation
- Add API keys to ENV file  
- Add `firebase-credentials.js`
- `pip install -r requirements`  
- `reflex run`  

## TODO
- delete firebase and use the same project as gemini
- refactor lazy loading
- fresh ui
- add translation feature

## Detected evidence (automated analysis)

Indexed codebase: 23 recognized source files, 67 KB.
- FastAPI (technology) — detected in the code
- Flask (technology) — detected in the code
- OpenAI (technology) — detected in the code
- Python (language) — detected in the code
- Redis (technology) — detected in the code
- Firebase (technology) — claimed on Devpost, not found in the code
- Google Gemini (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (27 of 27)

```
.gitignore
.idea/.gitignore
.idea/CalHacks-2024.iml
.idea/libraries/my_test_package.xml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
CalHacks_2024/__init__.py
CalHacks_2024/CalHacks_2024.py
CalHacks_2024/career_planning.py
CalHacks_2024/career_planning(old).py
CalHacks_2024/career_resources.py
CalHacks_2024/CareerPlanGraph.py
CalHacks_2024/example_documentation_chatbot.py
CalHacks_2024/layout.py
CalHacks_2024/react_oauth_google.py
chatapp/_init_.py
chatapp/chatbot.py
chatapp/state.py
chatapp/style.py
documentation/documentation_components.py
documentation/documentation_help.py
jobs/job_scraper.py
jobs/jobs_components.py
README.md
requirements.txt
rxconfig.py
```

### Dependencies

- requirements.txt: alembic@==1.13.3, annotated-types@==0.7.0, anyio@==4.6.2.post1, apify_client@==1.8.1, apify_shared@==1.1.2, backports.tarfile@==1.2.0, bidict@==0.23.1, blinker@==1.8.2, build@==1.2.2.post1, CacheControl@==0.14.0, cachetools@==5.5.0, certifi@==2024.8.30, cffi@==1.17.1, chardet@==5.2.0, charset-normalizer@==3.4.0, click@==8.1.7, cryptography@==43.0.3, distro@==1.9.0, docutils@==0.21.2, fastapi@==0.115.2, firebase-admin@==6.5.0, Flask@==3.0.3, google-ai-generativelanguage@==0.6.10, google-api-core@==2.21.0, google-api-python-client@==2.149.0, google-auth@==2.35.0, google-auth-httplib2@==0.2.0, google-cloud-core@==2.4.1, google-cloud-firestore@==2.19.0, google-cloud-storage@==2.18.2, google-crc32c@==1.6.0, google-generativeai@==0.8.3, google-resumable-media@==2.7.2, googleapis-common-protos@==1.65.0, grpcio@==1.67.0, grpcio-status@==1.67.0, gunicorn@==23.0.0, h11@==0.14.0, httpcore@==1.0.6, httplib2@==0.22.0, httpx@==0.27.2, idna@==3.10, importlib_metadata@==8.5.0, itsdangerous@==2.2.0, jaraco.classes@==3.4.0, jaraco.context@==6.0.1, jaraco.functools@==4.1.0, Jinja2@==3.1.4, jiter@==0.6.1, keyring@==25.4.1, lazy_loader@==0.4, Mako@==1.3.5, markdown-it-py@==3.0.0, MarkupSafe@==3.0.2, mdurl@==0.1.2, more-itertools@==10.5.0, msgpack@==1.1.0, nh3@==0.2.18, openai@==1.52.0, packaging@==24.1, pillow@==11.0.0, pipdeptree@==2.16.2, pkginfo@==1.10.0, platformdirs@==4.3.6, proto-plus@==1.24.0, protobuf@==5.28.2, psutil@==6.1.0, pyasn1@==0.6.1, pyasn1_modules@==0.4.1, pycparser@==2.22, pycryptodome@==3.21.0, pydantic@==2.9.2, pydantic_core@==2.23.4, Pygments@==2.18.0, PyJWT@==2.9.0, pyparsing@==3.2.0, PyPDF2@==3.0.1, pyproject_hooks@==1.2.0, python-dateutil@==2.9.0.post0, python-dotenv@==1.0.1, python-engineio@==4.10.1, python-multipart@==0.0.12, python-socketio@==5.11.4, readme_renderer@==44.0, redis@==5.1.1, reflex@==0.6.3, reflex-chakra@==0.6.2, reflex-hosting-cli@==0.1.13, reportlab@==4.2.5, requests@==2.32.3, requests-toolbelt@==1.0.0, rfc3986@==2.0.0, rich@==13.9.2, rsa@==4.9, shellingham@==1.5.4, simple-websocket@==1.1.0, six@==1.16.0, sniffio@==1.3.1, SQLAlchemy@==2.0.36, sqlmodel@==0.0.22, starlette@==0.40.0, starlette-admin@==0.14.1, tabulate@==0.9.0, tomlkit@==0.13.2, tqdm@==4.66.5, twine@==5.1.1, typer@==0.12.5, typing_extensions@==4.12.2, uritemplate@==4.1.1, urllib3@==2.2.3, uvicorn@==0.32.0, websockets@==13.1, Werkzeug@==3.0.4, wrapt@==1.16.0, wsproto@==1.2.0, zipp@==3.20.2

### Recent commits (newest first)

- readme TODO
- use gronq instead of open ai
- remove file
- files upload
- Initial commit

## Key source files (fetched from GitHub, selected and truncated for size)

### requirements.txt

```
alembic==1.13.3
annotated-types==0.7.0
anyio==4.6.2.post1
apify_client==1.8.1
apify_shared==1.1.2
backports.tarfile==1.2.0
bidict==0.23.1
blinker==1.8.2
build==1.2.2.post1
CacheControl==0.14.0
cachetools==5.5.0
certifi==2024.8.30
cffi==1.17.1
chardet==5.2.0
charset-normalizer==3.4.0
click==8.1.7
cryptography==43.0.3
distro==1.9.0
docutils==0.21.2
fastapi==0.115.2
firebase-admin==6.5.0
Flask==3.0.3
google-ai-generativelanguage==0.6.10
google-api-core==2.21.0
google-api-python-client==2.149.0
google-auth==2.35.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.1
google-cloud-firestore==2.19.0
google-cloud-storage==2.18.2
google-crc32c==1.6.0
google-generativeai==0.8.3
google-resumable-media==2.7.2
googleapis-common-protos==1.65.0
grpcio==1.67.0
grpcio-status==1.67.0
gunicorn==23.0.0
h11==0.14.0
httpcore==1.0.6
httplib2==0.22.0
httpx==0.27.2
idna==3.10
importlib_metadata==8.5.0
itsdangerous==2.2.0
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
Jinja2==3.1.4
jiter==0.6.1
keyring==25.4.1
lazy_loader==0.4
Mako==1.3.5
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
more-itertools==10.5.0
msgpack==1.1.0
nh3==0.2.18
openai==1.52.0
packaging==24.1
pillow==11.0.0
pipdeptree==2.16.2
pkginfo==1.10.0
platformdirs==4.3.6
proto-plus==1.24.0
protobuf==5.28.2
psutil==6.1.0
pyasn1==0.6.1
pyasn1_modules==0.4.1
pycparser==2.22
pycryptodome==3.21.0
pydantic==2.9.2
pydantic_core==2.23.4
Pygments==2.18.0
PyJWT==2.9.0
pyparsing==3.2.0
PyPDF2==3.0.1
pyproject_hooks==1.2.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-engineio==4.10.1
python-multipart==0.0.12
python-socketio==5.11.4
readme_renderer==44.0
redis==5.1.1
reflex==0.6.3
reflex-chakra==0.6.2
reflex-hosting-cli==0.1.13
reportlab==4.2.5
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==13.9.2
rsa==4.9
shellingham==1.5.4
simple-websocket==1.1.0
six==1.16.0
sniffio==1.3.1
SQLAlchemy==2.0.36
sqlmodel==0.0.22
starlette==0.40.0
starlette-admin==0.14.1
tabulate==0.9.0
tomlkit==0.13.2
tqdm==4.66.5
twine==5.1.1
typer==0.12.5
typing_extensions==4.12.2
uritemplate==4.1.1
urllib3==2.2.3
uvicorn==0.32.0
websockets==13.1
Werkzeug==3.0.4
wrapt==1.16.0
wsproto==1.2.0
zipp==3.20.2

```

### rxconfig.py

```python
import reflex as rx

config = rx.Config(
    app_name="CalHacks_2024",
)
```

### .idea/vcs.xml

```xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="VcsDirectoryMappings">
    <mapping directory="" vcs="Git" />
  </component>
</project>
```

### .idea/modules.xml

```xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/CalHacks-2024.iml" filepath="$PROJECT_DIR$/.idea/CalHacks-2024.iml" />
    </modules>
  </component>
</project>
```

### jobs/jobs_components.py

```python
import reflex as rx
from rxconfig import config
from jobs.job_scraper import State
from chatapp import style

def jobs() -> rx.Component:
    return rx.center(
        rx.vstack(
            rx.foreach (
                State.job_results,
                lambda job: rx.text(job),
            ),
            width="100%",
        )
    )


```

### CalHacks_2024/react_oauth_google.py

```python
import reflex as rx


class GoogleOAuthProvider(rx.Component):
    library = "@react-oauth/google"
    tag = "GoogleOAuthProvider"

    client_id: rx.Var[str]

class GoogleLogin(rx.Component):
    library = "@react-oauth/google"
    tag = "GoogleLogin"

    on_success: rx.EventHandler[lambda data: [data]]
    on_failure: rx.EventHandler[lambda error: [error]]

    
```

### .idea/misc.xml

```xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Black">
    <option name="sdkName" value="Python 3.9" />
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="Python 3.9" project-jdk-type="Python SDK">
    <output url="file://$PROJECT_DIR$/out" />
  </component>
</project>
```

### chatapp/style.py

```python
# style.py
import reflex as rx

# Common styles for questions and answers.
shadow = "rgba(0, 0, 0, 0.15) 0px 2px 8px"
chat_margin = "20%"
message_style = dict(
    padding="1em",
    border_radius="5px",
    margin_y="0.5em",
    box_shadow=shadow,
    max_width="30em",
    display="inline-block",
)

# Set specific styles for questions and answers.
question_style = message_style | dict(
    margin_left=chat_margin,
    background_color=rx.color("gray", 4),
)
answer_style = message_style | dict(
    margin_right=chat_margin,
    background_color=rx.color("accent", 8),
)

# Styles for the action bar.
input_style = dict(
    border_width="1px",
    padding="1em",
    box_shadow=shadow,
    width="350px",
    height="50px"
)
button_style = dict(
    background_color=rx.color("accent", 10),
    box_shadow=shadow,
    height="50px",
    width="100px"
)
```

### CalHacks_2024/career_resources.py

```python
import requests

def fetch_courses(query):
    """Fetch training courses based on interests using external APIs"""
    coursera_api_url = "https://api.coursera.org/api/courses.v1?q=search&query={}"
    response = requests.get(coursera_api_url.format(query))
    courses = []

    if response.status_code == 200:
        elements = response.json().get('elements', [])
        for course in elements:
            courses.append({
                'name': course.get('name'),
                'link': f"https://www.coursera.org/learn/{course.get('slug')}",
                'duration': course.get('workload', 'Unknown')
            })
    return courses

def fetch_local_training_centers(location, interest):
    """Fetch local training centers using Google Maps API"""
    google_maps_api_url = "https://maps.googleapis.com/maps/api/place/textsearch/json?query={}+in+{}&key=YOUR_GOOGLE_MAPS_API_KEY"
    response = requests.get(google_maps_api_url.format(interest, location))
    centers = []

    if response.status_code == 200:
        results = response.json().get('results', [])
        for result in results:
             centers.append({
                'name': result.get('name'),
                'address': result.get('formatted_address')
            })
    return centers

def fetch_job_growth_data(career_path):
    """Fetch job market growth data using Bureau of Labor Statistics or similar API"""
    bls_api_url = "https://api.bls.gov/publicAPI/v2/timeseries/data/{}"
    # Example placeholder for BLS series id related to the career path
    response = requests.get(bls_api_url.format(career_path))
    growth_data = {}

    if response.status_code == 200:
        growth_data = response.json().get('Results', {}).get('series', [{}])[0]
    return growth_data

```

### chatapp/chatbot.py

```python
import reflex as rx
from rxconfig import config
from chatapp.state import State
from chatapp import style

def qa(question: str, answer: str) -> rx.Component:
    return rx.cond(
        question == "",
        rx.box(
            rx.text(answer, style=style.answer_style),
            text_align="left",
        ),
        rx.cond(
            answer == "",
            rx.box(rx.text(question, style=style.question_style), text_align="right"),
            rx.box(
                rx.box(
                    rx.text(question, style=style.question_style),
                    text_align="right",
                ),
                rx.box(
                    rx.text(answer, style=style.answer_style),
                    text_align="left",
                ),
                margin_y="1em",
            )
        )
    )
    
    

def chat() -> rx.Component:
    return rx.box(
        rx.foreach(
            State.chat_history,
            lambda messages: qa(messages[0], messages[1]),
        )
    )

def reset_button():
    return rx.button(
        "Reset/Update Profile",
        on_click=State.reset_chat,
        color_scheme="orange",
        style=style.button_style
    )

def action_bar() -> rx.Component:
    return rx.hstack(
        rx.input(
            value=State.question,
            placeholder="Answer the question above.",
            on_change=State.set_question,
            style=style.input_style,
        ),
        rx.button(
            "Respond",
            on_click=State.answer,
            style=style.button_style,
        ),
        reset_button()
    )

def chatmodel() -> rx.Component:
    return rx.center(
        rx.vstack(
            chat(),
            action_bar(),
            align="center",
            margin_top="20vh"
        )
    )

__all__ = ["chatmodel"]


```

[10 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]