zploskey / chemdb Goto Github PK
View Code? Open in Web Editor NEWCosmolab Chemdb: A web application for running a cosmogenic nuclide lab
License: MIT License
Cosmolab Chemdb: A web application for running a cosmogenic nuclide lab
License: MIT License
$ app/doctrine create-db
create-db - Successfully created database for connection named 'chemdb'
$ app/doctrine create-tables
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
This is followed by this error message:
SQLSTATE[HY000]: General error: 1005 Can't create table chemdb
.#sql-119c_21
(errno: 150 "Foreign key constraint is incorrectly formed"). Failing Query: "ALTER TABLE analysis ADD CONSTRAINT analysis_diss_bottle_id_diss_bottle_id FOREIGN KEY (diss_bottle_id) REFERENCES diss_bottle(id)". Failing Query: ALTER TABLE analysis ADD CONSTRAINT analysis_diss_bottle_id_diss_bottle_id FOREIGN KEY (diss_bottle_id) REFERENCES diss_bottle(id)
The tables are successfully created, but this constraint fails to be added, giving the impression that table creation may have failed altogether.
Create a settings system UI/backend and add configuration for these two numbers.
The model interfaces for the two carriers need to be made as similar as possible so that they can share code as was done with containers.
Here is the diff between the two models:
$ diff -U20 app/models/generated/{BaseAl,BaseBe}Carrier.php
--- generated/BaseAlCarrier.php 2017-02-01 15:52:45.438772245 -0800
+++ generated/BaseBeCarrier.php 2017-02-01 15:52:45.442105577 -0800
@@ -1,132 +1,164 @@
<?php
/**
- * BaseAlCarrier
+ * BaseBeCarrier
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* @property integer $id
* @property string $name
+ * @property double $be_conc
+ * @property double $del_be_conc
* @property double $al_conc
* @property double $del_al_conc
- * @property double $r26to27
- * @property double $r26to27_error
+ * @property double $r10to9
+ * @property double $r10to9_error
* @property date $in_service_date
* @property string $mfg_lot_no
+ * @property string $owner
* @property string $notes
* @property string $in_use
* @property Doctrine_Collection $Batch
*
* @package ##PACKAGE##
* @subpackage ##SUBPACKAGE##
* @author ##NAME## <##EMAIL##>
* @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
*/
-abstract class BaseAlCarrier extends Doctrine_Record
+abstract class BaseBeCarrier extends Doctrine_Record
{
public function setTableDefinition()
{
- $this->setTableName('al_carrier');
+ $this->setTableName('be_carrier');
$this->hasColumn('id', 'integer', 1, array(
'type' => 'integer',
'fixed' => 0,
- 'unsigned' => false,
+ 'unsigned' => true,
'primary' => true,
'autoincrement' => true,
'length' => '1',
));
$this->hasColumn('name', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
- 'notnull' => false,
+ 'notnull' => true,
'autoincrement' => false,
'length' => '',
));
+ $this->hasColumn('be_conc', 'double', 53, array(
+ 'type' => 'double',
+ 'fixed' => 0,
+ 'unsigned' => false,
+ 'primary' => false,
+ 'notnull' => false,
+ 'autoincrement' => false,
+ 'length' => '53',
+ 'scale' => '30',
+ ));
+ $this->hasColumn('del_be_conc', 'double', 53, array(
+ 'type' => 'double',
+ 'fixed' => 0,
+ 'unsigned' => false,
+ 'primary' => false,
+ 'notnull' => false,
+ 'autoincrement' => false,
+ 'length' => '53',
+ 'scale' => '30',
+ ));
$this->hasColumn('al_conc', 'double', 53, array(
'type' => 'double',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '53',
'scale' => '30',
));
$this->hasColumn('del_al_conc', 'double', 53, array(
'type' => 'double',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '53',
'scale' => '30',
));
- $this->hasColumn('r26to27', 'double', 53, array(
+ $this->hasColumn('r10to9', 'double', 53, array(
'type' => 'double',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '53',
'scale' => '30',
));
- $this->hasColumn('r26to27_error', 'double', 53, array(
+ $this->hasColumn('r10to9_error', 'double', 53, array(
'type' => 'double',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '53',
'scale' => '30',
));
$this->hasColumn('in_service_date', 'date', 25, array(
'type' => 'date',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '25',
));
$this->hasColumn('mfg_lot_no', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '',
));
+ $this->hasColumn('owner', 'string', null, array(
+ 'type' => 'string',
+ 'fixed' => 0,
+ 'unsigned' => false,
+ 'primary' => false,
+ 'notnull' => false,
+ 'autoincrement' => false,
+ 'length' => '',
+ ));
$this->hasColumn('notes', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '',
));
$this->hasColumn('in_use', 'string', null, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '',
));
}
public function setUp()
{
parent::setUp();
$this->hasMany('Batch', array(
'local' => 'id',
- 'foreign' => 'al_carrier_id'));
+ 'foreign' => 'be_carrier_id'));
}
}
TODO:
Several index controllers fail with PHP errors when accessed without selecting a batch.
For example:
Fatal error: Call to a member function generateIcpResultsText() on a non-object in /data/www/larsenlab/chemdb/app/controllers/Quartz_chem.php on line 776
Fatal error: Call to a member function getReportArray() on a non-object in /data/www/larsenlab/chemdb/app/controllers/Quartz_chem.php on line 817
And several others.
As requested by Isaac Larsen:
One nice addition to the database would be the ability to enter the amount of carrier to add to your samples (generally 250 mg), and an output that uses the carrier concentration to determine the number of micrograms to set the pipette to. It would be getting fancy, but for Al, this could also incorporate the Al concentration measured in the Al-checks.
In #16 we added a calculation for the volume of carrier to add to samples during sample loading. Currently, it is calculated for the typical target mass of Be (250 mg) and Al (1000 mg) in samples. The target mass should be made configurable in two ways:
As we currently don't have a settings system, we should do this in that order.
An uncaught Exception was encountered
Type: Doctrine_Connection_Mysql_Exception
Message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (chemdb
.split
, CONSTRAINT split_split_bkr_id_split_bkr_id
FOREIGN KEY (split_bkr_id
) REFERENCES split_bkr
(id
))
Filename: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection.php
Line Number: 1090
Backtrace:
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection/Statement.php
Line: 284
Function: rethrowException
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection.php
Line: 1050
Function: execute
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection.php
Line: 695
Function: exec
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection/UnitOfWork.php
Line: 647
Function: insert
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection/UnitOfWork.php
Line: 571
Function: processSingleInsert
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection/UnitOfWork.php
Line: 81
Function: insert
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Record.php
Line: 1718
Function: saveGraph
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Collection.php
Line: 922
Function: save
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection/UnitOfWork.php
Line: 136
Function: save
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Record.php
Line: 1718
Function: saveGraph
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Collection.php
Line: 922
Function: save
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Connection/UnitOfWork.php
Line: 136
Function: save
File: /home/zach/public_html/chemdb/vendor/lexpress/doctrine1/lib/Doctrine/Record.php
Line: 1718
Function: saveGraph
File: /home/zach/public_html/chemdb/app/controllers/Quartz_chem.php
Line: 522
Function: save
File: /home/zach/public_html/chemdb/index.php
Line: 294
Function: require_once
Our old crusty autocompleter does not play nice with the new jQuery. We should use something that is supported. The autocompleter in jQuery-UI would probably work just fine.
It would be good to add two new columns to the be_carrier table, one for the carrier isotope ratio and another for uncertainty in the isotope ratio. This information is needed for properly calculating sample Be-10 concentrations when measured sample ratios are low, and the carrier Be-10 contribution to the total Be-10 becomes significant.
We cast to float to remove trailing zeros from certain floating point values but should not do this to non-numeric values. For example, in the Quartz Chemistry sample loading page, entering non-numeric values for a weight will fill the input with 0 instead of the invalid input. This input should be preserved so that the user can edit it to be valid.
These casts should be moved into a helper function (or perhaps a method on model class) to cast the weight fields only if their value is numeric according to is_numeric()
.
Requirements:
Allow sending weights to the database from the balance in a format like + 0.4578
.
The database throws a "must be a number" error, likely due to the space.
Viewing the final report when there is no Al carrier in the db gives:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: AlCarrier
Filename: models/Batch.php
Line Number: 123
Backtrace:
File: /code/app/models/Batch.php
Line: 123
Function: _error_handler
File: /code/app/models/BatchTable.php
Line: 136
Function: getReportArray
File: /code/app/controllers/Quartz_chem.php
Line: 768
Function: getReportArray
File: /code/index.php
Line: 317
Function: require_once
Likewise on the tracking sheet:
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/Quartz_chem.php
Line Number: 347
Backtrace:
File: /code/app/controllers/Quartz_chem.php
Line: 347
Function: _error_handler
File: /code/index.php
Line: 317
Function: require_once
Traces are from 0a748b1.
Before diving into this... the welcome page is loading fine, but all links on the homepage/welcome throw 404s. The links are all of the form /index.php/projects
.
Question: are these links supposed to be of the form /index.php/quartz_chem
? If not, any idea why they are incorrect? Perhaps a path variable someplace? I'm quite confident that a connection to a DB is not being established on index.php load, as the db/username/password can be correct or wrong in the config/database.php and it doesn't affect index.php behavior at all.
Thanks for entertaining a simple mechanical question. I've forked repo at UW-Macrostrat and am tweaking there before submitting a pull for your consideration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.