Skip to content

Commit

Permalink
Project files added
Browse files Browse the repository at this point in the history
  • Loading branch information
John Dawson committed Aug 20, 2014
1 parent 90e3c7a commit 291138d
Show file tree
Hide file tree
Showing 18 changed files with 3,151 additions and 0 deletions.
27 changes: 27 additions & 0 deletions OCRdata.csv

Large diffs are not rendered by default.

236 changes: 236 additions & 0 deletions OCRdata.json

Large diffs are not rendered by default.

Binary file added OCRdata.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions bloodaxe_db.json

Large diffs are not rendered by default.

Binary file added chevron.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions cleanJson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"poets","children":[{"name":"ADC","value":13},{"name":"AST","value":3},{"name":"ATT","value":20},{"name":"AUS","value":5},{"name":"BEL","value":23},{"name":"BEN","value":14},{"name":"BER","value":6},{"name":"CAS","value":18},{"name":"CLB","value":7},{"name":"COD","value":24},{"name":"COS","value":23},{"name":"DAG","value":4},{"name":"ELL","value":4},{"name":"GAE","value":6},{"name":"GRG","value":16},{"name":"GRJ","value":2},{"name":"HIL","value":22},{"name":"HYL","value":2},{"name":"KAY","value":1},{"name":"LON","value":12},{"name":"MAU","value":1},{"name":"MOV","value":1},{"name":"OSI","value":6},{"name":"POL","value":2},{"name":"RAN","value":13},{"name":"THD","value":7}]}
138 changes: 138 additions & 0 deletions connect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php

// increase timeout for large data transfer
ini_set('max_execution_time', 300); //300 seconds = 5 minutes


// ========== CONNECT TO DATABASE ========== //


$connect = mysqli_connect("localhost", "root", "");
// check connection
if (!$connect)
{
die('Could not connect: ' . mysql_error());
exit();
}

// select database
mysqli_select_db($connect, 'poeticarchive');

// save XML document as a variable reference
$xml = simplexml_load_file("edit.xml");


// ========== COLLECT DATA FROM XML ========== //


// initialise variables
$aID="";
$name="";
$bio="";
$book="";
$personArray=array();

// set path for 'Editorial'
$apath = $xml->xpath('//c01') ;
// set path for 'Published Books by Poet'
$c02 = $apath[0]->xpath('//c02');
//echo sizeof($c02),"\n";
$c01 = $xml->xpath('//ead/archdesc/dsc/c01'); ///

$c01[0]->xpath('/c02');
//echo "tags :",sizeof($c02);

$authors = $xml->xpath('//ead/archdesc/dsc/c01/c02[1]/c03');
//echo sizeof($authors);
foreach ($authors as $author) {
//echo sizeof($author),"\n";//->xpath('/did/unitid//@identifier');
//echo $author->xpath('.//unittitle')[0];

//echo $author->xpath('.//unitid//@identifier')[0];
foreach ($author->children() as $child){
//echo $child->getName(),"<br>";

$bioTogether ="";
if($child->getName() =='bioghist'){

//print_r($child);

foreach ($child as $bit) {
$bioTogether.=$bit;
}
echo $bioTogether,"<br>";
}
}
//echo $author['bioghist'];//->xpath('.//bioghist'),"<br>";
//$consolidatedBio = implode("\n", $biogs);
//echo $author[2];// $consolidatedBio, "\n";


$name = $author->xpath('.//unittitle')[0];
$unitID = $author->xpath('.//unitid//@identifier')[0];

// echo sizeof($author->xpath('//did/unitid//@identifier')),"\n";//->xpath('/did/unitid//@identifier');
$person = array("AuthorID"=>$aID,
"Name"=>$name,
"Biography"=>$bio,
"Books"=>$book);
array_push($personArray, $person);
# code...
}
/*foreach ($c03 as $c04) {
// id value
//$aID = $c03->xpath('//ead/archdesc/dsc/c01/c02[1]/c03/did/unitid//@identifier');
// full name
//$name = $c03->xpath('//ead/archdesc/dsc/c01/c02[1]/c03/did/unittitle[1]');
//echo $c04,"\n";
//echo sizeof($name),"\n";
// biography value
//$bio = $c03->xpath('//ead/archdesc/dsc/c01/c02[1]/c03/bioghist//p');
//echo sizeof($bio),"\n";
// books by author value
//$book = $c03->xpath("//ead/archdesc/dsc/c01//c02[1]/c03/c04/did//unittitle");
// store the values into an array
$person = array("AuthorID"=>$aID,
"Name"=>$name,
"Biography"=>$bio,
"Books"=>$book);
array_push($personArray, $person);
}*/

//print_r($personArray);
for ($i=0; $i <sizeof($personArray) ; $i++) {
# code...
// echo $personArray[$i]['Name'];
}
/* foreach ($person as $key=>$values) {
foreach ($values as $value) {
echo strtoupper($key) . "<br>" . $value . "<br>";
}
} /*
// ========== EXPORT DATA INTO DATABASE ========== //
// inserts recorded values into database
/* while(list( , $node)= each($aID)) {
mysqli_query($connect, "INSERT INTO person(AuthorID) VALUES ('$node')");
} */

/* perhaps instead use e.g. UPDATE person SET AuthorID='$node' */

/* while(list( , $node)= each($name)) {
mysqli_query($connect, "INSERT INTO person(Name) VALUES ('$node')");
}
while(list( , $node)= each($bio)) {
mysqli_query($connect, "INSERT INTO person(Biography) VALUES ('$node')");
}
while(list( , $node)= each($book)) {
mysqli_query($connect, "INSERT INTO person(Books) VALUES ('$node')");
} */
/* perhaps instead use e.g. iterate table via id, UPDATE person SET Books='$node' WHERE AuthorID=(current id)
i.e. for EACH of the 250 author ids, set 'books' to all the unittitles under that id */

// close connection
mysqli_close($connect);

?>
26 changes: 26 additions & 0 deletions createJSON.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

// creates the JSON necessary for the D3 bubble chart in script.js
$rawJson = json_decode(file_get_contents("OCRdata.json"), true);

$wholeJson = array();
$wholeJson["name"] = "poets";
// $wholeJson["value"] = 255;

$cleanJson = array();

foreach ($rawJson as $item) {

$anItem = array(
"name" => $item["ID"],
"value" => $item["PDFS"]

);
array_push($cleanJson, $anItem);
//$cleanJson = array_merge($anItem, $cleanJson);

}
$wholeJson["children"] = $cleanJson;
file_put_contents('cleanJson.json', json_encode($wholeJson));

?>
60 changes: 60 additions & 0 deletions createTables.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

// create connection
$connect = mysqli_connect("localhost", "root", "");
// check connection
if (!$connect)
{
die('Could not connect: ' . mysql_error());
exit();
}

// select database
mysqli_select_db($connect, 'poeticarchive');

// create tables
$sql1 = "CREATE TABLE Person(AuthorID VARCHAR(15),
Name VARCHAR(30),
Biography VARCHAR(500),
Books VARCHAR(100) )";

// execute query
if (mysqli_query($connect, $sql1)) {
echo "Table 'Person' created successfully";
} else {
echo "Error creating table: " .mysqli_error($connect);
}

$sql2 = "CREATE TABLE Book(BookID INT,
Title VARCHAR(30),
Anthology BOOLEAN,
Authors VARCHAR(100),
RelatedMaterials VARCHAR(200),
DatePublished VARCHAR(10),
Editor VARCHAR(10),
ImageCredits VARCHAR(10) )";

// execute query
if (mysqli_query($connect, $sql2)) {
echo "Table 'Book' created successfully";
} else {
echo "Error creating table: " .mysqli_error($connect);
}

$sql3 = "CREATE TABLE Poem(PoemID INT,
Author VARCHAR(20),
DatePublished VARCHAR(10),
Title VARCHAR(30),
Dedication VARCHAR(20) )";

// execute query
if (mysqli_query($connect, $sql3)) {
echo "Table 'Poem' created successfully";
} else {
echo "Error creating table: " .mysqli_error($connect);
}

// close connection
mysqli_close($connect);

?>
1 change: 1 addition & 0 deletions db_Data.json

Large diffs are not rendered by default.

106 changes: 106 additions & 0 deletions edit.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions get-csv.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

header('Content-Type: text/plain');
$csv = file_get_contents('OCRdata.csv');
echo $csv;

?>
66 changes: 66 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>

<head>

<meta charset="UTF-8"/>
<title>Bloodaxe Books Digital Archives</title>

<!-- link to CSS stylesheet, fonts & plugins -->
<link rel="stylesheet" type="text/css" href="style.css"/>
<link href='http://fonts.googleapis.com/css?family=Raleway:400,900' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Lora:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="magnific/dist/magnific-popup.css">
<link href="tipsy/tipsy.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="fancyBox/source/jquery.fancyBox.css" type="text/css" media="screen" />
<!--[if lt IE 9] >
<script src="dist/html5shiv.js"></script>
<![endif]-->

<!-- links to various javascript files used -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script type="text/javascript" src="d3/d3.js"></script>
<script src="script.js"/></script>
<script src="jquery.csv-0.71.js"/></script>
<script src="magnific/dist/jquery.magnific-popup.js"></script>
<script src="elevatezoom/jquery.elevatezoom.js" type="text/javascript"></script>
<script type="text/javascript" src="tipsy/jquery.tipsy.js"></script>
<script type="text/javascript" src="fancyBox/source/jquery.fancybox.pack.js"></script>

<meta name="keywords" content="generous interfaces, data visualisation, digital archive, poetry, d3 bubble chart"/>
<meta name="description" content="A represention of a digital archive based on the theory of Generous Interfaces."/>
<meta name="author" content="John Dawson"/>

</head>

<html lang="en">
<body>

<header>
<div class="wrapper">
<h1 class="logo">Bloodaxe Digital Archive: Bubble Chart</h1>
</div> <!-- wrapper -->
</header>

<article class="about">
<div class="wrapper">
<p>The aim of this site is to provide an alternative means of navigating a digital archive using <a href="http://mtchl.net/tag/generousinterfaces/" id="mail">Generous Interfaces.</a></p>
<p>The 'bubbles' have an author ID associated with them and their size is determined by the nunber of manuscripts available.</p>
<br/>
<p class="instruct">Please click on an author ID to view more detailed information.</p>
</div> <!-- wrapper -->
</article> <!-- about -->

<div id="mainBlock"></div>

<div id="imageContainer"></div>

<footer class="credit">
<div class="wrapper">
<h4 class="instruct">Credit</h4>
<p><a href="mailto:[email protected]" id="mail">John Dawson</a> & Tom Schofield @ <a href="http://www.ncl.ac.uk/culturelab/" id="mail">Culture Lab, Newcastle University</a></p>
</div> <!-- wrapper -->
</footer>

</body>
</html>
Loading

0 comments on commit 291138d

Please sign in to comment.