[recommendations-and-nl-search | DONE | CHANGED] move DareLAB APIs to environment properties

This commit is contained in:
Alex Martzios 2024-06-20 14:14:42 +03:00
parent fe3a439ff0
commit 8ea9cd5dbc
7 changed files with 32 additions and 15 deletions

View File

@ -59,8 +59,6 @@ export class HomeComponent {
resultsSize: number = 6;
errorMessage: string;
getRecommendationsForOrcidAPI: string = 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend'
constructor (
private _router: Router,
private _piwikService:PiwikService,
@ -208,7 +206,7 @@ export class HomeComponent {
getOrcidRecommendations() {
let orcid = Identifier.getRawORCID(this.user.orcid);
this.subs.push(this.recommendationsService.getRecommendationsForOrcid(this.getRecommendationsForOrcidAPI, orcid).subscribe(data => {
this.subs.push(this.recommendationsService.getRecommendationsForOrcid(this.properties.recommendationsForOrcidAPI, orcid).subscribe(data => {
this.recommendations = data['recommendations'];
}, error => {
console.log(error);

View File

@ -1,6 +1,8 @@
import {Component} from "@angular/core";
import {Subscriber} from "rxjs";
import {NaturalLanguageSearchService} from "./natural-language-search.service";
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
import {properties} from "../../environments/environment";
@Component({
selector: 'natural-language-search',
@ -10,6 +12,7 @@ import {NaturalLanguageSearchService} from "./natural-language-search.service";
export class NaturalLanguageSearchComponent {
private subscriptions = [];
properties: EnvProperties = properties;
showLoading: boolean = false;
errorMessage: string;
@ -18,8 +21,6 @@ export class NaturalLanguageSearchComponent {
results;
indexColumnId: number;
naturalLanguageSearchAPI: string = "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/";
constructor(private naturalLanguageSearchService: NaturalLanguageSearchService) {
}
@ -35,7 +36,7 @@ export class NaturalLanguageSearchComponent {
this.queryPhrase = this.phrase;
this.errorMessage = null;
this.showLoading = true;
this.subscriptions.push(this.naturalLanguageSearchService.getResults(this.naturalLanguageSearchAPI, this.queryPhrase).subscribe(data => {
this.subscriptions.push(this.naturalLanguageSearchService.getResults(this.properties.naturalLanguageSearchAPI, this.queryPhrase).subscribe(data => {
if(data && data['columns']) {
for(let i = 0; i < data['columns'].length - 1; i++) {
if(data['columns'][i] == 'id') {

@ -1 +1 @@
Subproject commit 2b12959a4ec134092f2d3bf58586518d85d031ae
Subproject commit 623debc84662a0e61f197efe506cf121acc5bd49

View File

@ -30,9 +30,6 @@ export class CategoryToItemComponent {
keywordControl: FormControl;
keyword: string;
getAvailableCommunitiesAPI: string = 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities';
getRecommendationsForCommunityAPI: string = 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend';
constructor(private communitiesService: CommunitiesService,
private recommendationsService: RecommendationsService,
private router: Router,
@ -48,7 +45,7 @@ export class CategoryToItemComponent {
this.getCommunities();
this.subscriptions.push(this.route.params.subscribe(params => {
if(params && params['community']) {
this.subscriptions.push(this.recommendationsService.getRecommendationsForCommunity(this.getRecommendationsForCommunityAPI, params['community']).subscribe(data => {
this.subscriptions.push(this.recommendationsService.getRecommendationsForCommunity(this.properties.recommendationsForCommunityAPI, params['community']).subscribe(data => {
this.recommendations = data;
this.setActiveCommunity(params['community']);
}));
@ -70,7 +67,7 @@ export class CategoryToItemComponent {
}
private getCommunities() {
this.subscriptions.push(zip(this.recommendationsService.getAvailableCommunities(this.getAvailableCommunitiesAPI), this.communitiesService.getCommunities(this.properties, this.properties.communitiesAPI)).subscribe(data => {
this.subscriptions.push(zip(this.recommendationsService.getAvailableCommunities(this.properties.availableCommunitiesAPI), this.communitiesService.getCommunities(this.properties, this.properties.communitiesAPI)).subscribe(data => {
let availableCommunities: any = data[0];
this.communities = availableCommunities.map(id => {
const obj = data[1].find(o => o.communityId === id);

View File

@ -25,7 +25,14 @@ let props: EnvProperties = {
searchLinkToServices: "/search/find/services",
searchLinkToAdvancedServices: "/search/advanced/services",
reCaptchaSiteKey: null,
footerGrantText : ""
footerGrantText : "",
naturalLanguageSearchAPI: "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/",
availableCommunitiesAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities',
recommendationsForCommunityAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend',
recommendationsForOrcidAPI: 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend',
recommendationsForPublicationAPI: 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/recommend/',
feedbackForRecommendationAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/update/'
};
export let properties: EnvProperties = {

View File

@ -25,7 +25,14 @@ let props: EnvProperties = {
searchLinkToServices: "/search/find/services",
searchLinkToAdvancedServices: "/search/advanced/services",
reCaptchaSiteKey: null,
footerGrantText : ""
footerGrantText : "",
naturalLanguageSearchAPI: "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/",
availableCommunitiesAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities',
recommendationsForCommunityAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend',
recommendationsForOrcidAPI: 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend',
recommendationsForPublicationAPI: 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/recommend/',
feedbackForRecommendationAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/update/'
};
export let properties: EnvProperties = {

View File

@ -25,7 +25,14 @@ let props: EnvProperties = {
searchLinkToServices: "/search/find/services",
searchLinkToAdvancedServices: "/search/advanced/services",
reCaptchaSiteKey: null,
footerGrantText : "This OpenAIRE gateway is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No. 777541 and 101017452"
footerGrantText : "This OpenAIRE gateway is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No. 777541 and 101017452",
naturalLanguageSearchAPI: "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/",
availableCommunitiesAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities',
recommendationsForCommunityAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend',
recommendationsForOrcidAPI: 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend',
recommendationsForPublicationAPI: 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/recommend/',
feedbackForRecommendationAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/update/'
};
export let properties: EnvProperties = {