Skip to content
Open

ds #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
## KATA 소개
![kata](https://github.com/Team-KATA/python-kata/assets/76774809/c74de953-e41a-4b96-9aa6-b54d55743809)
### Republic of Korea Army Trend Analysis (KATA)
### 대한민국 육군 트랜드 분석 서비스
### 대한민국 육군 트렌드 분석 서비스
국방 및 안보 이슈에 중점을 두고, 사회적 관심사로 부상하는 키워드를 선정한다. 선택된 키워드와 관련된 기사 반응을 분석하고 요약하여, 사용자가 해당 키워드에 대한 감정 변화, 여론 추이 및 예측 등을 종합적으로 파악할 수 있게 지원하는 도구이다.

KATA는 국방분야에서의 빅데이터 활용을 통한 새로운 가치 창출을 목표로 하고 있다. 이를 통해 육군이 보다 효과적으로 정보를 분석하고, 더 빠르고 정확한 결정을 내릴 수 있도록 돕고자 한다.

[바로가기](https://kata-front.run.goorm.site/)

## 주요 기능
**Page Map**
![Page Map](https://github.com/Team-KATA/python-kata/assets/76774809/4d24fd32-a057-46e0-bd10-589cb596e649)
Expand All @@ -30,5 +32,5 @@ KATA는 국방분야에서의 빅데이터 활용을 통한 새로운 가치 창
| [허동석](https://github.com/POBSIZ) | [석민석](https://github.com/msjk27) | [남궁현](https://github.com/DWL21)
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------------------------------:
| <img src="https://avatars.githubusercontent.com/u/65818008?v=4" width=200px alt="_"> | <img src="https://avatars.githubusercontent.com/u/97681606?v=4" width=200px alt="_"> | <img src="https://avatars.githubusercontent.com/u/76774809?v=4" width=200px alt="_">

- 2023.10 대한민국 육군 9311부대 소속 장병
Binary file added dao/__pycache__/keyword_fixture.cpython-37.pyc
Binary file not shown.
13 changes: 13 additions & 0 deletions dao/_keyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pydantic import BaseModel

class Keyword(BaseModel):
id: int = None
name: str


keyword_names = [
"삼성전자", "코로나 백신", "올림픽", "메타버스", "NFT",
"AI", "블록체인", "테슬라", "애플", "에이치엘비",
"환율", "비트코인", "가상화폐", "클라우드 컴퓨팅",
"구글", "유튜브", "방탄소년단", "빅데이터", "5G", "IoT"
]
13 changes: 13 additions & 0 deletions dao/article.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pydantic import BaseModel

class Article(BaseModel):
id: int = None
title: str
body: str
reporter: str
media: str
link: str
time: str


article_fixtures = []
31 changes: 31 additions & 0 deletions dao/article_dao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from typing import Optional
from article import article

articles_db = {}

def save(name: str) -> Optional[Article]:
if name not in articles_db.values():
article = Article(id=len(articles_db) + 1, name=name)
articles_db[article.id] = article
return article
return None


def find(id: int) -> Optional[Article]:
if id in articles_db:
return articles_db[id]
return None


def find_all() -> list:
return list(articles_db.values())


def edit(article: Article):
if article.id in articles_db:
articles_db[id] = article


def delete(article: Article):
if article.id in articles_db:
articles_db.pop(article.id)
12 changes: 12 additions & 0 deletions dao/article_keyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pydantic import BaseModel
from article import Article
from _keyword import Keyword


class ArticleKeyword(BaseModel):
id: int = None
article: Article
keyword: Keyword


article_keyword_fixtures = []
31 changes: 31 additions & 0 deletions dao/article_keyword_dao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from typing import Optional
from article_keyword import ArticleKeyword

article_keywords_db = {}

def save(name: str) -> Optional[ArticleKeyword]:
if name not in article_keywords_db.values():
article_keyword = ArticleKeyword(id=len(article_keywords_db) + 1, name=name)
article_keywords_db[article_keyword.id] = article_keyword
return article_keyword
return None


def find(id: int) -> Optional[ArticleKeyword]:
if id in article_keywords_db:
return article_keywords_db[id]
return None


def find_all() -> list:
return list(article_keywords_db.values())


def edit(article_keyword: ArticleKeyword):
if article_keyword.id in article_keywords_db:
article_keywords_db[id] = article_keyword


def delete(article_keyword: ArticleKeyword):
if article_keyword.id in article_keywords_db:
article_keywords_db.pop(article_keyword.id)
11 changes: 11 additions & 0 deletions dao/community.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from pydantic import BaseModel

class Community(BaseModel):
id: int = None
source: str
body: str
link: str
time: str


community_fixtures = []
31 changes: 31 additions & 0 deletions dao/community_dao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from typing import Optional
from _community import community

communitys_db = {}

def save(name: str) -> Optional[Community]:
if name not in communitys_db.values():
community = Community(id=len(communitys_db) + 1, name=name)
communitys_db[community.id] = community
return community
return None


def find(id: int) -> Optional[Community]:
if id in communitys_db:
return communitys_db[id]
return None


def find_all() -> list:
return list(communitys_db.values())


def edit(community: Community):
if community.id in communitys_db:
communitys_db[id] = community


def delete(community: Community):
if community.id in communitys_db:
communitys_db.pop(community.id)
31 changes: 31 additions & 0 deletions dao/keyword_dao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from typing import Optional
from _keyword import Keyword

keywords_db = {}

def save(name: str) -> Optional[Keyword]:
if name not in keywords_db.values():
keyword = Keyword(id=len(keywords_db) + 1, name=name)
keywords_db[keyword.id] = keyword
return keyword
return None


def find(id: int) -> Optional[Keyword]:
if id in keywords_db:
return keywords_db[id]
return None


def find_all() -> list:
return list(keywords_db.values())


def edit(keyword: Keyword):
if keyword.id in keywords_db:
keywords_db[id] = keyword


def delete(keyword: Keyword):
if keyword.id in keywords_db:
keywords_db.pop(keyword.id)
7 changes: 7 additions & 0 deletions dao/trend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pydantic import BaseModel

class Trend(BaseModel):
id: int = None
time: str

trend_fixtures = []
31 changes: 31 additions & 0 deletions dao/trend_dao.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from typing import Optional
from _trend import trend

trends_db = {}

def save(name: str) -> Optional[Trend]:
if name not in trends_db.values():
trend = Trend(id=len(trends_db) + 1, name=name)
trends_db[trend.id] = trend
return trend
return None


def find(id: int) -> Optional[Trend]:
if id in trends_db:
return trends_db[id]
return None


def find_all() -> list:
return list(trends_db.values())


def edit(trend: Trend):
if trend.id in trends_db:
trends_db[id] = trend


def delete(trend: Trend):
if trend.id in trends_db:
trends_db.pop(trend.id)
13 changes: 13 additions & 0 deletions modules/crawling/tweets_crawling.py
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
import tweepy

# 트위터 개발자 계정에서 얻은 키들을 아래에 입력하세요.
def tweets_crawling(consumer_key, consumer_secret, access_token, access_token_secret, keyword):
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)

# 특정 키워드가 포함된 트윗을 검색합니다.
public_tweets = api.search(q=keyword, lang="ko", count=5)

return public_tweets