Skip to content

Commit

Permalink
Merge branch 'MIT-LCP:dev' into au/training/feature/create_training_b…
Browse files Browse the repository at this point in the history
…asics__implement_training_user
  • Loading branch information
Rutvikrj26 authored Jul 6, 2023
2 parents 905f170 + 2ed0de4 commit 0913bd7
Show file tree
Hide file tree
Showing 79 changed files with 1,776 additions and 712 deletions.
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ SOURCE_CODE_REPOSITORY_LINK='https://github.com/MIT-LCP/physionet-build'
# These variables are used to set the theme colors for the site
DARK='#343A40'
PRIMARY='#002A5C'
SECONDARY='#6D247A'
SUCCESS='#8DBF2E'
INFO='#6FC7EA'
WARNING='#F1C500'
DANGER='#DC4633'
LIGHT='#007FA3'

## Gradient colors on homepage

GRADIENT_60 = 'rgba(42, 47, 52, 0.6)'
GRADIENT_85 = 'rgba(42, 47, 52, 0.85)'

# Users settings
# maximum number of emails that can be associated to a user model
Expand Down Expand Up @@ -172,3 +183,16 @@ DEFAULT_NUMBER_OF_APPLICATIONS_TO_REMIND = 5

# minimum number of word needed for research_summary field for Credentialing Model.
MIN_WORDS_RESEARCH_SUMMARY_CREDENTIALING = 20

# CITISOAPService API
# This is the WebServices username and password to access the CITI SOAP Service to obtain users training report details
# The account can be created at https://webservices.citiprogram.org/login/CreateAccount.aspx
# The SOAP Service Access can be tested at https://webservices.citiprogram.org/Client/CITISOAPClient_Simple.aspx
CITI_USERNAME=
CITI_PASSWORD=
CITI_SOAP_URL="https://webservices.citiprogram.org/SOAP/CITISOAPService.asmx"

# Django configuration for file upload
# See https://docs.djangoproject.com/en/4.2/ref/settings/
DATA_UPLOAD_MAX_NUMBER_FILES=1000
DATA_UPLOAD_MAX_MEMORY_SIZE=2621440
1 change: 1 addition & 0 deletions .github/workflows/physionet-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
build-essential \
flake8 \
git \
libcap-dev \
libffi-dev \
libflac-dev \
libpq-dev \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/physionet-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
build-essential \
flake8 \
git \
libcap-dev \
libffi-dev \
libflac-dev \
libpq-dev \
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,5 @@ physionet-django/static/bootstrap/scss/theme.scss
physionet-django/static/bootstrap/css/bootstrap-grid.css
physionet-django/static/bootstrap/css/bootstrap-reboot.css
physionet-django/static/bootstrap/css/bootstrap.css
physionet-django/static/bootstrap/css/theme.css
physionet-django/static/bootstrap/css/theme.css
physionet-django/static/custom/css/home.css
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM python:3.9-bullseye

RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install build-essential libflac-dev libseccomp-dev libpq-dev libpcre3-dev postgresql-client wget zip -y --no-install-recommends \
&& apt-get install build-essential libcap-dev libflac-dev libseccomp-dev libpq-dev libpcre3-dev postgresql-client wget zip -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

RUN wget https://github.com/bemoody/wfdb/archive/10.7.0.tar.gz -O wfdb.tar.gz \
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,25 @@ If the migration behavior interacts with other changes that have been applied to

#### Theming instructions

The PRIMARY and DARK environment variables can be configured in the .env file.
* The management command "compilestatic" generates a theme.scss file and compiles the CSS.
The theme of the deployed website can be configured by changing the following environment variables:

* DARK
* PRIMARY
* SECONDARY
* SUCCESS
* INFO
* WARNING
* DANGER
* LIGHT


The management command "compilestatic" generates a theme.scss file and compiles the following CSS files.

* static/custom/css/home.css
* static/bootstrap/css/bootstrap.css

**Note:** The css files above are not tracked by git and are generated only when you run compilestatic command.


#### Setting Up Cronjobs

Expand Down
2 changes: 1 addition & 1 deletion deploy/test-server/install-pn-test-server
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ apt-get install -y \
`# Python application server` \
virtualenv python3-dev libpq-dev libffi-dev \
`# Requirements for building LightWAVE` \
build-essential libflac-dev libseccomp-dev \
build-essential libcap-dev libflac-dev libseccomp-dev \
`# Other tools required by PhysioNet` \
zip unzip xfsprogs \
`# Development and administration tools` \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% load static %}

{% block title %}Rejected Projects{% endblock %}
{% block title %}Archived Projects{% endblock %}

{% block local_css %}
<link rel="stylesheet" type="text/css" href="{% static 'custom/css/pagination.css' %}">
Expand All @@ -11,7 +11,7 @@
{% block content %}
<div class="card mb-3">
<div class="card-header">
Rejected Projects <span class="badge badge-pill badge-info">{{ projects.paginator.count }}</span>
Archived Projects <span class="badge badge-pill badge-info">{{ projects.paginator.count }}</span>
</div>
<div class="card-body">
<div class="table-responsive">
Expand All @@ -24,14 +24,14 @@
<th>Submitting Author</th>
<th>Editor</th>
<th>Creation Date</th>
<th>Rejection Date</th>
<th>Archived Date</th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr>
<td>{{ project.title }}</td>
<td><a href="{% url 'rejected_submission_history' project.slug %}">View History</a></td>
<td><a href="{% url 'archived_submission_history' project.slug %}">View History</a></td>
<td>{{ project.version }}</td>
<td>{% if project.submitting_author %}
<a href="{% url 'user_management' project.submitting_author.user.username %}">{{ project.submitting_author }}</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<!-- projects -->
{% if perms.project.change_publishedproject %}
<li class="nav-item" data-toggle="tooltip" data-placement="right">
{% if project_info_nav or submitted_projects_nav or unsubmitted_projects_nav or published_projects_nav or rejected_projects_nav %}
{% if project_info_nav or submitted_projects_nav or unsubmitted_projects_nav or published_projects_nav or archived_projects_nav %}
<a id="nav_projects_dropdown" class="nav-link nav-link-collapse drop" data-toggle="collapse" href="#projectComponents" data-parent="#sideAccordion" aria-expanded="true">
{% else %}
<a id="nav_projects_dropdown" class="nav-link nav-link-collapse drop collapsed" data-toggle="collapse" href="#projectComponents" data-parent="#sideAccordion" aria-expanded="false">
Expand All @@ -41,7 +41,7 @@
<span class="nav-link-text">Projects</span>
</a>
<!-- submenu -->
{% if project_info_nav or submitted_projects_nav or unsubmitted_projects_nav or published_projects_nav or rejected_projects_nav %}
{% if project_info_nav or submitted_projects_nav or unsubmitted_projects_nav or published_projects_nav or archived_projects_nav %}
<ul class="sidenav-second-level collapse show" id="projectComponents" style="">
{% else %}
<ul class="sidenav-second-level collapse" id="projectComponents">
Expand All @@ -55,8 +55,8 @@
<li class="nav-item {% if published_projects_nav %}active{% endif %}">
<a id="nav_published_projects" class="nav-link" href="{% url 'published_projects' %}">Published</a>
</li>
<li class="nav-item {% if rejected_projects_nav %}active{% endif %}">
<a id="nav_rejected_submissions" class="nav-link" href="{% url 'rejected_submissions' %}">Rejected</a>
<li class="nav-item {% if archived_projects_nav %}active{% endif %}">
<a id="nav_archived_submissions" class="nav-link" href="{% url 'archived_submissions' %}">Archived</a>
</li>
</ul>
</li>
Expand Down
49 changes: 37 additions & 12 deletions physionet-django/console/templates/console/user_management.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ <h3>Profile</h3>
{{ subject.is_credentialed }}
</div>
</div>
<div class="row mb-1">
<div class="col-md-3">
Amazon ID
</div>
<div class="col-md-9">
{% if aws_info %}
{{ aws_info }}
{% else %}
Not provided.
{% endif %}
</div>
</div>
<div class="row mb-1">
<div class="col-md-3">
Google Cloud ID:
</div>
<div class="col-md-9">
{% if gcp_info %}
{{ gcp_info }}
{% else %}
Not provided.
{% endif %}
</div>
</div>

<div class="row mb-1">
<div class="col-md-3">
Expand All @@ -48,6 +72,18 @@ <h3>Profile</h3>
{% endif %}
</div>
</div>
<div class="row mb-1">
<div class="col-md-3">
Personal Website:
</div>
<div class="col-md-9">
{% if profile.website %}
<a href="{{ profile.website }}" rel="nofollow">{{ profile.website }}</a>
{% else %}
Not provided.
{% endif %}
</div>
</div>

{% if profile.location %}
<div class="row mb-1">
Expand Down Expand Up @@ -75,17 +111,6 @@ <h3>Profile</h3>
</div>
{% endfor %}

{% if profile.website %}
<div class="row mb-1">
<div class="col-md-3">
Website:
</div>
<div class="col-md-9">
<a href="{{ profile.website }}" rel="nofollow">{{ profile.website }}</a>
</div>
</div>
{% endif %}

{% if groups %}
<div class="row mb-1">
<div class="col-md-3">
Expand Down Expand Up @@ -116,7 +141,7 @@ <h4>{{ status }} projects</h4>
<li><a href="{% url 'submission_info' project.slug %}">{{ project.title }}
</a> (v{{ project.version }})</li>
{% elif status == "Archived" %}
<li><a href="{% url 'rejected_submission_history' project.slug %}">{{ project.title }}
<li><a href="{% url 'archived_submission_history' project.slug %}">{{ project.title }}
</a> (v{{ project.version }})</li>
{% elif status == "Published" %}
<li><a href="{% url 'manage_published_project' project.slug project.version %}">{{ project.title }}
Expand Down
3 changes: 1 addition & 2 deletions physionet-django/console/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
name='submitted_projects'),
path('published-projects/', views.published_projects,
name='published_projects'),
path('rejected-submissions/', views.rejected_submissions,
name='rejected_submissions'),
path('archived-submissions/', views.archived_submissions, name='archived_submissions'),
path('project-access-manage/<pid>/', views.project_access_manage,
name='project_access_manage'),
path('published-projects/<project_slug>/<version>/',
Expand Down
43 changes: 29 additions & 14 deletions physionet-django/console/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import csv
import logging
import os
import re
from collections import OrderedDict
from datetime import datetime
from itertools import chain
Expand Down Expand Up @@ -54,6 +55,7 @@
Topic,
exists_project_slug,
)
from project.authorization.access import can_view_project_files
from project.projectfiles import ProjectFiles
from project.utility import readable_size
from project.validators import MAX_PROJECT_SLUG_LENGTH
Expand All @@ -67,7 +69,8 @@
Training,
TrainingType,
TrainingQuestion,
CodeOfConduct
CodeOfConduct,
CloudInformation
)
from physionet.enums import LogCategory
from console import forms, utility, services
Expand Down Expand Up @@ -1003,14 +1006,14 @@ def gcp_bucket_management(request, project, user):


@permission_required('project.change_archivedproject', raise_exception=True)
def rejected_submissions(request):
def archived_submissions(request):
"""
List of rejected submissions
List of archived submissions
"""
projects = ArchivedProject.objects.filter(archive_reason=3).order_by('archive_datetime')
projects = ArchivedProject.objects.all().order_by('archive_datetime')
projects = paginate(request, projects, 50)
return render(request, 'console/rejected_submissions.html',
{'projects': projects, 'rejected_projects_nav': True})
return render(request, 'console/archived_submissions.html',
{'projects': projects, 'archived_projects_nav': True})


@permission_required('user.view_user', raise_exception=True)
Expand Down Expand Up @@ -1070,6 +1073,14 @@ def user_management(request, username):
Admin page for managing an individual user account.
"""
user = get_object_or_404(User, username__iexact=username)
try:
aws_info = CloudInformation.objects.get(user=user).aws_id
except CloudInformation.DoesNotExist:
aws_info = None
try:
gcp_info = CloudInformation.objects.get(user=user).gcp_email
except CloudInformation.DoesNotExist:
gcp_info = None

_training = Training.objects.select_related('training_type').filter(user=user).order_by('-status')

Expand Down Expand Up @@ -1107,7 +1118,9 @@ def user_management(request, username):
'emails': emails,
'projects': projects,
'training_list': training,
'credentialing_app': credentialing_app})
'credentialing_app': credentialing_app,
'aws_info': aws_info,
'gcp_info': gcp_info})


@permission_required('user.view_user', raise_exception=True)
Expand All @@ -1125,7 +1138,10 @@ def users_search(request, group):

users = User.objects.filter(Q(username__icontains=search_field)
| Q(profile__first_names__icontains=search_field)
| Q(email__icontains=search_field))
| Q(profile__last_name__icontains=search_field)
| Q(email__icontains=search_field)
| Q(associated_emails__email__icontains=search_field)
).distinct()

if 'inactive' in group:
users = users.filter(is_active=False)
Expand All @@ -1152,15 +1168,13 @@ def users_aws_access_list_json(request):
2022). Don't rely on this function; it will go away.
"""
projects_datathon = [
"mimiciv-0.3",
"mimiciv-0.4",
"mimiciv-1.0",
"mimiciv-2.0"
"mimiciv-2.2"
]
published_projects = PublishedProject.objects.all()
users_with_awsid = User.objects.filter(cloud_information__aws_id__isnull=False)
datasets = {}
datasets['datasets'] = []
aws_id_pattern = r"\b\d{12}\b"

for project in published_projects:
dataset = {}
Expand All @@ -1169,8 +1183,9 @@ def users_aws_access_list_json(request):
dataset['name'] = project_name
dataset['accounts'] = []
for user in users_with_awsid:
if project.can_view_files(user):
dataset['accounts'].append(user.cloud_information.aws_id)
if can_view_project_files(project, user):
if re.search(aws_id_pattern, user.cloud_information.aws_id):
dataset['accounts'].append(user.cloud_information.aws_id)
datasets['datasets'].append(dataset)

return JsonResponse(datasets)
Expand Down
1 change: 1 addition & 0 deletions physionet-django/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def is_accessible(self):

def has_access(self, user):
"""
Deprecated: use projects.authorization.access.has_access_to_event_dataset instead
Checks if the user has access to this EventDataset.
This does not check if the associated dataset(PublishedProject) is accessible
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<td>{{ participant.user.username }}</td>
<td>{{ participant.user.get_full_name }}</td>
<td>{{ participant.user.email }}</td>
<td>{{ participant.user.is_credentialed }}</td>
<td>{{ participant.user.get_credentialing_status }}</td>
<td>
{% if participant.is_cohost %}
<input type="checkbox" name="toggle-cohost-status" event-slug="{{ event.slug }}" value="{{ participant.id }}" disabled checked>
Expand Down
Loading

0 comments on commit 0913bd7

Please sign in to comment.