Skip to content

Commit

Permalink
Adding subset, sawhm
Browse files Browse the repository at this point in the history
  • Loading branch information
villanueval committed Dec 20, 2024
1 parent 932a4b6 commit 73bdb89
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 112 deletions.
28 changes: 23 additions & 5 deletions web_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

import settings

site_ver = "2.8.0"
site_ver = "2.8.1"
site_env = settings.env
site_net = settings.site_net

Expand Down Expand Up @@ -307,9 +307,10 @@ def favicon():


@cache.memoize()
@app.route('/team/<team>/<subset>', methods=['GET', 'POST'], provide_automatic_options=False)
@app.route('/team/<team>', methods=['GET', 'POST'], provide_automatic_options=False)
@app.route('/', methods=['GET', 'POST'], provide_automatic_options=False)
def homepage(team=None):
def homepage(team=None, subset=None):
"""Main homepage for the system"""
# If API, not allowed - to improve
if site_net == "api":
Expand Down Expand Up @@ -423,6 +424,8 @@ def homepage(team=None):
" (SELECT project_id FROM projects WHERE skip_project IS NOT True AND project_section = 'IS')"))[0]['total'])
}



elif team == "inf":
team_heading = "Summary of Informatics Team Projects"
html_title = "Summary of the Informatics Team Projects, Collections Digitization"
Expand Down Expand Up @@ -478,6 +481,14 @@ def homepage(team=None):

list_projects_is = pd.DataFrame(run_query(section_query, {'section': 'IS'}))
list_projects_is = list_projects_is.drop("images_public", axis=1)

# Filter
if subset is None:
subset = ""
else:
if subset.lower() == "sawhm":
list_projects_is = list_projects_is[list_projects_is.project_manager == 'Laura M. Whitfield']

list_projects_is = list_projects_is.rename(columns={
"project_unit": "Unit",
"project_title": "Title",
Expand All @@ -488,6 +499,7 @@ def homepage(team=None):
"images_taken": "Images Captured"
})


# Informatics Table
inf_section_query = (" SELECT "
" CONCAT('<abbr title=\"', u.unit_fullname, '\">', p.project_unit, '</abbr>') as project_unit, "
Expand Down Expand Up @@ -556,7 +568,8 @@ def homepage(team=None):
last_update=last_update[0]['updated_at'],
kiosk=kiosk, user_address=user_address, team_heading=team_heading,
html_title=html_title, analytics_code=settings.analytics_code,
app_root=settings.app_root)
app_root=settings.app_root,
subset=subset.upper())


@app.route('/team/', methods=['POST', 'GET'], provide_automatic_options=False)
Expand Down Expand Up @@ -691,6 +704,8 @@ def dashboard_f(project_alias=None, folder_id=None, tab=None, page=None):
project_manager_link = "<a href=\"https://dpo.si.edu/nathan-ian-anderson\">Nathan Ian Anderson</a>"
elif project_info['project_manager'] == "Erin M. Mazzei":
project_manager_link = "<a href=\"https://dpo.si.edu/erin-mazzei\">Erin M. Mazzei</a>"
elif project_info['project_manager'] == "Laura M. Whitfield":
project_manager_link = "<a href=\"https://dpo.si.edu/laura-whitfield\">Laura M. Whitfield</a>"

projects_links = run_query("SELECT * FROM projects_links WHERE project_id = %(project_id)s ORDER BY table_id",
{'project_id': project_info['project_id']})
Expand Down Expand Up @@ -1103,7 +1118,8 @@ def dashboard_f(project_alias=None, folder_id=None, tab=None, page=None):
analytics_code=settings.analytics_code,
project_stats_other=project_stats_other,
files_table_sort=files_table_sort,
folder_badges=folder_badges
folder_badges=folder_badges,
no_cols=no_cols
)


Expand Down Expand Up @@ -1313,7 +1329,7 @@ def dashboard(project_alias=None, folder_id=None):
site_env=site_env, site_net=site_net, site_ver=site_ver,
kiosk=kiosk, user_address=user_address, project_disk=project_disk,
projects_links=projects_links, project_manager_link=project_manager_link,
analytics_code=settings.analytics_code, project_stats_other=project_stats_other)
analytics_code=settings.analytics_code, project_stats_other=project_stats_other, no_cols=None)


@cache.memoize()
Expand Down Expand Up @@ -2249,6 +2265,8 @@ def create_new_project():
" (%(project_id)s, 'project_checks', %(value)s)")
fcheck_insert = query_database_insert(fcheck_query, {'project_id': project_id, 'value': 'unique_file'})
fcheck_insert = query_database_insert(fcheck_query, {'project_id': project_id, 'value': 'tifpages'})
fcheck_insert = query_database_insert(fcheck_query, {'project_id': project_id, 'value': 'md5'})
fcheck_insert = query_database_insert(fcheck_query, {'project_id': project_id, 'value': 'md5_raw'})
file_check = request.values.get('raw_pair')
if file_check == "1":
fcheck_insert = query_database_insert(fcheck_query, {'project_id': project_id, 'value': 'raw_pair'})
Expand Down
Binary file added web_app/static/items/Brown_James18.jpg
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 web_app/static/items/Hank_Aaron.jpg
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 web_app/static/items/botany_accession_sample.jpg
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 web_app/static/items/sawhm_1.jpg
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 web_app/static/items/unionoida.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions web_app/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

{% if site_net == "internal" %}

<p>Image viewer uses Openseadragon 5.0.0.</p>

<p>This is a project of the: <a href="https://sinet.sharepoint.com/sites/DPO" title="Link to the SharePoint site of the Digitization Program Office">Digitization Program Office</a>, a division of the Smithsonian's <a href="https://sinet.sharepoint.com/sites/ODT" class="bg-white" title="Link to the Office of Digital Transformation
">Office of Digital Transformation</a> (formerly a division of the Office of the Chief Information Officer).</p>
{% else %}
Expand Down
104 changes: 14 additions & 90 deletions web_app/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -441,96 +441,20 @@ <h1 class="modal-title" id="previewmodal1Label">Image Preview (JPG)</h1>
[25, 50, 100, 'All'],
],
'rowCallback': function(row, data, index){
if(data[1] == 'OK'){
$(row).find('td:eq(1)').css('background', '#198754');
$(row).find('td:eq(1)').css('color', 'white');
} else if(data[1] == 'Failed'){
$(row).find('td:eq(1)').css('background', '#dc3545');
$(row).find('td:eq(1)').css('color', 'white');
} else if(data[1] == 'Pending'){
$(row).find('td:eq(1)').css('background', '#e2e3e5');
$(row).find('td:eq(1)').css('color', 'black');
};
if(data[3] == 'OK'){
$(row).find('td:eq(3)').css('background', '#198754');
$(row).find('td:eq(3)').css('color', 'white');
} else if(data[3] == 'Failed'){
$(row).find('td:eq(3)').css('background', '#dc3545');
$(row).find('td:eq(3)').css('color', 'white');
} else if(data[3] == 'Pending'){
$(row).find('td:eq(3)').css('background', '#e2e3e5');
$(row).find('td:eq(3)').css('color', 'black');
};
if(data[2] == 'OK'){
$(row).find('td:eq(2)').css('background', '#198754');
$(row).find('td:eq(2)').css('color', 'white');
} else if(data[2] == 'Failed'){
$(row).find('td:eq(2)').css('background', '#dc3545');
$(row).find('td:eq(2)').css('color', 'white');
} else if(data[2] == 'Pending'){
$(row).find('td:eq(2)').css('background', '#e2e3e5');
$(row).find('td:eq(2)').css('color', 'black');
};
if(data[4] == 'OK'){
$(row).find('td:eq(4)').css('background', '#198754');
$(row).find('td:eq(4)').css('color', 'white');
} else if(data[4] == 'Failed'){
$(row).find('td:eq(4)').css('background', '#dc3545');
$(row).find('td:eq(4)').css('color', 'white');
} else if(data[4] == 'Pending'){
$(row).find('td:eq(4)').css('background', '#e2e3e5');
$(row).find('td:eq(4)').css('color', 'black');
};
if(data[5] == 'OK'){
$(row).find('td:eq(5)').css('background', '#198754');
$(row).find('td:eq(5)').css('color', 'white');
} else if(data[5] == 'Failed'){
$(row).find('td:eq(5)').css('background', '#dc3545');
$(row).find('td:eq(5)').css('color', 'white');
} else if(data[5] == 'Pending'){
$(row).find('td:eq(5)').css('background', '#e2e3e5');
$(row).find('td:eq(5)').css('color', 'black');
};
if(data[6] == 'OK'){
$(row).find('td:eq(6)').css('background', '#198754');
$(row).find('td:eq(6)').css('color', 'white');
} else if(data[6] == 'Failed'){
$(row).find('td:eq(6)').css('background', '#dc3545');
$(row).find('td:eq(6)').css('color', 'white');
} else if(data[6] == 'Pending'){
$(row).find('td:eq(6)').css('background', '#e2e3e5');
$(row).find('td:eq(6)').css('color', 'black');
};
if(data[7] == 'OK'){
$(row).find('td:eq(7)').css('background', '#198754');
$(row).find('td:eq(7)').css('color', 'white');
} else if(data[7] == 'Failed'){
$(row).find('td:eq(7)').css('background', '#dc3545');
$(row).find('td:eq(7)').css('color', 'white');
} else if(data[7] == 'Pending'){
$(row).find('td:eq(7)').css('background', '#e2e3e5');
$(row).find('td:eq(7)').css('color', 'black');
};
if(data[8] == 'OK'){
$(row).find('td:eq(8)').css('background', '#198754');
$(row).find('td:eq(8)').css('color', 'white');
} else if(data[8] == 'Failed'){
$(row).find('td:eq(8)').css('background', '#dc3545');
$(row).find('td:eq(8)').css('color', 'white');
} else if(data[8] == 'Pending'){
$(row).find('td:eq(8)').css('background', '#e2e3e5');
$(row).find('td:eq(8)').css('color', 'black');
};
if(data[9] == 'OK'){
$(row).find('td:eq(9)').css('background', '#198754');
$(row).find('td:eq(9)').css('color', 'white');
} else if(data[9] == 'Failed'){
$(row).find('td:eq(9)').css('background', '#dc3545');
$(row).find('td:eq(9)').css('color', 'white');
} else if(data[9] == 'Pending'){
$(row).find('td:eq(9)').css('background', '#e2e3e5');
$(row).find('td:eq(9)').css('color', 'black');
};

{% for i in range(1, no_cols) %}
if(data[{{ i }}] == 'OK'){
$(row).find('td:eq({{ i }})').css('background', '#198754');
$(row).find('td:eq({{ i }})').css('color', 'white');
} else if(data[{{ i }}] == 'Failed'){
$(row).find('td:eq({{ i }})').css('background', '#dc3545');
$(row).find('td:eq({{ i }})').css('color', 'white');
} else if(data[{{ i }}] == 'Pending'){
$(row).find('td:eq({{ i }})').css('background', '#e2e3e5');
$(row).find('td:eq({{ i }})').css('color', 'black');
};
{% endfor %}

},
});

Expand Down
3 changes: 2 additions & 1 deletion web_app/templates/file.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ <h1 class="modal-title" id="postmodalLabel">Postprocessing Details</h1>
preload: true,
constrainDuringPan: true,
showRotationControl: true,
showNavigator: true
showNavigator: true,
maxZoomPixelRatio: 1
});
</script>

Expand Down
33 changes: 19 additions & 14 deletions web_app/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,16 @@
<!-- Project -->
<div class="row">
<div class="col">
<p style="font-size: large;" class="card-title"><strong>A Photoshoot with 26,000 Mussel Lots</strong></p>
<p style="font-size: large;" class="card-title"><strong>Digitizing the American Women's History Museum</strong></p>
</div>
</div>
<div class="row">
<div class="col-4">
<a href="{{ url_for('dashboard', project_alias = 'nmnh_unionoida') }}" title="Link to the Unionoida Project Dashboard"><img src="{{ url_for('static', filename='items/unionoida.jpg') }}" class="img-fluid" alt="Digitized specimen of freshwater mussel shells and scalebar" style="padding: 10px;"></a>
<a href="{{ url_for('homepage', team = 'is', subset = 'sawhm') }}" title="Link to the SAWHM Projects"><img src="{{ url_for('static', filename='items/sawhm_1.jpg') }}" class="img-fluid" alt="Logo of the SAWHM" style="padding: 10px;"></a>
</div>
<div class="col">
<p>We digitized over 26,000 lots, with up to three individuals per lot,
adding almost 140,000 images of freshwater mussels - otherwise known as the Mollusca order Unionoida.</p>
<a href="{{ url_for('dashboard', project_alias = 'nmnh_unionoida') }}" class="btn btn-sm btn-outline-primary" title="Link to the Unionoida Project Dashboard">Unionoida Project Dashboard</a>
<p>The Imaging Services team is digitizing collections and archives for the Smithsonian American Women's History Museum.</p>
<a href="{{ url_for('homepage', team = 'is', subset = 'sawhm') }}" class="btn btn-sm btn-outline-primary" title="Link to the SAWHM Projects">SAWHM Projects</a>
</div>
</div>
</div>
Expand All @@ -183,25 +182,26 @@
<a href="{{ url_for('dashboard', project_alias = 'botany_accessions') }}" title="Link to the Botany Annual Accessions Project Dashboard"><img src="{{ url_for('static', filename='items/botany_accession_sample.jpg') }}" class="img-fluid" alt="Digitized mounted specimen from the National Herbarium Collection" style="padding: 10px;"></a>
</div>
<div class="col">
<p>The new Imaging Services Team continues to digitize the Herbarium of the National Museum of Natural History. The project digitizes new accessions to the collection.</p>
<p>We continue to digitize the Herbarium of the National Museum of Natural History. The project digitizes new accessions to the collection.</p>
<a href="{{ url_for('dashboard', project_alias = 'botany_accessions') }}" class="btn btn-sm btn-outline-primary" title="Link to the Botany Annual Accessions Project Dashboard">Botany Project Dashboard</a>
</div>
</div>
</div>
<div class="col-6">
<!-- Project -->
<div class="row">
<!-- Project -->
<div class="row">
<div class="col">
<br><p style="font-size: large;" class="card-title"><strong> &nbsp; </strong></p>
<br><p style="font-size: large;" class="card-title"><strong>A Photoshoot with 26,000 Mussel Lots</strong></p>
</div>
</div>
<div class="row">
<div class="col-4">
&nbsp;
<a href="{{ url_for('dashboard', project_alias = 'nmnh_unionoida') }}" title="Link to the Unionoida Project Dashboard"><img src="{{ url_for('static', filename='items/unionoida.jpg') }}" class="img-fluid" alt="Digitized specimen of freshwater mussel shells and scalebar" style="padding: 10px;"></a>
</div>
<div class="col">
<p>&nbsp;</p>

<p>We digitized over 26,000 lots, with up to three individuals per lot,
adding almost 140,000 images of freshwater mussels - otherwise known as the Mollusca order Unionoida.</p>
<a href="{{ url_for('dashboard', project_alias = 'nmnh_unionoida') }}" class="btn btn-sm btn-outline-primary" title="Link to the Unionoida Project Dashboard">Unionoida Project Dashboard</a>
</div>
</div>
</div>
Expand All @@ -222,7 +222,7 @@
{% elif team == "is" %}

<p><strong>Imaging Services</strong> acts as a focal point in the Smithsonian Institution for photographic support. Addressing a crucial need within the Smithsonian Institution by providing digital imaging support for annually accessioned objects (referred to as "keep-up" digitization) and for small-scale collections, particularly in smaller museums and departments lacking staff photographers. These projects may be executed by the unit under the supervision and training of Imaging Services, or directly undertaken by Imaging Services' in-house imaging staff, without the involvement of external vendors.</p>

<hr>

{% for table in tables_is %}
Expand Down Expand Up @@ -365,7 +365,12 @@ <h1 class="modal-title" id="loginModalLabel">Log In to the System</h1>

$('#list_projects_md').append('<caption style="caption-side: top;"><h2>Mass Digitization Projects</h2></caption>');

$('#list_projects_is').append('<caption style="caption-side: top;"><h2>Imaging Services Projects</h2></caption>');
{% if subset is not none %}
$('#list_projects_is').append('<caption style="caption-side: top;"><h2>Imaging Services Projects (SAWHM projects only)</h2></caption>');
{% else %}
$('#list_projects_is').append('<caption style="caption-side: top;"><h2>Imaging Services Projects</h2></caption>');
{% endif %}


$('#list_projects_inf').append('<caption style="caption-side: top;"><h2>Informatics Projects (under construction)</h2></caption>');

Expand Down

0 comments on commit 73bdb89

Please sign in to comment.