Giter VIP home page Giter VIP logo

chemdb's People

Contributors

cambro avatar zploskey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

uw-macrostrat

chemdb's Issues

"Foreign key constraint is incorrectly formed" on database creation

$ 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.

Add interface for adding Al and Be carriers

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:

  • Make AlCarrier.id unsigned
  • Make both name fields notnull (change on AlCarrier)
  • Add identical owner column to AlCarrier
  • Map ratio names to element names
  • Create UI
  • Handle missing be_conc and uncertainty on AlCarrier display
  • Form validation

quartz_chem: unset batch gives error when loading index controllers

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.

Calculate amount of carrier addition

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.

Configuration of desired carrier amount to add during sample loading

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:

  • Per batch (#18)
  • Global default setting (#19)

As we currently don't have a settings system, we should do this in that order.

quartz_chem/add_split_weights: Integrity constraint violation

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

Migrate to a modern autocompleter

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.

Add carrier Be-10/Be-9 ratio and uncertainty to the be_carrier table

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.

quartz_chem/load_samples: Float casts break refilling invalid input

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().

quartz_chem: gracefully handle batch with no carriers

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.

links on welcome (index.php)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.