Skip to content

Commit

Permalink
Merge branch 'master' into Installation-Documentation-#57
Browse files Browse the repository at this point in the history
  • Loading branch information
enpuyou authored Mar 31, 2021
2 parents f1754b9 + be81929 commit 9d316f7
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 173 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@ jobs:
strategy:
matrix:
os: [Ubuntu, MacOS]
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
id: setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Install Pipenv
run: |
pip install pipenv --upgrade
- name: Setup Pipenv
uses: dschep/install-pipenv-action@v1
- name: Install dependencies
run: |
pipenv install --dev --skip-lock
# install dependencies according to the lock file
pipenv install --dev --ignore-pipfile --python ${{ steps.setup-python.outputs.python-version }}
pipenv run python -m spacy download en_core_web_sm
- name: Run test with pytest
run: |
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ code contribution.
### Development Environment

In order to contribute code or documentation to the project, the project
maintainers suggest installing the release of Python versions above 3.6. You can
maintainers suggest installing the release of Python versions above 3.7. You can
learn more about installing and managing python versions with `pyenv` from
[here](https://realpython.com/intro-to-pyenv/). In addition to installing `Git` to
access the project's GitHub repository, you should also install `Pipenv` for its
Expand Down Expand Up @@ -108,9 +108,9 @@ pipenv run streamlit run streamlit_web.py
#### Develop GatorMiner on Windows

GatorMiner depends on gensim, and gensim requires Microsoft Visual C++ 14.0+. You can check the version you have from
`Control Panel -> Programs and Features`. To download or update this, go to the
[Visual Studio 2019 Downloads](https://visualstudio.microsoft.com/downloads/), scroll down and
expand the `Tools for Visual Studio 2019` and click the download link for `Build tools for Visual Studio 2019`.
`Control Panel -> Programs and Features`. To download or update this, go to the
[Visual Studio 2019 Downloads](https://visualstudio.microsoft.com/downloads/), scroll down and
expand the `Tools for Visual Studio 2019` and click the download link for `Build tools for Visual Studio 2019`.

Once the installer is downloaded, launch it and select the `C++ build tools` option under `Desktop and Mobile`.
After that select install at the bottom and wait.
Expand All @@ -120,7 +120,7 @@ installing, the installer will ask to restart the computer to finish the install
After your computer has finished installing the C++ build tools, you may need to reinstall the dependencies. To do this,
just run the `pipenv install --dev` command as previously instructed.

If you still receive the error, delete the `Pipfile.lock` file in the root of the GatorMiner directory and reinstall
If you still receive the error, delete the `Pipfile.lock` file in the root of the GatorMiner directory and reinstall
using the previous command.

#### Test GatorMiner with Sample Data
Expand Down
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pytest-cov = "*"

[packages]
matplotlib = "*"
gensim = '*'
gensim = "~=3.8.3"
spacy = "~=2.3"
sklearn = "*"
pytest = "*"
Expand All @@ -23,6 +23,7 @@ altair = "*"
textblob = "*"
scipy = "*"
pylint = "*"
importlib-metadata = "*"

[pipenv]
allow_prereleases = true
300 changes: 156 additions & 144 deletions Pipfile.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Network URL: http://xxx.xxx.x.x:8501

The web interface will be automatically opened in your browser:

![browser](resources/images/landing_page.png)
<img src="resources/images/landing_page.png" alt="browser" style="width:100%"/>

### Data Retreiving

Expand Down Expand Up @@ -124,7 +124,7 @@ with GatorGrader [here](https://github.com/enpuyou/script-api-lambda-dynamodb).
Once the documents are successfully imported, you can then navigate through
the select box in the sidebar to view the text analysis:

![select box](resources/images/select_box.png)
<img src="resources/images/select_box.png" alt="select box" style="width:100%"/>

##### Reflection Documents

Expand All @@ -143,10 +143,10 @@ format of json reports GatorMiner gathers from AWS.

### Analysis

![frequency](resources/images/frequency.png)
![sentiment](resources/images/sentiment.png)
![similarity](resources/images/similarity.png)
![topic](resources/images/topic.png)
<img src="resources/images/frequency.png" alt="frequency" style="width:100%"/>
<img src="resources/images/sentiment.png" alt="sentiment" style="width:100%"/>
<img src="resources/images/similarity.png" alt="similarity" style="width:100%"/>
<img src="resources/images/topic.png" alt="topic" style="width:100%"/>

### Contribution

Expand Down
2 changes: 1 addition & 1 deletion src/summarizer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Text summary"""
import logging
from typing import Dict, List
from gensim.summarization import summarize
from gensim.summarization.summarizer import summarize
from . import markdown as md

# pylint: disable=logging-fstring-interpolation
Expand Down
31 changes: 21 additions & 10 deletions streamlit_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import re

import base64
import numpy as np
import os
import pandas as pd
from sklearn.manifold import TSNE
import spacy
Expand Down Expand Up @@ -60,8 +62,7 @@ def main():
if debug_mode:
st.write(main_df)
if analysis_mode == "Home":
with open("README.md") as readme_file:
st.markdown(readme_file.read())
readme()
else:
if analysis_mode == "Frequency Analysis":
st.title(analysis_mode)
Expand All @@ -83,13 +84,26 @@ def main():
interactive()
success_msg.empty()

def readme():
"""function to load and configurate readme source"""

with open("README.md") as readme_file:
readme_src = readme_file.read()
for file in os.listdir("resources/images"):
if file.endswith(".png"):
img_path = f"resources/images/{file}"
with open(img_path, "rb") as f:
img_bin = base64.b64encode(f.read()).decode()
readme_src = readme_src.replace(img_path, f"data:image/png;base64,{img_bin}")

st.markdown(readme_src, unsafe_allow_html=True)

def landing_pg():
"""landing page"""
landing = st.sidebar.selectbox("Welcome", ["Home", "Interactive"])

if landing == "Home":
with open("README.md") as readme_file:
st.markdown(readme_file.read())
readme()
else:
interactive()

Expand Down Expand Up @@ -120,8 +134,7 @@ def retreive_data(data_retreive):
except TypeError:
st.sidebar.warning(
"No data imported. Please check the reflection document input")
with open("README.md") as readme_file:
st.markdown(readme_file.read())
readme()
else:
global success_msg
success_msg = None
Expand Down Expand Up @@ -157,8 +170,7 @@ def import_data(data_retreive_method, paths):
json_lst.append(md.collect_md(path))
except FileNotFoundError as err:
st.sidebar.text(err)
with open("README.md") as readme_file:
st.markdown(readme_file.read())
readme()
else:
passbuild = st.sidebar.checkbox(
"Only retreive build success records", value=True)
Expand All @@ -169,8 +181,7 @@ def import_data(data_retreive_method, paths):
json_lst.append(ju.clean_report(response))
except (EnvironmentError, Exception) as err:
st.sidebar.error(err)
with open("README.md") as readme_file:
st.markdown(readme_file.read())
readme()
# when data is retreived
if json_lst:
raw_df = pd.DataFrame()
Expand Down
3 changes: 2 additions & 1 deletion tests/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def test_get_file_names(tmp_path):
para_2.write_text("text")
output = md.get_file_names(directory)
expected = [f"{directory}/hello.md", f"{directory}/world.md"]
assert expected == output
assert expected[0] in output
assert expected[1] in output


def test_md_parser():
Expand Down

0 comments on commit 9d316f7

Please sign in to comment.