Skip to content

Commit

Permalink
Add additional fields to published projects CSV download (#2280)
Browse files Browse the repository at this point in the history
This PR adds fields to indicate the resource/project type to the
published projects CSV download available in the console. It also
addresses these suggested updates for projects from
#2277 :
- Rename to "Published Projects" (renamed the button, everything else
seemed to have both words already)
- Add approximate storage size, if possible (`storage_volume`) (added
`main_storage_size` which is what the entire project takes up across
versions. Could add `incremental_storage_volume` also if desired).
- Add number of signed DUAs (`signed_dua_count`) Add this by counting
the `DUASignature` objects for a given `project_id`.
  • Loading branch information
tompollard authored Aug 23, 2024
2 parents 5556e8b + 4b1cbb7 commit d183b9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion physionet-django/console/templates/console/downloads.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h6>Users</h6>
<h6>Published projects</h6>
<p>Download a complete list of published projects, including project names, descriptions, and timelines.</p>
<a href="{% url 'download_projects' %}" class="btn btn-primary">
Download projects
Download published projects
</a>
</div>

Expand Down
8 changes: 8 additions & 0 deletions physionet-django/console/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,8 @@ def download_projects(request):
writer.writerow(["project_id",
"core_project_id",
"project_slug",
"resource_type_id",
"resource_type",
"version",
"publish_date",
"has_other_versions",
Expand All @@ -2485,6 +2487,8 @@ def download_projects(request):
"access_policy",
"license",
"data_use_agreement",
"signed_dua_count",
"storage_size_mb",
"project_home_page",
"ethics_statement",
"corresponding_author_id",
Expand All @@ -2508,6 +2512,8 @@ def clean_html(html_content):
project_data = [project.id,
project.core_project.id,
project.slug,
project.resource_type_id,
project.resource_type.name,
project.version,
project.publish_datetime,
project.has_other_versions,
Expand All @@ -2531,6 +2537,8 @@ def clean_html(html_content):
project.access_policy,
project.license,
project.dua,
DUASignature.objects.filter(project=project.id).count(),
round(project.main_storage_size / 1000000, 1),
project.project_home_page,
clean_html(project.ethics_statement),
', '.join(str(author.id) for author in authors if author.is_corresponding),
Expand Down

0 comments on commit d183b9a

Please sign in to comment.