Skip to content

Commit

Permalink
Merge pull request #1657 from OpenEnergyPlatform/release-v0.19.0
Browse files Browse the repository at this point in the history
Release v0.19.0
  • Loading branch information
jh-RLI authored Apr 10, 2024
2 parents 68b23bf + 8a27f90 commit 512cde4
Show file tree
Hide file tree
Showing 378 changed files with 14,281 additions and 9,649 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.18.2
current_version = 0.19.0

[bumpversion:file:VERSION]

Expand Down
11 changes: 8 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ Describe the findings of the discussion in the issue or meeting.

## Type of change (CHANGELOG.md)

### Added
### Features
- Add a new functionality [(#)](https://github.com/OpenEnergyPlatform/oeplatform/pull/)

### Updated
### Changes
- Update existing functionality [(#)](https://github.com/OpenEnergyPlatform/oeplatform/pull/)

### Bugs
- Fixed a problem with [(#)](https://github.com/OpenEnergyPlatform/oeplatform/pull/)

### Removed
- Remove a broken link [(#)](https://github.com/OpenEnergyPlatform/oeplatform/pull/)

### Documentation updates
- Updated documentation for [(#)](https://github.com/OpenEnergyPlatform/oeplatform/pull/)

## Workflow checklist

Expand All @@ -22,7 +27,7 @@ Closes #
### PR-Assignee
- [ ] 🐙 Follow the workflow in [CONTRIBUTING.md](https://github.com/OpenEnergyPlatform/oeplatform/blob/develop/CONTRIBUTING.md)
- [ ] 📝 Update the [CHANGELOG.md](https://github.com/OpenEnergyPlatform/oeplatform/blob/develop/versions/changelogs/current.md)
- [ ] 📙 Update the documentation on [mkdocs](https://openenergyplatform.github.io/oeplatform-code/)
- [ ] 📙 Update the documentation on [mkdocs](https://openenergyplatform.github.io/oeplatform/)

### Reviewer
- [ ] 🐙 Follow the [Reviewer Guidelines](https://github.com/rl-institut/super-repo/blob/develop/CONTRIBUTING.md#40-let-someone-else-review-your-pr)
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/automated-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,23 @@ jobs:
services:
postgres:
# We use our own prepared postgres image for this.
image: ghcr.io/openenergyplatform/oeplatform-postgres:0.3.0
image: ghcr.io/openenergyplatform/oeplatform-postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# We open up port 5432 to be able to use `localhost:5432` to connect to the database.
# We also could omit this and use `postgres:5432` to connect to the database after modifying security settings.
ports:
- 5432:5432
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# production still uses python3.6
strategy:
matrix:
python-version: ['3.6', '3.9']
python-version: ["3.10"]
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -97,4 +96,3 @@ jobs:

- name: Run tests with tox
run: tox -v

2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
key: ${{ github.ref }}
path: .cache
- run: pip install --upgrade -r requirements-docs.txt
- run: mkdocs gh-deploy --force
- run: mkdocs gh-deploy --force
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ authors:
title: "Open Energy Family - Open Energy Platform (OEP)"
type: software
license: AGPL-3.0-or-later
version: 0.18.2
version: 0.19.0
doi:
date-released: 2024-02-19
date-released: 2024-04-10
url: "https://github.com/OpenEnergyPlatform/oeplatform/"
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@ by [Vincent Driessen](https://nvie.com/posts/a-successful-git-branching-model/):
Discussion about the implementation details should occur within this issue.

2. Checkout `develop` and pull the latest changes

```bash
git checkout develop
```

```bash
git pull
```

3. Create a branch from `develop` to work on your issue (see below, the "Branch name convention" section)

```bash
git checkout -b feature/myfeature
git checkout -b feature-myfeature
```

We have agreed to use only branch names that have a - instead of / between words.

4. Push your local branch on the remote server `origin`

```bash
git push
```

If your branch does not exist on the remote server yet, git will provide you with instructions, simply follow them
5. Submit a pull request (PR)
- Follow the [steps](https://help.github.com/en/articles/creating-a-pull-request) of the github help to create the PR.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ This repository is licensed under [GNU Affero General Public License v3.0 (AGPL-

Follow the detailed [installation guide](https://openenergyplatform.github.io/oeplatform/install-and-documentation/install/installation/).

## Developement & Code contribution
## Development & Code contribution

Please read carefully the `CONTRIBUTING.md` [file](https://github.com/OpenEnergyPlatform/oeplatform/blob/develop/CONTRIBUTING.md) before you start contributing!

For further information visit our [developement & contribution guide](https://openenergyplatform.github.io/oeplatform/dev/)
For further information visit our [development & contribution guide](https://openenergyplatform.github.io/oeplatform/dev/)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.18.2
0.19.0
10 changes: 10 additions & 0 deletions api/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ def assert_add_tag_permission(user, table, permission, schema):
raise PermissionDenied


def assert_has_metadata(table, schema):
table = DBTable.load(schema, table)
if table.oemetadata is None:
result = False
else:
result = True

return result


def _translate_fetched_cell(cell):
if isinstance(cell, geoalchemy2.WKBElement):
return _get_engine().execute(cell.ST_AsText()).scalar()
Expand Down
1 change: 0 additions & 1 deletion api/helpers/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

class ModHttpResponse(HttpResponse):
def __init__(self, dictonary):

if dictonary is None:
HttpResponse.__init__(self, status=500)
return
Expand Down
1 change: 0 additions & 1 deletion api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand Down
1 change: 0 additions & 1 deletion api/migrations/0002_auto_20201109_1559.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion api/migrations/0003_delete_uploadedimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("api", "0002_auto_20201109_1559"),
]
Expand Down
2 changes: 1 addition & 1 deletion api/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def read_bibtexfile(file_name):
metadata.create_all(bind=engine)
sess = Session(bind=engine)

with open(file_name) as bibtex_file:
with open(file_name, encoding="utf-8") as bibtex_file:
bibtex_database = btp.load(bibtex_file)
for ent in bibtex_database.entries:
props = {
Expand Down
5 changes: 3 additions & 2 deletions api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from django.urls import reverse
from rest_framework import serializers
from modelview.models import Energyframework, Energymodel

from dataedit.models import Table
from django.urls import reverse
from modelview.models import Energyframework, Energymodel


class EnergyframeworkSerializer(serializers.ModelSerializer):
Expand Down
1 change: 0 additions & 1 deletion api/tests/test_clear_sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class TestCommandClearSandbox(APITestCase):
test_schema = SANDBOX_SCHEMA

def test_clear_sandbox(self):

# create a test table with data
# so that sandbox is not empty
self.create_table(
Expand Down
2 changes: 0 additions & 2 deletions api/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def step_create_table(self):
self.checkStructure()

def step_modify_table(self):

data_column = {
"type": "column",
"name": "number",
Expand All @@ -93,7 +92,6 @@ def step_modify_table(self):
self.api_req("post", data=data_constraint)

def step_insert_data(self):

insert_data = [
{
"query": {
Expand Down
1 change: 0 additions & 1 deletion api/tests/test_regression/test_issue_739_enforce_id_pk.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_check_insert_issue_739(self):
self.assertGreaterEqual(res[0]["id"], 0) # auto generated id

def test_id_type_and_pk(self):

res = self.create_table(
{"columns": [{"name": "id", "data_type": "int", "primary_key": True}]},
"test_id_ok",
Expand Down
94 changes: 76 additions & 18 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@
import sqlalchemy as sqla
import zipstream
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.postgres.search import TrigramSimilarity
from django.core.exceptions import PermissionDenied
from django.core.serializers import serialize
from django.db.models import Q
from django.db.utils import IntegrityError
from django.http import Http404, HttpResponse, JsonResponse, StreamingHttpResponse
from omi.dialects.oep.compiler import JSONCompiler
from omi.structure import OEPMetadata
from rest_framework import status
from rest_framework import generics, status
from rest_framework.views import APIView
from rest_framework import generics
from api.serializers import (
EnergyframeworkSerializer,
EnergymodelSerializer,
ScenarioDataTablesSerializer,
)

import api.parser
import login.models as login_models
from api import actions, parser, sessions
from api.encode import Echo, GeneratorJSONEncoder
from api.error import APIError
from api.helpers.http import ModHttpResponse
from api.serializers import (
EnergyframeworkSerializer,
EnergymodelSerializer,
ScenarioDataTablesSerializer,
)
from dataedit.models import Schema as DBSchema
from dataedit.models import Table as DBTable
from dataedit.views import get_tag_keywords_synchronized_metadata, schema_whitelist
from oeplatform.securitysettings import PLAYGROUNDS, UNVERSIONED_SCHEMAS

from modelview.models import Energyframework, Energymodel
from oeplatform.securitysettings import PLAYGROUNDS, UNVERSIONED_SCHEMAS

logger = logging.getLogger("oeplatform")

Expand Down Expand Up @@ -1133,20 +1133,78 @@ def get(self, request):
return HttpResponse("All connections closed")


# def get_users(request):
# string = request.GET["name"]
# users = login_models.myuser.objects.filter(
# Q(name__trigram_similar=string) | Q(name__istartswith=string)
# )
# return JsonResponse([user.name for user in users], safe=False)


def get_users(request):
string = request.GET["name"]
users = login_models.myuser.objects.filter(
Q(name__trigram_similar=string) | Q(name__istartswith=string)
)
return JsonResponse([user.name for user in users], safe=False)
query = request.GET.get("name", "")

# Ensure query is not empty to proceed with filtering
if query:
users = (
login_models.myuser.objects.annotate(
similarity=TrigramSimilarity("name", query),
)
.filter(
Q(similarity__gt=0.2) | Q(name__istartswith=query),
)
.order_by("-similarity")[:6]
)
else:
# Returning an empty list.
users = login_models.myuser.objects.none()

# Convert to list of user names
user_names = [user.name for user in users]

return JsonResponse(user_names, safe=False)


# def get_groups(request):
# string = request.GET["name"]
# users = login_models.Group.objects.filter(
# Q(name__trigram_similar=string) | Q(name__istartswith=string)
# )
# return JsonResponse([user.name for user in users], safe=False)


def get_groups(request):
string = request.GET["name"]
users = login_models.Group.objects.filter(
Q(name__trigram_similar=string) | Q(name__istartswith=string)
"""
Return all Groups where this user is a member that match
the current query. The query is input by the User.
"""
try:
user = login_models.myuser.objects.get(id=request.user.id)
except login_models.myuser.DoesNotExist:
raise Http404

query = request.GET.get("name", None)
if not query:
return JsonResponse([], safe=False)

user_groups = user.memberships.all().prefetch_related("group")
groups = [g.group for g in user_groups]

# Assuming 'name' is the field you want to search against
similar_groups = (
login_models.Group.objects.annotate(
similarity=TrigramSimilarity("name", query),
)
.filter(
similarity__gt=0.2, # Adjust the threshold as needed
id__in=[group.id for group in groups],
)
.order_by("-similarity")[:5]
)
return JsonResponse([user.name for user in users], safe=False)

group_names = [group.name for group in similar_groups]

return JsonResponse(group_names, safe=False)


def oeo_search(request):
Expand Down
2 changes: 0 additions & 2 deletions base/management/commands/check_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


def iter_links(url, parent_url=None, root_url=None, no_external=False):

res = requests.get(
url, stream=True
) # stream because sometimes we dont actually load all the content
Expand Down Expand Up @@ -104,7 +103,6 @@ def add_arguments(self, parser):
)

def handle(self, *args, **options):

loglevel = logging.INFO if options["show_all"] else logging.WARNING

logging.basicConfig(
Expand Down
1 change: 0 additions & 1 deletion base/management/commands/notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def add_arguments(self, parser):
parser.add_argument("command", choices=["download", "update"])

def handle(self, *args, **options):

if options["command"] == "download":
os.system("git pull --recurse-submodules")

Expand Down
4 changes: 2 additions & 2 deletions base/static/css/bootstrap.min.css

Large diffs are not rendered by default.

Binary file added base/static/img/badges/badge_bronze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added base/static/img/badges/badge_gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added base/static/img/badges/badge_iron.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added base/static/img/badges/badge_platinum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added base/static/img/badges/badge_silver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 512cde4

Please sign in to comment.