adding very preliminary by_species dig
This commit is contained in:
@@ -0,0 +1,91 @@
|
|||||||
|
/* style sheet */
|
||||||
|
* {
|
||||||
|
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||||
|
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: rgb(119, 196, 135);
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
display:block;
|
||||||
|
float:top;
|
||||||
|
width:33%;
|
||||||
|
margin-left:0;
|
||||||
|
margin-right:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
background-color: rgb(219, 255, 235);
|
||||||
|
margin: 0 auto;
|
||||||
|
font-size: large;
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-size: xx-large;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin-left: -150px;
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
background-color: rgb(219, 255, 235);
|
||||||
|
font-weight: lighter;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: rgb(219, 255, 235);
|
||||||
|
font-weight: bold;
|
||||||
|
border: 1px solid black;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: transparent;
|
||||||
|
font-size: large;
|
||||||
|
border:none;
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1000px) {
|
||||||
|
h2 {
|
||||||
|
margin-left: 0;
|
||||||
|
text-align: center;
|
||||||
|
color: black;
|
||||||
|
font-size: large;
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
body::-webkit-scrollbar {
|
||||||
|
display:none
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
|
if($db == False){
|
||||||
|
echo "Database is busy";
|
||||||
|
header("refresh: 0;");
|
||||||
|
}
|
||||||
|
|
||||||
|
$statement = $db->prepare('SELECT DISTINCT(Com_Name) from detections ORDER BY Com_Name');
|
||||||
|
if($statement == False){
|
||||||
|
echo "Database is busy";
|
||||||
|
header("refresh: 0;");
|
||||||
|
}
|
||||||
|
$result = $statement->execute();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="stylesheet" href="play.css">
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
while($results=$result->fetchArray(SQLITE3_ASSOC))
|
||||||
|
{
|
||||||
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
|
$comlink = "/By_Date/".date('Y-m-d')."/".$comname;
|
||||||
|
?>
|
||||||
|
<div class="column">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<form action="" method="POST">
|
||||||
|
<td>
|
||||||
|
<button action="submit" name="species" value="<?php echo $results['Com_Name'];?>"><?php echo $results['Com_Name'];?></button>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}?>
|
||||||
|
<?php
|
||||||
|
if(isset($_POST['species'])){
|
||||||
|
$name = $_POST['species'];
|
||||||
|
$statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" ORDER BY Date DESC, Time DESC");
|
||||||
|
if($statement2 == False){
|
||||||
|
echo "Database is busy";
|
||||||
|
header("refresh: 0;");
|
||||||
|
}
|
||||||
|
$result2 = $statement2->execute();
|
||||||
|
echo "<table>
|
||||||
|
<tr>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Scientific Name</th>
|
||||||
|
<th>Common Name</th>
|
||||||
|
<th>Confidence</th>
|
||||||
|
</tr>";
|
||||||
|
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
||||||
|
{
|
||||||
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
|
$date = $results['Date'];
|
||||||
|
$comlink = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
||||||
|
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
|
||||||
|
$sci_name = $results['Sci_Name'];
|
||||||
|
$time = $results['Time'];
|
||||||
|
$confidence = $results['Confidence'];
|
||||||
|
echo "<tr>
|
||||||
|
<td>$date</td>
|
||||||
|
<td><a href=\"$comlink\" target=\"footer\"/>$time</a></td>
|
||||||
|
<td><a href=\"https://wikipedia.org/wiki/$sciname\" target=\"top\">$sci_name</a></td>
|
||||||
|
<form action=\"/stats.php\" method=\"POST\">
|
||||||
|
<td><button type=\"submit\" name=\"species\" value=\"$name\">$name</button>
|
||||||
|
</form></td>
|
||||||
|
<td>$confidence</td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
}echo "</table>";}?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+6
-23
@@ -150,7 +150,9 @@ select {
|
|||||||
<section>
|
<section>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="column first">
|
<div class="column first">
|
||||||
<h3>Summary</h3>
|
<?php if(!isset($_POST['species'])){
|
||||||
|
echo "<p style=\"text-align:center;font-size:large;\">Choose a species below to show statistics.</p>";
|
||||||
|
};?>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Common Name</th>
|
<th>Common Name</th>
|
||||||
@@ -175,31 +177,13 @@ $sciname = preg_replace('/ /', '_', $results['Sci_Name']);
|
|||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="column second">
|
|
||||||
<form style="margin:0;width:100%;" action="stats.php" method="POST">
|
|
||||||
<h3>Species Stats</h3>
|
|
||||||
<select name="species" >
|
|
||||||
<option value="<?php if(isset($_POST['species'])){echo $selection;}?>"><?php if(isset($_POST['species'])){echo $selection;}else{echo "--Choose Species--";}?></option>
|
|
||||||
<?php
|
|
||||||
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
|
||||||
{
|
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
|
||||||
$comlink = "/By_Date/".date('Y-m-d')."/".$comname;
|
|
||||||
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $results['Com_Name'];?>"><?php echo $results['Com_Name'];?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<button type="submit" class="block"/>Show Species Statistics</button>
|
|
||||||
</form>
|
|
||||||
<?php if(isset($_POST['species'])){
|
<?php if(isset($_POST['species'])){
|
||||||
$species = $_POST['species'];
|
$species = $_POST['species'];
|
||||||
$str = "<h3>$species</h3>
|
$str = "<div class=\"column second\">
|
||||||
|
<h3>$species</h3>
|
||||||
|
<h3>Species Stats</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Common Name</th>
|
|
||||||
<th>Scientific Name</th>
|
<th>Scientific Name</th>
|
||||||
<th>Occurrences</th>
|
<th>Occurrences</th>
|
||||||
<th>Highest Confidence Score</th>
|
<th>Highest Confidence Score</th>
|
||||||
@@ -220,7 +204,6 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){
|
|||||||
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbsciname");
|
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbsciname");
|
||||||
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbsciname");
|
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbsciname");
|
||||||
$str= "<tr>
|
$str= "<tr>
|
||||||
<td>$name</td>
|
|
||||||
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>$sciname</a></td>
|
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>$sciname</a></td>
|
||||||
<td>$count</td>
|
<td>$count</td>
|
||||||
<td>$maxconf</td>
|
<td>$maxconf</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user