Skip to content

Commit

Permalink
Merge pull request #1 from alfcan/main
Browse files Browse the repository at this point in the history
Refactoring, Added Italian Conversation, and Docker Porting of csDetector
  • Loading branch information
gianwario authored Oct 3, 2023
2 parents d818958 + 94d384e commit bf10f35
Show file tree
Hide file tree
Showing 58 changed files with 3,693 additions and 874 deletions.
Binary file added .DS_Store
Binary file not shown.
38 changes: 38 additions & 0 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Python Tests

on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest and Coverage
run: |
pip install coverage
pytest tests --cov=src --cov-branch
env:
CI: true

- name: Check Branch Coverage
run: |
coverage report --fail-under=75
env:
CI: true
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"python.testing.pytestArgs": ["tests"],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none",
"python.analysis.typeCheckingMode": "basic"
}
89 changes: 89 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# CADOCS | CONTRIBUTING

## Commits

For contributing commit messagges must follow the standard of [Conventional Commits](https://www.conventionalcommits.org/).

Part of the following document is taken from https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines

### Commit Message Format

Each commit message consists of a `header`, a `body` and a `footer`. The header has a special format that includes a `type`, a `scope` and a `subject`:

```
<type>(<scope>): <summary>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```

The **header** is mandatory and the **scope** of the header must be omitted if the change is common among the packages, otherwise it's mandatory.

```
<type>(<scope>): <description>
│ │ │
│ │ └─⫸ A brief description of the commit
│ │
│ └─⫸ Commit Scope: api | service | chatbot | intent
└─⫸ Commit Type: build|ci|docs|feat|fix|refactor|impr|style|test
```

#### Description

- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end

#### Type

Must be one of the following:

- build: Changes that affect the build system or external dependencies
- ci: Changes to our CI configuration files and scripts
- docs: Documentation only changes
- feat: A new feature
- fix: A bug fix
- refactor: A code change that neither fixes a bug nor adds a feature
- impr: Improve an existing feature or existing dataset
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- test: Adding missing tests or correcting existing tests

### Scope

The scope must be the project section within the change is happening.

Supported scopes:

- `api`: scope to handling api connection for platforms
- `service`: scope to define support methods for complex functionalities
- `chatbot`: scope to handling chatbot functionalities
- `intent`: scope to resolve user intents

### Body

The **body** is optional. Just as in the **description**, use the imperative, present tense: "fix" not "fixed" nor "fixes".
The body should extend the content of the description.

### Footer

The footer is optional. The footer should contain the GitHub issue reference that this commit **Closes**.

## Branches

New branches must follow this format for their names: `<type>/<scope>/<description>`

- `type` and `scope` refer to the ones described in the Commits section.
- `description` must be a word representing the changes happening in the branch.

### Branching strategy

The branches will be defined as follows: a _main long branch_, named `dev`, which serves as the development branch; starting from this branch there will be four other long branches, each dedicated to a specific change request (CR). These branches will be named after the identifiers of the corresponding CRs.

In addition to the long branches, we will also use _short branches_, which are temporary branches created from the specific long branch of each CR and have a limited scope and duration.
Whenever a developer starts working on a specific feature or activity related to a CR, he or she creates a short branch for that particular activity.

Once the activity is completed, the changes will be merged into the corresponding _long branch_ (i.e., the CR-specific branch).

Once the integration of all subfunctions is complete, the CR-specific long branch will be merged with the `dev` branch.
95 changes: 17 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Specifically, this is the principal repository of the system and contains the co
<br/>

### Installation video
NOT Updated
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/ffdimm2CvO0/0.jpg)](https://www.youtube.com/watch?v=ffdimm2CvO0)
<br/>

Expand All @@ -28,14 +29,14 @@ The main elements of the repository are described below:

- src: it contains the source code of the conversational agent
- resources: it contains the survey created to build the dataset for the NLU model
- cadocs_chatbot_env.yaml: The Anaconda environment containing the needed dependencies to install CADOCS

## Other Tools

The entire CADOCS tool is composed of three modules:
- **CADOCS** (this repository): it is the Slack App used to interact with users.
- **CADOCS_NLU_Model** [link](https://github.com/vipenti/CADOCS_NLU_Model): it is the ML service used to interpret the users' intents.
- **csDetector** [link](https://github.com/gianwario/csDetector): the augmented and wrapped version of csDetector, used in our tool to detect community smells and other socio-technical metrics.
- **CADOCS_NLU_Model** [link](https://github.com/alfcan/CADOCS_NLU_Model): it is the ML service used to interpret the users' intents.
- **csDetector** [link](https://github.com/alfcan/csDetector): the augmented and wrapped version of csDetector, used in our tool to detect community smells and other socio-technical metrics.
The links are referred to our modified versions of the tools.

## Detectable Community Smells

Expand All @@ -52,7 +53,7 @@ The complete list of detectable community smells—through the use of csDetector
| Solution Defiance | The development community presents different levels of cultural and experience background, leading to the division of the community into similar subgroups with completely conflicting opinions. | NA |
| Truck Factor Smell | Risk of significant knowledge loss due to the turnover of developers resulting from the fact that project information and knowledge are concentrated in a minority of the developers. | NA |
| Unhealthy Interaction | Long delays in stakeholder communications cause slow, light and brief conversations and discussions. | NA |
| Toxic Communication | Long delays in stakeholder communications cause slow, light and brief conversations and discussions. | NA |
| Toxic Communication | Toxic interactions and conflicting opinions among developers could push them to leave the project. | NA |

<!--
## Authors
Expand Down Expand Up @@ -100,28 +101,20 @@ In the Requirements section, you will find the softwares and helpers you will ne

#### Requirements

- Anaconda 3 - 2022.05 - 64bit
- Windows 10
- Microsoft Visual C++ Build Tools 14.0 or higher (In order to run Anaconda)
- A Slack account and a Slack workspace
- (Optional, if you won't use Anaconda to install it) Python 3.8.3
- Python 3.8.3
- ngrok (https://ngrok.com/download)
- Having installed the CADOCS_NLU project (further details are available in the project's repository)
- Having installed the csDetector enhanced project (further details are available in the project's repository, please refer to the branch "dev")

#### Installation Steps

- Step 1: Local installation of CADOCS (Recommended, using Anaconda)
- Clone the current repository on your system
- In our repository, find the *cadocs_chatbot_env.yaml* file which contains the environment and the dependencies needed
- Through the Anaconda Powershell, run the following command: *conda env create -f ENV_FILE_NAME.yaml*

In case you faced some error installing the Anaconda environment, please proceed with the Step 1.1
#### Installation Steps

- (Optional) Step 1.1: Local installation of CADOCS (Manual)
- Step 1: Local installation of CADOCS (Recommended)
- Clone the current repository on your system
- In our repository, find the *cadocs_chatbot_env.yaml* file which contains the environment and the dependencies needed
- Create a new Python 3.8.3 environment
- Within the previously mentioned file, you will find each of the dependencies needed to run the tool
- Install by hand each of them in your env
- In our repository, find the *requirements.txt* file which contains the dependencies needed
- Create a virtual environment, run the following command: *python -m venv .venv*
- Activate the environment and run the following command: *pip install -r requirements.txt*

- Step 2: Creation of a new Slack App
- Go to the following URL https://api.slack.com/
Expand Down Expand Up @@ -149,15 +142,14 @@ In case you faced some error installing the Anaconda environment, please proceed
SLACK_TOKEN = The Bot User OAuth Token that you will find in the OAuth & Permissions section within the app you created in the Step 2
SLACK_EVENT_TOKEN = The Signing Secret that you will find in the Basic Information section within the app you created in the Step 2
GIT_PAT = GitHub Personal Access Token that you can generate within the Developer Settings in your GitHub account settings (make sure you give at least the "Repo" permissions)
ACTIVE_LEARNING_THRESHOLD = A numeric value that indicates the threshold of confidence needed by the agent to ask if its prediction was correct (We suggest 0.77)
MINIMUM_CONFIDENCE = A numeric value that indicates the minumum confidence needed by the agent to execute an intent (We suggest 0.55)
CADOCSNLU_URL_PREDICT = https://sesacadocs.eu.ngrok.io/cadocsNLU/predict
CADOCSNLU_URL_UPDATE = https://sesacadocs.eu.ngrok.io/cadocsNLU/update
CSDETECTOR_URL_GETSMELLS = https://sesacadocs.eu.ngrok.io/csDetector/getSmells
CSDETECTOR_URL_UPLOADS = https://sesacadocs.eu.ngrok.io/csDetector/uploads/
```
- Within your IDE (or through command line if you feel more comfortable), make sure that the environment used to execute the tool is the one you created in the Step 1
- With the environment activated, run the module *slack_api_connection.py*
- Within your IDE (or through command line if you feel more comfortable), make sure that the environment used to execute the tool is the one you created in Step 1
- With the environment activated, run the module *slack_api_connection.py* from the CADOCS directory (command: *python src/api/slack_api_connection.py*)

- Step 5: Put it all together
- Open the Slack app you created in the Step 2
Expand All @@ -169,64 +161,11 @@ In case you faced some error installing the Anaconda environment, please proceed
- In the __Event Subscription__ section, insert as the request URL: YOUR_NGROK_URL/slack/events
- In the __Interactivity & Shortcuts__ section, insert as the request URL: YOUR_NGROK_URL/slack/action-received
- Reinstall the app in your workspace
- Follow the instructions in the demo video to use CADOCS!

### Case 2: Full Local Installation

This case is the trickiest one. Since CADOCS is based on three different modules, you will have to install by hand the three environments needed to execute each module.

After having installed each of them, you will have to create your own Slack App like the previous case.

This section will explain how to put together the three modules in order to make CADOCS work. Please refer to the previous section in order to install the current project.

#### Requirements

- Having installed the CADOCS_NLU project (further details are available in the project's repository)
- Having installed the csDetector enhanced project (further details are available in the project's repository, please refer to the branch "CR_2-web-service")

#### Installation Steps

- Step 1: Installation of CADOCS
- Follow the first three steps listed in the precious section (and refer to their requirements too)
- Step 2: Configuration of CADOCS
- Open the project on your system with the IDE you prefer (__We suggest using Visual Studio Code or PyCharm__)
- Create a new file in the /src folder named "__.env__"
- Within the .env file, insert the following information (with the name we will provide)

```
SLACK_TOKEN = The Bot User OAuth Token that you will find in the OAuth & Permissions section within the app you created in the Step 2
SLACK_EVENT_TOKEN = The Signing Secret that you will find in the Basic Information section within the app you created in the Step 2
GIT_PAT = GitHub Personal Access Token that you can generate within the Developer Settings in your GitHub settings
ACTIVE_LEARNING_THRESHOLD = A numeric value that indicates the threshold of confidence needed by the agent to ask if its prediction was correct (We suggest 0.77)
MINIMUM_CONFIDENCE = A numeric value that indicates the minumum confidence needed by the agent to execute an intent (We suggest 0.55)
CADOCSNLU_URL_PREDICT = YOUR_NGROK_URL/cadocsNLU/predict
CADOCSNLU_URL_UPDATE = YOUR_NGROK_URL/cadocsNLU/update
CSDETECTOR_URL_GETSMELLS = YOUR_NGROK_URL/csDetector/getSmells
CSDETECTOR_URL_UPLOADS = YOUR_NGROK_URL/csDetector/uploads/
```
- Within your IDE (or through command line if you feel more comfortable), make sure that the environment used to execute the tool is the one you created in the Step 1
- With the environment activated, run the module *slack_api_connection.py*

- Step 3: Execution of the helper modules
- Execute the NLU web service (please refer to the CADOCS_NLU project)
- Execute the csDetector web service (please refer to the csDetector project)

- Step 4: Put it all together
- Open the Slack app you created previously
- In the __Event Subscription__ section, toggle ON the __Enable Events__ button and, in the __Subscribe to bot events__ section, add:
- message.channels
- message.im
- In the __Interactivity & Shortcuts__ section, toggle ON the __Interactivity__ button
- Insert the following URLs:
- In the __Event Subscription__ section, insert as the request URL: YOUR_NGROK_URL/slack/events
- In the __Interactivity & Shortcuts__ section, insert as the request URL: YOUR_NGROK_URL/slack/action-received
- Reinstall the app in your workspace
- Follow the instructions in the demo video to use CADOCS!

## Contributors

<a href="https://github.com/gianwario/CADOCS/graphs/contributors">
<img src="https://contrib.rocks/image?repo=gianwario/CADOCS" />
<a href="https://github.com/alfcan/CADOCS/graphs/contributors">
<img src="https://contrib.rocks/image?repo=alfcan/CADOCS" />
</a>

<!--
Expand Down
Binary file added docs/_IGES_MODIFICATION_REPORT.pdf
Binary file not shown.
Binary file added docs/_IGES_PRE_MAINTENANCE_REPORT.pdf
Binary file not shown.
Binary file added docs/_IGES_TEST_CASE_SPECIFICATION.pdf
Binary file not shown.
Binary file added docs/_IGES_TEST_PLAN.pdf
Binary file not shown.
Binary file added docs/_IGES_TEST_REPORT.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
pythonpath = src
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Flask==2.3.2
langdetect==1.0.9
pytest==7.4.0
pytest-cov==4.1.0
pytest-mock==3.11.1
python-dotenv==1.0.0
requests==2.31.0
slackclient==2.9.4
slackeventsapi==3.0.1
Binary file added src/.DS_Store
Binary file not shown.
Empty file added src/__init__.py
Empty file.
Empty file added src/api/__init__.py
Empty file.
Loading

0 comments on commit bf10f35

Please sign in to comment.