adapted to use fuzzy everywhere
This commit is contained in:
@@ -67,7 +67,7 @@ async def get_rankings(
|
||||
async def get_trend(
|
||||
topics: List[str] = Query(..., description="List of topics to analyze"),
|
||||
keywords: Optional[List[str]] = Query(None, description="List of raw keywords corresponding to topics"),
|
||||
soft_search: bool = Query(True, description="True if using mapped topics, False if using raw keywords"),
|
||||
fuzzy: bool = Query(True, description="True if using mapped topics, False if using raw keywords"),
|
||||
institutions: Optional[List[str]] = Query(None, description="List of OpenAlex Institution IDs"),
|
||||
countries: Optional[List[str]] = Query(None, description="List of country codes"),
|
||||
regions: Optional[List[str]] = Query(None, description="List of region identifiers"),
|
||||
@@ -77,7 +77,7 @@ async def get_trend(
|
||||
return await strategy.get_trend(
|
||||
topics=topics,
|
||||
keywords=keywords,
|
||||
soft_search=soft_search,
|
||||
fuzzy=fuzzy,
|
||||
institutions=institutions,
|
||||
countries=countries,
|
||||
regions=regions,
|
||||
|
||||
@@ -26,7 +26,7 @@ class TrendStrategy(abc.ABC):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -83,7 +83,7 @@ class PublicationsTrendStrategy(TrendStrategy):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -242,7 +242,7 @@ class PublicationsTrendStrategy(TrendStrategy):
|
||||
topic_clauses = []
|
||||
topic_filters = {}
|
||||
for idx, t in enumerate(topics):
|
||||
if not soft_search and keywords and idx < len(keywords):
|
||||
if not fuzzy and keywords and idx < len(keywords):
|
||||
kw_val = keywords[idx]
|
||||
clause = {
|
||||
"bool": {
|
||||
@@ -403,7 +403,7 @@ class AuthorsTrendStrategy(TrendStrategy):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -481,7 +481,7 @@ class AuthorsTrendStrategy(TrendStrategy):
|
||||
topic_clauses = []
|
||||
topic_filters = {}
|
||||
for idx, t in enumerate(topics):
|
||||
if not soft_search and keywords and idx < len(keywords):
|
||||
if not fuzzy and keywords and idx < len(keywords):
|
||||
kw_val = keywords[idx]
|
||||
clause = {
|
||||
"bool": {
|
||||
@@ -609,7 +609,7 @@ class PatentsTrendStrategy(TrendStrategy):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -662,7 +662,7 @@ class ProjectsTrendStrategy(TrendStrategy):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -714,7 +714,7 @@ class NewsTrendStrategy(TrendStrategy):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -834,7 +834,7 @@ class AllTrendStrategy(TrendStrategy):
|
||||
self,
|
||||
topics: List[str],
|
||||
keywords: Optional[List[str]] = None,
|
||||
soft_search: bool = True,
|
||||
fuzzy: bool = True,
|
||||
institutions: Optional[List[str]] = None,
|
||||
countries: Optional[List[str]] = None,
|
||||
regions: Optional[List[str]] = None,
|
||||
@@ -848,10 +848,10 @@ class AllTrendStrategy(TrendStrategy):
|
||||
news_strat = NewsTrendStrategy()
|
||||
|
||||
# Query UDE publications data only
|
||||
pub_task = pub_strat.get_trend(topics, keywords, soft_search, institutions=[DEFAULT_INSTITUTION_ID])
|
||||
pat_task = pat_strat.get_trend(topics, keywords, soft_search)
|
||||
proj_task = proj_strat.get_trend(topics, keywords, soft_search)
|
||||
news_task = news_strat.get_trend(topics, keywords, soft_search)
|
||||
pub_task = pub_strat.get_trend(topics, keywords, fuzzy, institutions=[DEFAULT_INSTITUTION_ID])
|
||||
pat_task = pat_strat.get_trend(topics, keywords, fuzzy)
|
||||
proj_task = proj_strat.get_trend(topics, keywords, fuzzy)
|
||||
news_task = news_strat.get_trend(topics, keywords, fuzzy)
|
||||
|
||||
pub_res, pat_res, proj_res, news_res = await asyncio.gather(pub_task, pat_task, proj_task, news_task)
|
||||
|
||||
|
||||
@@ -455,11 +455,3 @@
|
||||
</app-keywords-patents>
|
||||
}
|
||||
}
|
||||
|
||||
<!-- Trend Comparison Section -->
|
||||
@if (showVisualization() && selectedKeywords().length > 0) {
|
||||
<div style="margin-top: 2rem">
|
||||
<app-uni-trend-parent
|
||||
[keywords]="selectedKeywords()"></app-uni-trend-parent>
|
||||
</div>
|
||||
}
|
||||
|
||||
+2
-2
@@ -920,13 +920,13 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.fetchedAuthors.set([...this.comparisonAuthors()]);
|
||||
|
||||
const kws = this.state?.keywordsList() ?? [];
|
||||
const softSearch = this.state?.softSearch() ?? true;
|
||||
const fuzzy = this.state?.fuzzySearch() ?? true;
|
||||
|
||||
this.apiService
|
||||
.getTrendApiInseServiceUniversityRankingsTrendGet(
|
||||
topics,
|
||||
kws,
|
||||
softSearch,
|
||||
fuzzy,
|
||||
this.comparisonInstitutions().map((i: CompareItem) => i.id),
|
||||
this.comparisonCountries().map((c: CompareItem) => c.id),
|
||||
this.comparisonRegions().map((r: CompareItem) => r.id),
|
||||
|
||||
Reference in New Issue
Block a user