Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
demjanp committed Mar 3, 2023
0 parents commit 4207801
Show file tree
Hide file tree
Showing 41 changed files with 3,454 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Arch14CZ - Frontend
Frontend interface for [Arch14CZ - Czech Archaeological Radiocarbon Database](https://arch14.cz)

Created on 14. 12. 2021

**Table of Contents**
1. [About Arch14CZ](#about)
2. [Developer Notes](#developer)
1. [Cloning the GitHub Project](#cloning)
2. [Publishing the Frontend](#publishing)
3. [Contact](#contact)
4. [Acknowledgements](#acknowledgements)
5. [License](#license)

## About Arch14CZ - Frontend <a name="about"></a>
Frontend web interface for [Arch14CZ - Czech Archaeological Radiocarbon Database](https://arch14.cz)

Original repository of the author: <https://github.com/demjanp/arch14cz_frontend>.

For the backend interface see the [arch14cz_backend](https://github.com/ARUP-CAS/aiscr-arch14cz-backend) project.

Please cite this sofware as:
> Demján, P. 2021: Arch14CZ - Frontend, GitHub repository, Available at: <https://github.com/ARUP-CAS/aiscr-arch14cz-frontend>
## Developer Notes <a name="developer"></a>
Arch14CZ - Frontend requires PHP 5 and PostgreSQL installed on the server.

### Cloning the GitHub Project <a name="cloning"></a>

To clone the `aiscr-arch14cz-frontend` GitHub project, follow these steps:

1. Make sure you have [Git](https://git-scm.com/downloads) installed on your computer.
2. Open a terminal or command prompt window.
3. Navigate to the Arch14CZ - Frontend root directory.
4. Run the following command:
<pre><code>git clone https://github.com/ARUP-CAS/aiscr-arch14cz-frontend.git</code></pre>
5. The repository will be cloned to a new directory named `aiscr-arch14cz-frontend` in your current directory.

### Publishing the Frontend <a name="publishing"></a>

1. Download the [latest release](https://github.com/ARUP-CAS/aiscr-arch14cz-frontend/releases/latest).
2. Edit the `db_connect.php` file to reflect the correct the hostname, database name, username and password of the Arch14CZ frontend database.
3. Upload the contents of the folder `src/arch14cz_frontend` to the root directory on the web server.

## Contact: <a name="contact"></a>
Peter Demján (peter.demjan@gmail.com)

Institute of Archaeology of the Czech Academy of Sciences, Prague, v.v.i.

## Acknowledgements <a name="acknowledgements"></a>

Development of this software was supported by OP RDE, MEYS, under the project "Ultra-trace isotope research in social and environmental studies using accelerator mass spectrometry", Reg. No. CZ.02.1.01/0.0/0.0/16_019/0000728.

This software uses the following open source packages:
* [PHP_XLSXWriter](https://github.com/mk-j/PHP_XLSXWriter)
* [Zoom](https://github.com/jackmoore/zoom)

## License <a name="license"></a>

This code is licensed under the [GNU GENERAL PUBLIC LICENSE](https://www.gnu.org/licenses/gpl-3.0.en.html) - see the [LICENSE](LICENSE) file for details
40 changes: 40 additions & 0 deletions THIRDPARTY.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
THIRD-PARTY COPYRIGHTS OF INTEGRATED COMPONENTS
===============================================

PHP_XLSXWriter
==============

The MIT License (MIT)

Copyright (c) 2013 Mark Jones

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Zoom
====

The MIT License (MIT)

Copyright (c) 2015 Jack Moore

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
95 changes: 95 additions & 0 deletions src/arch14cz_frontend/about.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php
require_once("db_connect.php");
$metadata = pg_query($db, "SELECT * FROM frontend.c_14_metadata");
$date_updated = "";
while ($row = pg_fetch_assoc($metadata)) {
if ($row["Variable"] == "date_updated") {
$date_updated = $row["Value"];
};
}
$date_now = date("d.m.Y");
?>
<div class="column">
<h2 class="first">About the Database</h2>
<p>The purpose of the Czech Archaeological Radiocarbon Database (Arch14CZ) is to gather all radiocarbon dates from archaeological contexts in Czechia. Outside the scope remains radiocarbon dating of palaeoecological contexts without direct human impact, like palynological cores or anthracological sampling. On the other hand, unlimited is the chronological scope of Arch14CZ, meaning that all periods of archaeological research are covered.</p>
<p>It was developed within the project RAMSES (Ultra-trace isotope research in social and environmental studies using accelerator mass spectrometry) and has been available online since March 2023. It is integrated into the framework of the <a href="https://www.aiscr.cz">Archaeological Information System of the Czech Republic</a> administered by the Institutes of Archaeology of the Czech Academy of Sciences with the intention to ensure long-term maintenance and periodic updates.</p>

<h2>Citation</h2>
<p>Please cite the database as</p>
<blockquote>
<p>Vondrovský, V. - Demján, P. - Dreslerová, D. 2023: Arch14CZ - Czech Archaeological Radiocarbon Database. Available at: <a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/">http://<?php echo $_SERVER['SERVER_NAME']; ?>/</a> [accessed <?php echo $date_now;?>].</p>
</blockquote>

<h2>Data Structure</h2>
<p>The database contains the following fields:</p>
<ol>
<li><strong>Arch14CZ ID</strong> - Unique ID.</li>
<li><strong>Lab Code</strong> - The laboratory code is unique for each sample and serves to identify it. It also carries information about the laboratory that measured the sample.</li>
<li><strong>14C Activity</strong> - C-14 measurement in radiocarbon (uncalibrated) years BP.</li>
<li><strong>14C Uncertainty</strong> - 1-sigma uncertainty of the measurement.</li>
<li><strong>Cal CE From, Cal CE To</strong> - 95.45% range of the calibrated radiocarbon date in calendar years of the Common Era.</li>
<li><strong>Notes</strong></li>
<li><strong>Reliability</strong> - Reliability of the C-14 dating in respect to the archaeological context.</li>
<li><strong>Reliability Notes</strong></li>
<li><strong>Country</strong></li>
<li><strong>Country Code</strong></li>
<li><strong>District</strong></li>
<li><strong>District Code</strong></li>
<li><strong>Cadastre</strong></li>
<li><strong>Cadastre Code</strong></li>
<li><strong>Site</strong> - Unique name of the site where the sample was collected.</li>
<li><strong>Site AMCR ID</strong> - ID of the Site in the Archaeological Map of the Czech Republic.</li>
<li><strong>Coordinates</strong> - WGS 84 standard, format XX.XXXXXXXN, XX.XXXXXXXE</li>
<li><strong>Activity Area</strong> - Type of the archaeological activity area according to the AMCR dictionary.</li>
<li><strong>Activity Area AMCR ID</strong></li>
<li><strong>Feature</strong> - Type of the archaeological feature according to the AMCR dictionary.</li>
<li><strong>Feature AMCR ID</strong></li>
<li><strong>Context Description</strong> - Description of the position of the sample within the feature.</li>
<li><strong>Depth cm</strong> - Depth at which the sample was retrieved.</li>
<li><strong>Context Name</strong> - Identifier of the context within the site.</li>
<li><strong>Published Relative Dating</strong> - Relative dating of the context as published in the original source.</li>
<li><strong>Relative Dating AMCR ID</strong></li>
<li><strong>Dating Order From, Dating Order To</strong> - Ordering of the relative dating of the context based on relative chronological relations with the other datings.</li>
<li><strong>Sample Number</strong> - ID assigned by the submitter of the dated sample.</li>
<li><strong>Sample Notes</strong> - Includes collagen values and other accompanying measurements.</li>
<li><strong>Material</strong> - General type of the material of the sample.</li>
<li><strong>Material AMCR ID</strong></li>
<li><strong>Material Notes</strong> - Detailed description of the material.</li>
<li><strong>Source</strong> - Primary (usually a publication) and Secondary (usually a database) sources of information about the C-14 measurement.</li>
</ol>

<h2>Sources</h2>
<p>All data is based on published sources that are properly cited. Some of the records were previously published in other databases, such as the database <em>Archaeological Chronometry in Slovakia</em> (<a href="http://www.c14.sk">c14.sk</a>) <small><a href="#foot1">1</a></small>, the database of the project <em>Land use, social transformations and woodland in Central European Prehistory</em> (<a href="http://doi.org/10.5334/joad.85">LASOLES</a>) <small><a href="#foot2">2</a></small> and <em>The Cultural Evolution of Neolithic Europe</em> (<a href="https://discovery.ucl.ac.uk/id/eprint/1469811">EUROEVOL</a>) dataset <small><a href="#foot3">3</a></small>. Data from these sources have been verified with the original publications and further enhanced with information about the context and dated sample. In such cases, the database is cited as a secondary source.</p>

<h2>Last Update</h2>
<p>Latest database update: <?php echo $date_updated;?></p>

<h2>Contact</h2>
<p>Did you notice any mistakes or missing dates? Do you want to upload your radiocarbon dates? Do you have questions concerning the database?</p>
<p>Let us know at <a href="mailto:vondrovsky@arup.cas.cz">vondrovsky@arup.cas.cz</a></p>

<h2>Developer Notes</h2>
<p>The frontend and backend interface of this database is Free and Open Source and available at the following locations:</p>
<p><a href="https://github.com/demjanp/arch14cz_backend">Arch14CZ - Backend</a></p>
<p><a href="https://github.com/demjanp/arch14cz_frontend">Arch14CZ - Frontend</a></p>

<h2>Acknowledgements</h2>
<p>Development of this database was supported by OP RDE, MEYS, under the project &quot;Ultra-trace isotope research in social and environmental studies using accelerator mass spectrometry&quot;, Reg. No. CZ.02.1.01/0.0/0.0/16_019/0000728.</p>
<p><img src="static/EU_logo.png"/><img src="static/MSMT_logo.png"/></p>
<p>The operation of Arch14CZ is supported by the large research infrastructure project AIS CR (LM2023031).</p>
<p><img src="static/AISCR_logo.png"/></p>

<h2>License</h2>
<p>The content of this page is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International Licence</a>. Use of data and metadata is subject to this license unless explicitly stated otherwise.</p>

<h2>References</h2>
<small>
<p>
[1]<a name="foot1"></a>: Barta, P. - Demján, P. - Hladíková, K. - Kmeťová, P. - Piatničková, K. 2013: Database of radiocarbon dates measured on archaeological samples from Slovakia, Czechia, and adjacent regions. Archaeological Chronometry in Slovakia, Slovak Research and Development Agency Project No. APVV-0598-10, 2011 -2014, Dept. of Archaeology, Faculty of Arts, Comenius University in Bratislava. Available at: <a href="http://www.c14.sk">http://www.c14.sk</a>
</p>
<p>[2]<a name="foot2"></a>: Tkáč, P. – Kolář, J. 2021: Towards New Demography Proxies and Regional Chronologies: Radiocarbon Dates from Archaeological Contexts Located in the Czech Republic Covering the Period Between 10,000 BC and AD 1250. Journal of Open Archaeology Data 9, 9. <a href="http://doi.org/10.5334/joad.85">http://doi.org/10.5334/joad.85</a>
</p>
<p>[3]<a name="foot3"></a>: Manning, K. - Colledge, S. - Crema, E. - Shennan, S. - Timpson, A. 2016: The Cultural Evolution of Neolithic Europe. EUROEVOL Dataset 1: Sites, Phases and Radiocarbon Data. Journal of Open Archaeology Data, 5(0), p.e2. <a href="https://doi.org/10.5334/joad.40">https://doi.org/10.5334/joad.40</a>
</p>
</small>
</div>
19 changes: 19 additions & 0 deletions src/arch14cz_frontend/api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
require_once("db_connect.php");

function sanitize_value($value) {

echo htmlspecialchars($value, ENT_XML1, 'UTF-8');
}

$schema_uri = "https://".$_SERVER['SERVER_NAME']."/schema/1.0/";

if (!isset($_GET["verb"])) {
;
} else if (isset($_GET["name"])) {
require_once($_SERVER['DOCUMENT_ROOT']."/api_verbs/".$_GET["verb"]."_".$_GET["name"].".php");
} else {
require_once($_SERVER['DOCUMENT_ROOT']."/api_verbs/".$_GET["verb"].".php");
}
pg_close($db);
?>
39 changes: 39 additions & 0 deletions src/arch14cz_frontend/api_doc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
$server = "http://".$_SERVER['SERVER_NAME'];
?>

<div class="column">
<h2 class="first">Arch14CZ - API</h2>
<p>The Arch14CZ database can be accessed via an API in XML format.</p>
<p><a href="<?php echo $server; ?>/schema/1.0/arch14cz.xsd">XML schema</a></p>
<p>Different types of data are queried using the following verbs:</p>
<h3>ListMetadata</h3>
<p>Query: <a href="?verb=ListMetadata"><?php echo $server; ?>/?verb=ListMetadata</a></p>
<p>Retrieves metadata about the database, such as the date of last update.</p>
<h3>ListRecords</h3>
<p>Query: <a href="?verb=ListRecords"><?php echo $server; ?>/?verb=ListRecords</a></p>
<p>Retrieves all records of the database.</p>
<h3>GetRecord</h3>
<p>Query: <a href="?verb=GetRecord&amp;identifier=A14CZ_20230301_0004"><?php echo $server; ?>/?verb=GetRecord&amp;identifier=A14CZ_20230301_0004</a></p>
<p>Retrieves one record based on the Arch14CZ ID.</p>
<h3>GetLabCode</h3>
<p>Query: <a href="?verb=GetLabCode&amp;code=CRL-9105"><?php echo $server; ?>/?verb=GetLabCode&amp;code=CRL-9105</a></p>
<p>Retrieves one record based on the Lab Code.</p>
<h3>ListDictionary</h3>
<p>Retrieves contents of different dictionaries used in the <a href="<?php echo $server; ?>/?page=query">query form</a>.
The following dictionaries can be retrieved:</p>
<h4>Country</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=Country"><?php echo $server; ?>/?verb=ListDictionary&amp;name=Country</a></p>
<h4>District</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=District"><?php echo $server; ?>/?verb=ListDictionary&amp;name=District</a></p>
<h4>Cadastre</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=Cadastre"><?php echo $server; ?>/?verb=ListDictionary&amp;name=Cadastre</a></p>
<h4>Relative Dating</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=Relative_Dating"><?php echo $server; ?>/?verb=ListDictionary&amp;name=Relative_Dating</a></p>
<h4>Activity Area</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=Activity_Area"><?php echo $server; ?>/?verb=ListDictionary&amp;name=Activity_Area</a></p>
<h4>Feature</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=Feature"><?php echo $server; ?>/?verb=ListDictionary&amp;name=Feature</a></p>
<h4>Material</h4>
<p>Query: <a href="?verb=ListDictionary&amp;name=Material"><?php echo $server; ?>/?verb=ListDictionary&amp;name=Material</a></p>
</div>
57 changes: 57 additions & 0 deletions src/arch14cz_frontend/api_verbs/GetLabCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
header('Content-Type: application/xml; charset=utf-8');
header('Content-Disposition: inline; filename=Record_'.$_GET["code"].'.xml');

function calcOrder($row) {

$order = explode(",", substr($row["Relative_Dating_Order"], 1, -1));
$from = min($order);
$to = max($order);
$row["Order_From"] = $from;
$row["Order_To"] = $to;

return $row;
}

?>
<?xml version="1.0" encoding="utf-8" ?>
<arch14cz:table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:arch14cz="<?php echo $schema_uri; ?>" xsi:schemaLocation="<?php echo $schema_uri." ".$schema_uri."arch14cz.xsd"; ?>">
<?php
$results = pg_query($db, "SELECT * FROM frontend.c_14_main WHERE \"C_14_Lab_Code\" = '".$_GET["code"]."'");
while($row = pg_fetch_assoc($results)) {
$row = calcOrder($row);
?>
<arch14cz:record_row>
<arch14cz:Arch14CZ_ID><?php sanitize_value($row["Arch14CZ_ID"]); ?></arch14cz:Arch14CZ_ID>
<arch14cz:C_14_Lab_Code><?php sanitize_value($row["C_14_Lab_Code"]); ?></arch14cz:C_14_Lab_Code>
<arch14cz:C_14_Activity><?php sanitize_value($row["C_14_Activity"]); ?></arch14cz:C_14_Activity>
<arch14cz:C_14_Uncertainty><?php sanitize_value($row["C_14_Uncertainty"]); ?></arch14cz:C_14_Uncertainty>
<arch14cz:C_14_CE_From><?php sanitize_value($row["C_14_CE_From"]); ?></arch14cz:C_14_CE_From>
<arch14cz:C_14_CE_To><?php sanitize_value($row["C_14_CE_To"]); ?></arch14cz:C_14_CE_To>
<arch14cz:C_14_Note><?php sanitize_value($row["C_14_Note"]); ?></arch14cz:C_14_Note>
<arch14cz:Reliability><?php sanitize_value($row["Reliability"]); ?></arch14cz:Reliability>
<arch14cz:Reliability_Note><?php sanitize_value($row["Reliability_Note"]); ?></arch14cz:Reliability_Note>
<arch14cz:Country ID="<?php sanitize_value($row["Country_Code"]); ?>"><?php sanitize_value($row["Country"]); ?></arch14cz:Country>
<arch14cz:District ID="<?php sanitize_value($row["District_Code"]); ?>"><?php sanitize_value($row["District"]); ?></arch14cz:District>
<arch14cz:Cadastre ID="<?php sanitize_value($row["Cadastre_Code"]); ?>"><?php sanitize_value($row["Cadastre"]); ?></arch14cz:Cadastre>
<arch14cz:Site><?php sanitize_value($row["Site"]); ?></arch14cz:Site>
<arch14cz:Fieldwork_Event_ID><?php sanitize_value($row["Fieldwork_Event_ID"]); ?></arch14cz:Fieldwork_Event_ID>
<arch14cz:Coordinates><?php sanitize_value($row["Coordinates"]); ?></arch14cz:Coordinates>
<arch14cz:Activity_Area ID="<?php sanitize_value($row["Activity_Area_AMCR_ID"]); ?>"><?php sanitize_value($row["Activity_Area"]); ?></arch14cz:Activity_Area>
<arch14cz:Feature ID="<?php sanitize_value($row["Feature_AMCR_ID"]); ?>"><?php sanitize_value($row["Feature"]); ?></arch14cz:Feature>
<arch14cz:Context_Description><?php sanitize_value($row["Context_Description"]); ?></arch14cz:Context_Description>
<arch14cz:Context_Depth><?php sanitize_value($row["Context_Depth"]); ?></arch14cz:Context_Depth>
<arch14cz:Context_Name><?php sanitize_value($row["Context_Name"]); ?></arch14cz:Context_Name>
<arch14cz:Relative_Dating_Name ID="<?php sanitize_value($row["Relative_Dating_AMCR_ID"]); ?>"><?php sanitize_value($row["Relative_Dating_Name"]); ?></arch14cz:Relative_Dating_Name>
<arch14cz:Relative_Dating_Order_From><?php sanitize_value($row["Order_From"]); ?></arch14cz:Relative_Dating_Order_From>
<arch14cz:Relative_Dating_Order_To><?php sanitize_value($row["Order_To"]); ?></arch14cz:Relative_Dating_Order_To>
<arch14cz:Sample_Number><?php sanitize_value($row["Sample_Number"]); ?></arch14cz:Sample_Number>
<arch14cz:Sample_Note><?php sanitize_value($row["Sample_Note"]); ?></arch14cz:Sample_Note>
<arch14cz:Material ID="<?php sanitize_value($row["Material_AMCR_ID"]); ?>"><?php sanitize_value($row["Material"]); ?></arch14cz:Material>
<arch14cz:Material_Note><?php sanitize_value($row["Material_Note"]); ?></arch14cz:Material_Note>
<arch14cz:Source><?php sanitize_value($row["Source"]); ?></arch14cz:Source>
</arch14cz:record_row>
<?php
}
?>
</arch14cz:table>
Loading

0 comments on commit 4207801

Please sign in to comment.