Skip to content

Commit

Permalink
UserVariableRelationship
Browse files Browse the repository at this point in the history
  • Loading branch information
mikepsinn committed Nov 16, 2023
1 parent 351d554 commit 7af2835
Show file tree
Hide file tree
Showing 317 changed files with 1,551 additions and 1,565 deletions.
8 changes: 4 additions & 4 deletions apps/dfda-1/app/Astral/CorrelationBaseAstralResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Contributors: ADD YOUR NAME HERE, Mike P. Sinn
*/ /** @noinspection PhpUnused */
namespace App\Astral;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\User;
use App\Models\Variable;
use Titasgailius\SearchRelations\SearchesRelations;
Expand All @@ -13,12 +13,12 @@ class CorrelationBaseAstralResource extends BaseAstralAstralResource {
* The model the resource corresponds to.
* @var string
*/
public static $model = Correlation::class;
public static $model = UserVariableRelationship::class;
/**
* The single value that should be used to represent the resource when being displayed.
* @var string
*/
public static $title = Correlation::FIELD_ID;
public static $title = UserVariableRelationship::FIELD_ID;
/**
* The columns that should be searched.
* @var array
Expand Down Expand Up @@ -48,7 +48,7 @@ class CorrelationBaseAstralResource extends BaseAstralAstralResource {
* @var array
*/
public static $with = ['cause_variable', 'effect_variable', 'user'];
public function getCorrelation(): Correlation{
public function getCorrelation(): UserVariableRelationship{
/** @noinspection PhpIncompatibleReturnTypeInspection */
return $this->getModel();
}
Expand Down
4 changes: 2 additions & 2 deletions apps/dfda-1/app/Astral/Filters/AnalyzableFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

namespace App\Astral\Filters;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use App\Filters\BooleanFilter;
Expand All @@ -19,7 +19,7 @@ class AnalyzableFilter extends BooleanFilter {
*/
public function apply(Request $request, $query, $value){
if($value['failed']){
$query->whereNotNull(Correlation::FIELD_INTERNAL_ERROR_MESSAGE);
$query->whereNotNull(UserVariableRelationship::FIELD_INTERNAL_ERROR_MESSAGE);
}
return $query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace App\Astral\Lenses;
use App\Models\BaseModel;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use Illuminate\Database\Eloquent\Builder;
use App\Http\Requests\LensRequest;
class CorrelationsWithNoCauseMeasurementsLens extends CorrelationInvalidLens {
Expand All @@ -26,8 +26,8 @@ public static function query(LensRequest $request, $query){
// Correlation::FIELD_ANALYSIS_STARTED_AT,
// Correlation::FIELD_INTERNAL_ERROR_MESSAGE,
// ])
->whereNotNull(Correlation::FIELD_INTERNAL_ERROR_MESSAGE)
->where(Correlation::FIELD_CAUSE_NUMBER_OF_PROCESSED_DAILY_MEASUREMENTS, 0)
->orderBy(Correlation::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC)));
->whereNotNull(UserVariableRelationship::FIELD_INTERNAL_ERROR_MESSAGE)
->where(UserVariableRelationship::FIELD_CAUSE_NUMBER_OF_PROCESSED_DAILY_MEASUREMENTS, 0)
->orderBy(UserVariableRelationship::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace App\Astral\Lenses;
use App\Models\BaseModel;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use Illuminate\Database\Eloquent\Builder;
use App\Http\Requests\LensRequest;
class CorrelationsWithNoChangeLens extends CorrelationInvalidLens {
Expand All @@ -20,8 +20,8 @@ public function name(): string{
* @return mixed
*/
public static function query(LensRequest $request, $query){
$q = $query->whereNull(Correlation::FIELD_EFFECT_FOLLOW_UP_PERCENT_CHANGE_FROM_BASELINE)
->orderBy(Correlation::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC);
$q = $query->whereNull(UserVariableRelationship::FIELD_EFFECT_FOLLOW_UP_PERCENT_CHANGE_FROM_BASELINE)
->orderBy(UserVariableRelationship::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC);
$filters = $request->withFilters($q);
return $request->withOrdering($filters);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/dfda-1/app/Astral/Lenses/FailedAnalysesLens.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace App\Astral\Lenses;
use App\Models\BaseModel;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Astral\Metrics\AnalysisProgressPartition;
use App\Astral\BaseAstralAstralResource;
use App\Traits\AnalyzableTrait;
Expand All @@ -23,8 +23,8 @@ class FailedAnalysesLens extends QMLens {
* @noinspection PhpMissingReturnTypeInspection
*/
public static function query(LensRequest $request, $query){
return $request->withOrdering($request->withFilters($query->whereNotNull(Correlation::FIELD_INTERNAL_ERROR_MESSAGE)
->orderBy(Correlation::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC)));
return $request->withOrdering($request->withFilters($query->whereNotNull(UserVariableRelationship::FIELD_INTERNAL_ERROR_MESSAGE)
->orderBy(UserVariableRelationship::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC)));
}
/**
* Get the cards available on the lens.
Expand Down
6 changes: 3 additions & 3 deletions apps/dfda-1/app/Astral/Lenses/InvalidRecordsLens.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace App\Astral\Lenses;
use App\Models\BaseModel;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Properties\BaseProperty;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
Expand All @@ -32,8 +32,8 @@ public static function query(LensRequest $request, $query){
// Correlation::FIELD_ANALYSIS_STARTED_AT,
// Correlation::FIELD_INTERNAL_ERROR_MESSAGE,
// ])
->whereNotNull(Correlation::FIELD_INTERNAL_ERROR_MESSAGE)
->orderBy(Correlation::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC)));
->whereNotNull(UserVariableRelationship::FIELD_INTERNAL_ERROR_MESSAGE)
->orderBy(UserVariableRelationship::FIELD_ANALYSIS_STARTED_AT, BaseModel::ORDER_DIRECTION_DESC)));
}
/**
* Get the fields available to the lens.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

namespace App\Buttons\DataLab\Correlations;
use App\Buttons\QMButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
class CreateCorrelationButton extends QMButton {
public $accessibilityText = 'Create Correlation';
public $action = 'datalab/correlations/create';
public $color = Correlation::COLOR;
public $fontAwesome = Correlation::FONT_AWESOME;
public $color = UserVariableRelationship::COLOR;
public $fontAwesome = UserVariableRelationship::FONT_AWESOME;
public $id = 'datalab-correlations-create-button';
public $image = Correlation::DEFAULT_IMAGE;
public $image = UserVariableRelationship::DEFAULT_IMAGE;
public $link = 'datalab/correlations/create';
public $parameters = [
'middleware' => [
Expand All @@ -30,6 +30,6 @@ class CreateCorrelationButton extends QMButton {
public $target = 'self';
public $text = 'Create Correlation';
public $title = 'Create Correlation';
public $tooltip = Correlation::CLASS_DESCRIPTION;
public $tooltip = UserVariableRelationship::CLASS_DESCRIPTION;
public $visible = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

namespace App\Buttons\DataLab\Correlations;
use App\Buttons\QMButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
class ListCorrelationsButton extends QMButton {
public $accessibilityText = 'List Correlations';
public $action = 'datalab/correlations';
public $color = Correlation::COLOR;
public $fontAwesome = Correlation::FONT_AWESOME;
public $color = UserVariableRelationship::COLOR;
public $fontAwesome = UserVariableRelationship::FONT_AWESOME;
public $id = 'datalab-correlations-button';
public $image = Correlation::DEFAULT_IMAGE;
public $image = UserVariableRelationship::DEFAULT_IMAGE;
public $link = 'datalab/correlations';
public $parameters = [
'middleware' => [
Expand All @@ -30,6 +30,6 @@ class ListCorrelationsButton extends QMButton {
public $target = 'self';
public $text = 'List Correlations';
public $title = 'List Correlations';
public $tooltip = Correlation::CLASS_DESCRIPTION;
public $tooltip = UserVariableRelationship::CLASS_DESCRIPTION;
public $visible = true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\BelongsToRelationshipButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\Unit;
class CorrelationCauseUnitButton extends BelongsToRelationshipButton {
public $interesting = true;
public $foreignKeyName = Correlation::FIELD_CAUSE_UNIT_ID;
public $qualifiedForeignKeyName = Correlation::TABLE . '.' . Correlation::FIELD_CAUSE_UNIT_ID;
public $foreignKeyName = UserVariableRelationship::FIELD_CAUSE_UNIT_ID;
public $qualifiedForeignKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_CAUSE_UNIT_ID;
public $ownerKeyName = Unit::FIELD_ID;
public $qualifiedOwnerKeyName = Unit::TABLE . '.' . Unit::FIELD_ID;
public $childClass = Correlation::class;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $childClass = UserVariableRelationship::class;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = Unit::class;
public $methodName = 'cause_unit';
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\BelongsToRelationshipButton;
use App\Models\BaseModel;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\UserVariable;
use App\Properties\Base\BaseCauseVariableIdProperty;
use App\UI\HtmlHelper;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CorrelationCauseUserVariableButton extends BelongsToRelationshipButton {
const TOOLTIP = "Click for more details about the predictor variable. ";
public $interesting = true;
public $foreignKeyName = Correlation::FIELD_CAUSE_USER_VARIABLE_ID;
public $qualifiedForeignKeyName = Correlation::TABLE . '.' . Correlation::FIELD_CAUSE_USER_VARIABLE_ID;
public $foreignKeyName = UserVariableRelationship::FIELD_CAUSE_USER_VARIABLE_ID;
public $qualifiedForeignKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_CAUSE_USER_VARIABLE_ID;
public $ownerKeyName = UserVariable::FIELD_ID;
public $qualifiedOwnerKeyName = UserVariable::TABLE . '.' . UserVariable::FIELD_ID;
public $childClass = Correlation::class;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $childClass = UserVariableRelationship::class;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = UserVariable::class;
public $methodName = 'cause_user_variable';
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo';
Expand All @@ -34,7 +34,7 @@ class CorrelationCauseUserVariableButton extends BelongsToRelationshipButton {
public $tooltip = self::TOOLTIP;
/**
* CorrelationCauseUserVariableButton constructor.
* @param Correlation|string $methodOrModel
* @param UserVariableRelationship|string $methodOrModel
* @param BelongsTo|null $relation
*/
public function __construct($methodOrModel, BelongsTo $relation = null){
Expand All @@ -53,7 +53,7 @@ public function getMaterialStatCard(): string{
$this->getTooltip(), $this->getBackgroundColor(), $this->getFontAwesome(), $this->getUrl());
}
/**
* @return Correlation
* @return UserVariableRelationship
*/
public function getParent(): ?BaseModel{
return parent::getParent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\BelongsToRelationshipButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\Variable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CorrelationCauseVariableButton extends BelongsToRelationshipButton {
public $interesting = true;
public $foreignKeyName = Correlation::FIELD_CAUSE_VARIABLE_ID;
public $qualifiedForeignKeyName = Correlation::TABLE . '.' . Correlation::FIELD_CAUSE_VARIABLE_ID;
public $foreignKeyName = UserVariableRelationship::FIELD_CAUSE_VARIABLE_ID;
public $qualifiedForeignKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_CAUSE_VARIABLE_ID;
public $ownerKeyName = Variable::FIELD_ID;
public $qualifiedOwnerKeyName = Variable::TABLE . '.' . Variable::FIELD_ID;
public $childClass = Correlation::class;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $childClass = UserVariableRelationship::class;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = Variable::class;
public $methodName = 'cause_variable';
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo';
Expand All @@ -30,7 +30,7 @@ class CorrelationCauseVariableButton extends BelongsToRelationshipButton {
public $tooltip = Variable::CLASS_DESCRIPTION;
/**
* CorrelationCauseUserVariableButton constructor.
* @param Correlation $methodOrModel
* @param UserVariableRelationship $methodOrModel
* @param BelongsTo|null $relation
*/
public function __construct($methodOrModel, BelongsTo $relation = null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\BelongsToRelationshipButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\VariableCategory;
class CorrelationCauseVariableCategoryButton extends BelongsToRelationshipButton {
public $interesting = true;
public $foreignKeyName = Correlation::FIELD_CAUSE_VARIABLE_CATEGORY_ID;
public $qualifiedForeignKeyName = Correlation::TABLE . '.' . Correlation::FIELD_CAUSE_VARIABLE_CATEGORY_ID;
public $foreignKeyName = UserVariableRelationship::FIELD_CAUSE_VARIABLE_CATEGORY_ID;
public $qualifiedForeignKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_CAUSE_VARIABLE_CATEGORY_ID;
public $ownerKeyName = VariableCategory::FIELD_ID;
public $qualifiedOwnerKeyName = VariableCategory::TABLE . '.' . VariableCategory::FIELD_ID;
public $childClass = Correlation::class;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $childClass = UserVariableRelationship::class;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = VariableCategory::class;
public $methodName = 'cause_variable_category';
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\HasManyRelationshipButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\CorrelationCausalityVote;
class CorrelationCorrelationCausalityVotesButton extends HasManyRelationshipButton {
public $interesting = true;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = CorrelationCausalityVote::class;
public $methodName = CorrelationCausalityVote::TABLE;
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\HasMany';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\HasManyRelationshipButton;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\CorrelationUsefulnessVote;
class CorrelationCorrelationUsefulnessVotesButton extends HasManyRelationshipButton {
public $interesting = true;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = CorrelationUsefulnessVote::class;
public $methodName = CorrelationUsefulnessVote::TABLE;
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\HasMany';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
namespace App\Buttons\RelationshipButtons\Correlation;
use App\Buttons\RelationshipButtons\BelongsToRelationshipButton;
use App\Models\BaseModel;
use App\Models\Correlation;
use App\Models\UserVariableRelationship;
use App\Models\UserVariable;
use App\Properties\Base\BaseEffectVariableIdProperty;
use App\UI\HtmlHelper;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class CorrelationEffectUserVariableButton extends BelongsToRelationshipButton {
const TOOLTIP = "Click for more details about the user's outcome variable data in this study. ";
public $interesting = true;
public $foreignKeyName = Correlation::FIELD_EFFECT_USER_VARIABLE_ID;
public $qualifiedForeignKeyName = Correlation::TABLE . '.' . Correlation::FIELD_EFFECT_USER_VARIABLE_ID;
public $foreignKeyName = UserVariableRelationship::FIELD_EFFECT_USER_VARIABLE_ID;
public $qualifiedForeignKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_EFFECT_USER_VARIABLE_ID;
public $ownerKeyName = UserVariable::FIELD_ID;
public $qualifiedOwnerKeyName = UserVariable::TABLE . '.' . UserVariable::FIELD_ID;
public $childClass = Correlation::class;
public $parentClass = Correlation::class;
public $qualifiedParentKeyName = Correlation::TABLE . '.' . Correlation::FIELD_ID;
public $childClass = UserVariableRelationship::class;
public $parentClass = UserVariableRelationship::class;
public $qualifiedParentKeyName = UserVariableRelationship::TABLE . '.' . UserVariableRelationship::FIELD_ID;
public $relatedClass = UserVariable::class;
public $methodName = 'effect_user_variable';
public $relationshipType = 'Illuminate\\Database\\Eloquent\\Relations\\BelongsTo';
Expand All @@ -34,7 +34,7 @@ class CorrelationEffectUserVariableButton extends BelongsToRelationshipButton {
public $tooltip = self::TOOLTIP;
/**
* CorrelationCauseUserVariableButton constructor.
* @param Correlation|string $methodOrModel
* @param UserVariableRelationship|string $methodOrModel
* @param BelongsTo|null $relation
*/
public function __construct($methodOrModel, BelongsTo $relation = null){
Expand All @@ -53,7 +53,7 @@ public function getMaterialStatCard(): string{
$this->getTooltip(), $this->getBackgroundColor(), $this->getFontAwesome(), $this->getUrl());
}
/**
* @return Correlation
* @return UserVariableRelationship
*/
public function getParent(): ?BaseModel{
return parent::getParent();
Expand Down
Loading

0 comments on commit 7af2835

Please sign in to comment.