Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaP700 committed Dec 8, 2024
2 parents 9aed496 + 4b58434 commit f13070a
Show file tree
Hide file tree
Showing 20 changed files with 1,432 additions and 1 deletion.
115 changes: 115 additions & 0 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will build, test, sign and package a WPF or Windows Forms desktop application
# built on .NET Core.
# To learn how to migrate your existing application to .NET Core,
# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework
#
# To configure this workflow:
#
# 1. Configure environment variables
# GitHub sets default environment variables for every workflow run.
# Replace the variables relative to your project in the "env" section below.
#
# 2. Signing
# Generate a signing certificate in the Windows Application
# Packaging Project or add an existing signing certificate to the project.
# Next, use PowerShell to encode the .pfx file using Base64 encoding
# by running the following Powershell script to generate the output string:
#
# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt'
#
# Open the output file, SigningCertificate_Encoded.txt, and copy the
# string inside. Then, add the string to the repo as a GitHub secret
# and name it "Base64_Encoded_Pfx."
# For more information on how to configure your signing certificate for
# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing
#
# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key".
# See "Build the Windows Application Packaging project" below to see how the secret is used.
#
# For more information on GitHub Actions, refer to https://github.com/features/actions
# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications,
# refer to https://github.com/microsoft/github-actions-for-desktop-apps

name: .NET Core Desktop

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

strategy:
matrix:
configuration: [Debug, Release]

runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

env:
Solution_Name: your-solution-name # Replace with your solution name, i.e. MyWpfApp.sln.
Test_Project_Path: your-test-project-path # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
Wap_Project_Directory: your-wap-project-directory-name # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package.
Wap_Project_Path: your-wap-project-path # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj.

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}")
$certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte)
# Create the app package by building and packaging the Windows Application Packaging project
- name: Create the app package
run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }}
env:
Appx_Bundle: Always
Appx_Bundle_Platforms: x86|x64
Appx_Package_Build_Mode: StoreUpload
Configuration: ${{ matrix.configuration }}

# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx

# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: MSIX Package
path: ${{ env.Wap_Project_Directory }}\AppPackages
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# Visual Studio cache/options directory
.vs/

# Node.js
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
.env
.env.local
.env.*.local

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
ENV/
.env
.venv
pip-log.txt
*.pot

# IDE
.idea/
.vscode/
*.swp
*.swo

# Misc
.DS_Store
Thumbs.db
214 changes: 214 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
# Sentimatrix

A real-time email sentiment analysis application built for the IIT Bombay TechFest Datamatics Hackathon. The solution combines RPA using TruBot for email processing with a modern WPF client and .NET Core backend for sentiment analysis.

## Features

- Automated email processing using TruBot RPA
- Real-time email sentiment analysis
- Desktop client with modern WPF interface
- SignalR for real-time updates
- Swagger API documentation
- Email content processing and analysis

## Tech Stack

### RPA Automation
- TruBot Designer for automation development
- TruBot Cockpit Personal for bot execution
- Email extraction and processing capabilities
- Seamless integration with backend API

### Backend (.NET 6.0)
- ASP.NET Core Web API
- SignalR for real-time communication
- Swagger/OpenAPI for API documentation
- HtmlAgilityPack for HTML processing
- Newtonsoft.Json for JSON handling

### Frontend (WPF .NET 6.0)
- WPF (Windows Presentation Foundation)
- SignalR Client for real-time updates
- Modern UI with sidebar design
- Newtonsoft.Json for JSON handling

## Prerequisites

- .NET 6.0 SDK or later
- Visual Studio 2022 or later (recommended)
- Windows 10/11 for running the WPF client
- TruBot Designer (for RPA development)
- TruBot Cockpit Personal (for bot execution)

## Setup Instructions

### TruBot Setup
1. Install TruBot Designer and TruBot Cockpit Personal
2. Import the provided bot project:
- Open TruBot Designer
- File > Import Project
- Select the `EmailProcessor` bot project
3. Configure email settings:
- Update email server configurations
- Set credentials in secure parameters
4. Test the bot:
- Run in TruBot Designer for development
- Deploy to TruBot Cockpit for production

### Backend Setup

1. Navigate to the backend directory:
```bash
cd backend
```

2. Restore NuGet packages:
```bash
dotnet restore
```

3. Build the project:
```bash
dotnet build
```

4. Run the API:
```bash
dotnet run
```

The API will start at `https://localhost:7777` and `http://localhost:5000`
- Swagger UI will be available at `https://localhost:7777/swagger`

### Frontend Setup

1. Navigate to the frontend directory:
```bash
cd frontend
```

2. Restore NuGet packages:
```bash
dotnet restore
```

3. Build the project:
```bash
dotnet build
```

4. Run the WPF application:
```bash
dotnet run
```

## Project Structure

### RPA Components
```
TruBot/
├── EmailProcessor/ # Main bot project
├── Objects/ # Reusable automation objects
└── Workflows/ # Email processing workflows
```

### Backend
```
backend/
├── Controllers/ # API endpoints
├── Hubs/ # SignalR hubs for real-time communication
├── Models/ # Data models and DTOs
├── Services/ # Business logic and services
├── Program.cs # Application entry point and configuration
└── *.json # Sample email data files
```

### Frontend
```
frontend/
├── App.xaml # Application resources and startup
├── MainWindow.xaml # Main application window UI
└── *.cs # Code-behind files
```

## Workflow

1. TruBot RPA Process:
- Bot monitors email inbox
- Extracts email content and metadata
- Processes attachments if present
- Sends data to backend API

2. Backend Processing:
- Receives email data from RPA bot
- Performs sentiment analysis
- Broadcasts results via SignalR
- Stores processed data

3. Frontend Display:
- Receives real-time updates
- Displays sentiment analysis results
- Provides interactive dashboard
- Shows historical data

## API Endpoints

The backend provides several API endpoints through its controllers:
- Swagger UI provides detailed API documentation
- Real-time updates through SignalR hub
- Email processing and sentiment analysis endpoints

## Development

### RPA Development
1. Open TruBot Designer
2. Modify email processing workflows
3. Test changes in development mode
4. Deploy to TruBot Cockpit when ready

### Backend Development
1. Open `SentimatrixAPI.csproj` in Visual Studio or your preferred IDE
2. API endpoints are defined in the Controllers directory
3. Real-time communication is handled through SignalR hubs
4. Services directory contains the business logic

### Frontend Development
1. Open `WpfSidebarApp.csproj` in Visual Studio
2. UI is defined in XAML files
3. Code-behind files contain the UI logic
4. SignalR client handles real-time updates

## Troubleshooting

1. RPA Issues:
- Verify TruBot services are running
- Check email server connectivity
- Validate credentials and permissions
- Review bot execution logs

2. Backend Issues:
- Check if ports 7777 or 5000 are available
- Ensure all NuGet packages are restored
- Check Swagger UI for API documentation

3. Frontend Issues:
- Verify backend is running and accessible
- Check SignalR connection status
- Ensure .NET 6.0 runtime is installed

4. Build Issues:
- Clean solution and rebuild
- Delete bin and obj folders
- Restore NuGet packages

## Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

## License

This project is licensed under the MIT License.
Loading

0 comments on commit f13070a

Please sign in to comment.