Skip to content

Commit

Permalink
chore: formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sriramkanakam87 committed Aug 16, 2024
1 parent 6ecf269 commit de5433b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportChEBINames.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function handle()
try {
$data[] = array_combine($header, $row);
} catch (\ValueError $e) {
Log::info('An error occurred: ' . $e->getMessage());
Log::info('An error occurred: '.$e->getMessage());
}
}
}
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/MapOrganismNamesToOGG.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ protected function getOLSIRI($name, $rank)
$data = json_decode($response->getBody(), true);

if (isset($data['elements']) && count($data['elements']) > 0) {
dd($data);

$element = $data['elements'][0];
if (isset($element['iri'], $element['ontologyId']) && $element['isObsolete'] === 'false') {
Expand Down
27 changes: 14 additions & 13 deletions app/Filament/Dashboard/Resources/OrganismResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
use App\Models\Organism;
use Archilex\AdvancedTables\Filters\AdvancedFilter;
use Filament\Forms;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Support\Facades\Cache;
use Tapp\FilamentAuditing\RelationManagers\AuditsRelationManager;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Components\Actions;
use Filament\Support\Enums\VerticalAlignment;
use Filament\Support\Enums\Alignment;
use GuzzleHttp\Client;
use Log;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Cache;
use Log;
use Tapp\FilamentAuditing\RelationManagers\AuditsRelationManager;

class OrganismResource extends Resource
{
Expand Down Expand Up @@ -94,15 +91,15 @@ public static function form(Form $form): Form
// Forms\Components\TextInput::make('rank')->readOnly(),
// ])
// ->action(fn ( $record) => $record->advance())
->modalContent(function ( $record, $get): View {
->modalContent(function ($record, $get): View {
$name = ucfirst(trim($get('name')));
$data = null;
// $iri = null;
// $organism = null;
// $rank = null;

if ($name && $name != '') {
$data = Self::getOLSIRI($name, 'species');
$data = self::getOLSIRI($name, 'species');
// if ($data) {
// Self::updateOrganismModel($name, $data, $record, 'species');
// } else {
Expand All @@ -119,6 +116,7 @@ public static function form(Form $form): Form
// }
// }
}

return view(
'forms.components.organism-info',
[
Expand Down Expand Up @@ -183,7 +181,7 @@ public static function table(Table $table): Table
->actions([
Tables\Actions\Action::make('iri')
->label('IRI')
->url(fn(Organism $record) => $record->iri ? urldecode($record->iri) : null, true)
->url(fn (Organism $record) => $record->iri ? urldecode($record->iri) : null, true)
->color('info')
->icon('heroicon-o-link'),
// Tables\Actions\ViewAction::make(),
Expand Down Expand Up @@ -252,6 +250,7 @@ protected static function getGNFMatches($name, $organism)
]);

$responseBody = json_decode($response->getBody(), true);

return $responseBody;
// dd($responseBody);

Expand Down Expand Up @@ -289,6 +288,7 @@ protected static function getGNFMatches($name, $organism)
// Self::error("Could not map: $name");
// }
}

protected static function updateOrganismModel($name, $iri, $organism = null, $rank = null)
{
// dd($name, $iri, $organism, $rank);
Expand All @@ -302,7 +302,7 @@ protected static function updateOrganismModel($name, $iri, $organism = null, $ra
$organism->rank = $rank;
$organism->save();
} else {
Self::error("Organism not found in the database: $name");
self::error("Organism not found in the database: $name");
}
}

Expand All @@ -324,8 +324,9 @@ protected static function getOLSIRI($name, $rank)
]);

$data = json_decode($response->getBody(), true);

return $data;
// var_dump($data);
// var_dump($data);

// if (isset($data['elements']) && count($data['elements']) > 0) {

Expand All @@ -348,7 +349,7 @@ protected static function getOLSIRI($name, $rank)
// }
} catch (\Exception $e) {
// Self::error("Error fetching IRI for $name: " . $e->getMessage());
Log::error("Error fetching IRI for $name: " . $e->getMessage());
Log::error("Error fetching IRI for $name: ".$e->getMessage());
}

return null;
Expand Down

0 comments on commit de5433b

Please sign in to comment.