Skip to content

Commit

Permalink
Merge pull request #890 from research-software-directory/888-project-…
Browse files Browse the repository at this point in the history
…overview

888 project overview
  • Loading branch information
dmijatovic authored Jun 8, 2023
2 parents 1f81aa7 + 8f10f20 commit 8d16584
Show file tree
Hide file tree
Showing 118 changed files with 4,324 additions and 2,640 deletions.
67 changes: 0 additions & 67 deletions database/100-create-api-views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,6 @@ BEGIN
END
$$;

-- programming language counts for software
-- used in software filter - language dropdown
CREATE FUNCTION prog_lang_cnt_for_software() RETURNS TABLE (
prog_lang TEXT,
cnt BIGINT
) LANGUAGE plpgsql STABLE AS
$$
BEGIN
RETURN QUERY
SELECT
JSONB_OBJECT_KEYS(languages) AS "prog_lang",
COUNT(software) AS cnt
FROM
repository_url
GROUP BY
JSONB_OBJECT_KEYS(languages)
;
END
$$;

-- programming language filter for software
-- used by software_overview func
CREATE FUNCTION prog_lang_filter_for_software() RETURNS TABLE (
Expand All @@ -177,23 +157,6 @@ BEGIN
END
$$;

-- license counts for software
-- used in software filter - license dropdown
CREATE FUNCTION license_cnt_for_software() RETURNS TABLE (
license VARCHAR,
cnt BIGINT
) LANGUAGE sql STABLE AS
$$
SELECT
license_for_software.license,
COUNT(license_for_software.license) AS cnt
FROM
license_for_software
GROUP BY
license_for_software.license
;
$$;

-- license filter for software
-- used by software_search func
CREATE FUNCTION license_filter_for_software() RETURNS TABLE (
Expand Down Expand Up @@ -1247,36 +1210,6 @@ BEGIN
END
$$;

-- RESEARCH DOMAIN count used in project filter
-- to show used research domains with count
CREATE FUNCTION research_domain_count_for_projects() RETURNS TABLE (
id UUID,
key VARCHAR,
name VARCHAR,
cnt BIGINT
) LANGUAGE plpgsql STABLE AS
$$
BEGIN
RETURN QUERY
SELECT
research_domain.id,
research_domain.key,
research_domain.name,
research_domain_count.cnt
FROM
research_domain
LEFT JOIN
(SELECT
research_domain_for_project.research_domain,
COUNT(research_domain_for_project.research_domain) AS cnt
FROM
research_domain_for_project
GROUP BY research_domain_for_project.research_domain
) AS research_domain_count ON research_domain.id = research_domain_count.research_domain
;
END
$$;

-- GLOBAL SEARCH
-- we use search_text to concatenate all values to use
CREATE FUNCTION global_search() RETURNS TABLE(
Expand Down
Loading

0 comments on commit 8d16584

Please sign in to comment.