diff --git a/app/Actions/Project/UpdateDOI.php b/app/Actions/Project/UpdateDOI.php new file mode 100644 index 00000000..e58d11bd --- /dev/null +++ b/app/Actions/Project/UpdateDOI.php @@ -0,0 +1,59 @@ +doiService = $doiService; + } + + /** + * Update the given model DOI metadata. + * + * @param mixed $model + * @return void + */ + public function update($model) + { + $project = null; + $studies = null; + if ($model instanceof Project) { + $project = $model; + } elseif ($model instanceof Collection) { + $studies = $model; + } + + if ($project) { + $project->addRelatedIdentifiers($this->doiService); + $studies = $project->studies; + } + if ($studies) { + foreach ($studies as $study) { + if ($study instanceof Study) { + $study->addRelatedIdentifiers($this->doiService); + $datasets = $study->datasets; + foreach ($datasets as $dataset) { + if ($dataset instanceof Dataset) { + $dataset->addRelatedIdentifiers($this->doiService); + } + } + } + } + } + } +} diff --git a/app/Http/Controllers/API/Schemas/Bioschemas/BioschemasController.php b/app/Http/Controllers/API/Schemas/Bioschemas/BioschemasController.php index 0634717d..f00fb4dc 100644 --- a/app/Http/Controllers/API/Schemas/Bioschemas/BioschemasController.php +++ b/app/Http/Controllers/API/Schemas/Bioschemas/BioschemasController.php @@ -281,7 +281,6 @@ public function prepareExperiment($dataset) $experiment = 'c13'; } } - if ($experiment == 'proton') { $experimentSchema = BioschemasHelper::prepareDefinedTerm('1H nuclear magnetic resonance spectroscopy', ['1H-NMR spectrometry', 'proton nuclear magnetic resonance spectroscopy', '1H-NMR spectroscopy', '1H-NMR', '1H NMR', '1H NMR spectroscopy', '1H nuclear magnetic resonance spectrometry', 'proton NMR'], 'CHMO:0000593', 'http://purl.obolibrary.org/obo/CHMO_0000593', $chmo); } elseif ($experiment == 'c13') { @@ -379,12 +378,12 @@ public function prepareNMRiumInfo($dataset) $dimensionProperty = BioschemasHelper::preparePropertyValue('NMR spectrum by dimensionality', 'NMR:1000117', $dimension, null); $probeNameProperty = BioschemasHelper::preparePropertyValue('NMR probe', 'OBI:0000516', $probeName, null); //$experimentProperty = BioschemasHelper::preparePropertyValue('pulsed nuclear magnetic resonance spectroscopy', 'CHMO:0000613', $experiment, null); - $temperatureProperty = BioschemasHelper::preparePropertyValue('Temperature', 'NCIT:C25206', $temperature, 'https://ontobee.org/ontology/UO?iri=http://purl.obolibrary.org/obo/UO_0000012'); + $temperatureProperty = BioschemasHelper::preparePropertyValue('Temperature', 'NCIT:C25206', $temperature, 'http://purl.obolibrary.org/obo/UO_0000012'); $baseFrequencyProperty = BioschemasHelper::preparePropertyValue('irradiation frequency', 'NMR:1400026', $baseFrequency, 'http://purl.obolibrary.org/obo/UO_0000325'); $fieldStrengthProperty = BioschemasHelper::preparePropertyValue('magnetic field strength', 'MR:1400253', $fieldStrength, 'http://purl.obolibrary.org/obo/UO_0000228'); $numberOfScansProperty = BioschemasHelper::preparePropertyValue('number of scans', 'NMR:1400087', $numberOfScans, 'scans'); $pulseSequenceProperty = BioschemasHelper::preparePropertyValue('nuclear magnetic resonance pulse sequence', 'CHMO:0001841', $pulseSequence, null); - $spectralWidthProperty = BioschemasHelper::preparePropertyValue('Spectral Width', 'NCIT:C156496', $spectralWidth, null); //todo: add unit + $spectralWidthProperty = BioschemasHelper::preparePropertyValue('Spectral Width', 'NCIT:C156496', $spectralWidth, 'http://purl.obolibrary.org/obo/UO_0000169'); $numberOfPointsProperty = BioschemasHelper::preparePropertyValue('number of data points', 'NMR:1000176', $numberOfPoints, 'points'); $relaxationTimeProperty = BioschemasHelper::preparePropertyValue('relaxation time measurement', 'FIX:0000202', $relaxationTime, 'http://purl.obolibrary.org/obo/UO_0000010'); diff --git a/app/Http/Controllers/API/Schemas/DataCite/DOIController.php b/app/Http/Controllers/API/Schemas/DataCite/DOIController.php new file mode 100644 index 00000000..2976b0ec --- /dev/null +++ b/app/Http/Controllers/API/Schemas/DataCite/DOIController.php @@ -0,0 +1,37 @@ +doiService = $doiService; + } + + /** + * Update Model's DataCite metadata + * + * @param Illuminate\Http\Request $request + * @param string $identifier + * @return void + */ + public function update(Request $request, $identifier) + { + $resolvedModel = resolveIdentifier($identifier); + $model = $resolvedModel['model']; + + // Call the updateDOI function + $model->updateDOIMetadata($this->doiService); + } +} diff --git a/app/Jobs/ProcessProject.php b/app/Jobs/ProcessProject.php index 913cf640..2861a954 100644 --- a/app/Jobs/ProcessProject.php +++ b/app/Jobs/ProcessProject.php @@ -4,6 +4,7 @@ use App\Actions\Project\AssignIdentifier; use App\Actions\Project\PublishProject; +use App\Actions\Project\UpdateDOI; use App\Models\FileSystemObject; use App\Models\Project; use App\Notifications\DraftProcessedNotification; @@ -45,7 +46,7 @@ public function __construct(Project $project) * * @return void */ - public function handle(AssignIdentifier $assigner, PublishProject $publisher) + public function handle(AssignIdentifier $assigner, UpdateDOI $updater, PublishProject $publisher) { $project = $this->project; @@ -109,6 +110,7 @@ public function handle(AssignIdentifier $assigner, PublishProject $publisher) if ($release_date->isPast()) { $publisher->publish($project); } + $updater->update($project->fresh()); Notification::send($project->owner, new DraftProcessedNotification($project)); } diff --git a/app/Jobs/ProcessSubmission.php b/app/Jobs/ProcessSubmission.php index 617086c7..7bb31ff5 100644 --- a/app/Jobs/ProcessSubmission.php +++ b/app/Jobs/ProcessSubmission.php @@ -4,6 +4,7 @@ use App\Actions\Project\AssignIdentifier; use App\Actions\Project\PublishProject; +use App\Actions\Project\UpdateDOI; use App\Actions\Study\PublishStudy; use App\Events\StudyPublish; use App\Models\FileSystemObject; @@ -41,7 +42,7 @@ public function __construct(Project $project) /** * Execute the job. */ - public function handle(AssignIdentifier $assigner, PublishProject $projectPublisher, PublishStudy $studyPublisher) + public function handle(AssignIdentifier $assigner, UpdateDOI $updater, PublishProject $projectPublisher, PublishStudy $studyPublisher) { $project = $this->project; @@ -107,7 +108,7 @@ public function handle(AssignIdentifier $assigner, PublishProject $projectPublis if ($release_date->isPast()) { $projectPublisher->publish($project); } - + $updater->update($project->fresh()); ArchiveProject::dispatch($project); $project->sendNotification('publish', $this->prepareSendList($project)); diff --git a/app/Models/HasDOI.php b/app/Models/HasDOI.php index 7cb628ae..44afbf74 100644 --- a/app/Models/HasDOI.php +++ b/app/Models/HasDOI.php @@ -65,8 +65,25 @@ public function generateDOI($doiService) } } - public function updateDOI($doiService) + /** + * Update Model's DataCite metadata + * + * @param mixed $doiService + * @return void + */ + public function updateDOIMetadata($doiService) { + $doi_host = env('DOI_HOST', null); + + if (! is_null($doi_host)) { + $doi = $this->doi; + if ($doi !== null) { + $attributes = $this->getMetadata(); + $doiResponse = $doiService->updateDOI($doi, $attributes); + $this->datacite_schema = $doiResponse; + $this->save(); + } + } } public function getIdentifier($model, $key) @@ -230,4 +247,65 @@ public function getMetadata() return $attributes; } + + public function addRelatedIdentifiers($doiService) + { + $attributes = $this->getMetadata(); + if ($this instanceof Project) { + foreach ($this->studies as &$study) { + $relatedIdentifier = [ + 'relatedIdentifier' => $study->doi, + 'relatedIdentifierType' => 'DOI', + 'relationType' => 'HasPart', + ]; + array_push($attributes['relatedIdentifiers'], $relatedIdentifier); + foreach ($study->datasets as &$dataset) { + $relatedIdentifier = [ + 'relatedIdentifier' => $dataset->doi, + 'relatedIdentifierType' => 'DOI', + 'relationType' => 'HasPart', + ]; + array_push($attributes['relatedIdentifiers'], $relatedIdentifier); + } + } + $doiResponse = $doiService->updateDOI($this->doi, $attributes); + $this->datacite_schema = $doiResponse; + $this->save(); + + } elseif ($this instanceof Study) { + $relatedIdentifier = [ + 'relatedIdentifier' => $this->project->doi, + 'relatedIdentifierType' => 'DOI', + 'relationType' => 'IsPartOf', + ]; + array_push($attributes['relatedIdentifiers'], $relatedIdentifier); + foreach ($this->datasets as &$dataset) { + $relatedIdentifier = [ + 'relatedIdentifier' => $dataset->doi, + 'relatedIdentifierType' => 'DOI', + 'relationType' => 'HasPart', + ]; + array_push($attributes['relatedIdentifiers'], $relatedIdentifier); + } + $doiResponse = $doiService->updateDOI($this->doi, $attributes); + $this->datacite_schema = $doiResponse; + $this->save(); + } elseif ($this instanceof Dataset) { + $relatedIdentifier = [ + 'relatedIdentifier' => $this->project->doi, + 'relatedIdentifierType' => 'DOI', + 'relationType' => 'IsPartOf', + ]; + array_push($attributes['relatedIdentifiers'], $relatedIdentifier); + $relatedIdentifier = [ + 'relatedIdentifier' => $this->study->doi, + 'relatedIdentifierType' => 'DOI', + 'relationType' => 'IsPartOf', + ]; + array_push($attributes['relatedIdentifiers'], $relatedIdentifier); + $doiResponse = $doiService->updateDOI($this->doi, $attributes); + $this->datacite_schema = $doiResponse; + $this->save(); + } + } } diff --git a/app/Services/DOI/DOIService.php b/app/Services/DOI/DOIService.php index e1c6162c..ce2a3ff8 100644 --- a/app/Services/DOI/DOIService.php +++ b/app/Services/DOI/DOIService.php @@ -10,7 +10,7 @@ public function createDOI($suffix, $attributes = []); public function getDOI($doi); - public function updateDOI($doi); + public function updateDOI($doi, $attributes = []); public function deleteDOI($doi); diff --git a/app/Services/DOI/DataCite.php b/app/Services/DOI/DataCite.php index f080198c..db3b1230 100644 --- a/app/Services/DOI/DataCite.php +++ b/app/Services/DOI/DataCite.php @@ -70,9 +70,35 @@ public function createDOI($suffix, $metadata = []) return json_decode($contents, true); } - public function updateDOI($doi) + /** + * Update DataCite metadata based on DOI + * + * @param string $doi + * @param array $metadata + * @return array $contents + */ + public function updateDOI($doi, $metadata = []) { - return 'Datacite'; + foreach ($metadata as $key => $value) { + $attributes[$key] = $value; + } + + $body = [ + 'data' => [ + 'type' => 'dois', + 'attributes' => $attributes, + ], + ]; + + $response = $this->client->put('/dois/'.urlencode($doi), + [RequestOptions::JSON => $body] + ); + + $stream = $response->getBody(); + $contents = $stream->getContents(); + $contents = json_decode($contents, true); + + return $contents; } public function deleteDOI($doi) diff --git a/public/img/about1.jpeg b/public/img/about1.jpeg new file mode 100644 index 00000000..811f19fb Binary files /dev/null and b/public/img/about1.jpeg differ diff --git a/public/img/about2.jpeg b/public/img/about2.jpeg new file mode 100644 index 00000000..27f11521 Binary files /dev/null and b/public/img/about2.jpeg differ diff --git a/public/img/about3.jpeg b/public/img/about3.jpeg new file mode 100644 index 00000000..47519a89 Binary files /dev/null and b/public/img/about3.jpeg differ diff --git a/public/img/about4.jpeg b/public/img/about4.jpeg new file mode 100644 index 00000000..07a5892c Binary files /dev/null and b/public/img/about4.jpeg differ diff --git a/public/img/about5.jpeg b/public/img/about5.jpeg new file mode 100644 index 00000000..dacad14d Binary files /dev/null and b/public/img/about5.jpeg differ diff --git a/public/img/ct.png b/public/img/ct.png new file mode 100644 index 00000000..b5111cfd Binary files /dev/null and b/public/img/ct.png differ diff --git a/public/img/gpauli.jpg b/public/img/gpauli.jpg new file mode 100644 index 00000000..358d6f00 Binary files /dev/null and b/public/img/gpauli.jpg differ diff --git a/public/img/jl.jpeg b/public/img/jl.jpeg new file mode 100644 index 00000000..8e9a4345 Binary files /dev/null and b/public/img/jl.jpeg differ diff --git a/public/img/journals.png b/public/img/journals.png new file mode 100644 index 00000000..3bd4e78e Binary files /dev/null and b/public/img/journals.png differ diff --git a/public/img/jw.jpeg b/public/img/jw.jpeg new file mode 100644 index 00000000..3774ab36 Binary files /dev/null and b/public/img/jw.jpeg differ diff --git a/public/img/lp.jpg b/public/img/lp.jpg new file mode 100644 index 00000000..15f214f0 Binary files /dev/null and b/public/img/lp.jpg differ diff --git a/public/img/ph.jpg b/public/img/ph.jpg new file mode 100644 index 00000000..a987c261 Binary files /dev/null and b/public/img/ph.jpg differ diff --git a/public/img/uic.png b/public/img/uic.png new file mode 100644 index 00000000..574aabc7 Binary files /dev/null and b/public/img/uic.png differ diff --git a/resources/js/Pages/About.vue b/resources/js/Pages/About.vue new file mode 100644 index 00000000..cd0c9e7f --- /dev/null +++ b/resources/js/Pages/About.vue @@ -0,0 +1,972 @@ + + + diff --git a/resources/js/Pages/Publish.vue b/resources/js/Pages/Publish.vue index 357b8ea7..12afda5b 100644 --- a/resources/js/Pages/Publish.vue +++ b/resources/js/Pages/Publish.vue @@ -430,7 +430,7 @@

Publish your data now immediately or set a diff --git a/resources/js/Pages/Welcome.vue b/resources/js/Pages/Welcome.vue index 3d1bdbca..fc545a93 100644 --- a/resources/js/Pages/Welcome.vue +++ b/resources/js/Pages/Welcome.vue @@ -49,6 +49,12 @@ > Compounds + + About +