Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge reports module #1028

Merged
merged 488 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
488 commits
Select commit Hold shift + click to select a range
5197bac
Merge pull request #70 from biigle/dependabot/npm_and_yarn/lodash-4.1…
mzur Jul 22, 2020
ddbfb3f
Implement handling of the export area of video volumes
mzur Jul 31, 2020
0c6c376
Complete renaming of annotations to image annotations
mzur Jul 31, 2020
563b10b
WIP Implement request for volume reports
mzur Jul 31, 2020
60cd075
Add migration to fix video report types
mzur Aug 4, 2020
06f0bad
Merge branch 'master' of https://github.com/biigle/reports
mzur Aug 4, 2020
5476b50
Merge branch 'master' into video-volumes
mzur Aug 4, 2020
b3ca44e
Implement form request for project and volume reports
mzur Aug 4, 2020
449ed36
Remove video report views
mzur Aug 4, 2020
aee1934
Fix project reports view
mzur Aug 4, 2020
1cb2234
Update volume report view for video volumes
mzur Aug 5, 2020
e020ee1
Update project report generators for video volumes
mzur Aug 5, 2020
7bf75dd
Update video reports for video volumes
mzur Aug 5, 2020
6355d05
Fix report filenames and validation
mzur Aug 6, 2020
ca8c2f4
Reorder reports schema and add an index
mzur Aug 6, 2020
b4f0f12
Implement video label CSV report
mzur Aug 6, 2020
e9f2ee5
Merge pull request #69 from biigle/video-volumes
mzur Aug 10, 2020
ced43b6
Use new generic user settings endpoint for report notifications
mzur Aug 11, 2020
d2f89a5
Remove unused route
mzur Aug 11, 2020
193c75f
Implement compatibility with the new project overview
mzur Aug 17, 2020
72b32eb
Merge pull request #71 from biigle/project-overview-v2
mzur Aug 17, 2020
04586ea
Fix restrict to labels option for very large label trees
mzur Sep 9, 2020
e12ff8c
Fix report generation with seperate label trees but no annotations/la…
mzur Sep 9, 2020
1c1ed48
Fix vulnerable dependency
mzur Sep 21, 2020
5bb5426
Merge branch 'master' of https://github.com/biigle/reports
mzur Sep 21, 2020
681ed2d
Fix Node dependency vulnerability
mzur Oct 20, 2020
c029e1e
Update for the default new project overview
mzur Nov 4, 2020
fba400b
Add notice that the module is included in biigle/biigle
mzur Nov 10, 2020
73839b4
Use GitHub Container Registry
mzur Nov 10, 2020
f8b915b
Implement ImageLocationReportGenerator for volumes
mzur Dec 15, 2020
e41bd30
Fix NPM vulnerabilities
mzur Dec 15, 2020
707c8b9
Implement project image location image label report
mzur Dec 16, 2020
0df870d
Add image location image annotation reports
mzur Dec 16, 2020
6fa5e42
Simplify ImageLocationReportGenerator
mzur Jan 5, 2021
210a65b
Add request validation for AnnotationLocationReport
mzur Jan 5, 2021
5380808
Implement AnnotationLocationReport
mzur Jan 5, 2021
ecb576f
Update laravel-mix to fix vulnerability
mzur Jan 5, 2021
766640d
Merge branch 'master' into geojson
mzur Jan 5, 2021
aac6019
Add support for all image annotation shapes to AnnotationLocationReport
mzur Jan 5, 2021
9c83893
Fix image annotation location report request validation
mzur Jan 5, 2021
aacdf2b
Implement AnnotationLocationReport for projects
mzur Jan 5, 2021
f3a8834
Fix validation for reports that require metadata
mzur Jan 5, 2021
e6096e7
Include only valid volumes in project location reports
mzur Jan 5, 2021
2de09d8
Add location report descriptions to the forms
mzur Jan 5, 2021
4dba36d
Fix form validation error handling
mzur Jan 6, 2021
baf79a0
Extent reports schema manual article for location reports
mzur Jan 6, 2021
0ec1e99
Add manual article for image location reports
mzur Jan 6, 2021
fa1f6ad
Add manual article for annotation location report
mzur Jan 6, 2021
1312b56
Merge pull request #72 from biigle/geojson
mzur Jan 6, 2021
f6ec971
Fix composer.json
mzur Jan 6, 2021
dec73f1
Update readme
mzur Jan 13, 2021
dfeff83
Fix reports search query
mzur Jan 15, 2021
8f017cc
Fix update schema action
mzur Jan 29, 2021
1cf613a
Update test action
mzur Jan 29, 2021
6330ca7
Use default storage disk for tests
mzur Feb 1, 2021
be68a3f
Skip test if biigle/laserpoints is not installed
mzur Feb 1, 2021
43d03ff
Install biigle/laserpoints in test environment
mzur Feb 1, 2021
0aded90
Implement separate by user for abundance report
mzur Feb 12, 2021
f91be3c
Implement separate by user for annotation location report
mzur Feb 12, 2021
73e5bdc
Implement separate by user for area report
mzur Feb 12, 2021
0c73da7
Implement separate by users for remaining reports
mzur Feb 12, 2021
08273cc
Add validation for new separate_users API argument
mzur Feb 12, 2021
9fa18e7
Update manual article for new separate users option
mzur Feb 12, 2021
12bf140
Add separate users checkbox to new report forms
mzur Feb 15, 2021
2e56890
Merge pull request #77 from biigle/separate-users
mzur Feb 15, 2021
462cde7
Upgrade to Laravel Mix 6
mzur Mar 31, 2021
c09f99d
Apply CS fixes
mzur Apr 30, 2021
173b8c0
Update .eslintrc
mzur May 7, 2021
8c41873
Update JS dependencies
mzur May 18, 2021
d9fb272
Update @biigle/ol
mzur Jun 2, 2021
6ff55ef
Update vulnerable npm dependencies
mzur Jun 2, 2021
5875ada
Update vulnerable NPM packages
mzur Jun 21, 2021
7864dec
Fix vulnerable NPM dependencies
mzur Sep 6, 2021
f6a1b33
Resolution for issue #73.\n\nEnables return of report from report con…
rskelly Oct 4, 2021
39b18dc
Resolution for issue #73.
rskelly Oct 4, 2021
5804a5c
Revert "Resolution for issue #73."
rskelly Oct 5, 2021
9dafeef
Implementing pull request suggestions.
rskelly Oct 5, 2021
87fcc4e
Removed unneeded element.
rskelly Oct 6, 2021
8293581
Fix disable notification test with true, false, none.
rskelly Oct 7, 2021
f6564b7
Update vulnerable npm dependencies
mzur Oct 12, 2021
3479ad8
Implement pull request suggestions.
rskelly Oct 18, 2021
498e952
Merge pull request #78 from rskelly/report_id_issue73
mzur Oct 19, 2021
427b5df
Make test action independent of PHP version in action runner
mzur Jan 3, 2022
b0333f8
Fix errors raised by PHP 8
mzur Jan 3, 2022
e78a05b
Fix error when report file is closed/destroyed twice
mzur Jan 4, 2022
60dc43b
Fix PHP 8 error with empty ZIP archive
mzur Jan 4, 2022
5da17f3
Update vulnerable NPM dependencies
mzur Jan 17, 2022
9b3c6c2
Update vulnerable NPM dependencies
mzur Jan 24, 2022
f7e618b
WIP Start implementing the ImageIfdoReportGenerator
mzur Jan 27, 2022
dca64bd
Implement image labels contained in iFDO report
mzur Jan 27, 2022
c37f4e4
WIP Continue implementing ImageIfdoReportGenerator
mzur Feb 10, 2022
073f6b1
Finish ImageIfdoReportGenerator
mzur Feb 10, 2022
b3e0807
Add imageIfdo report type
mzur Feb 10, 2022
09b8bdf
Update NPM dependencies
mzur Feb 10, 2022
3d23f25
Implement UI for image iFDO report
mzur Feb 10, 2022
b04b7cc
Implement project image iFDO reports
mzur Feb 10, 2022
8e032bc
Implement strip_ifdo request option
mzur Feb 10, 2022
794bfb8
Implement support for image-annotation-geometry-types in iFDOs
mzur Feb 10, 2022
4367b1c
Update the manual article for iFDO reports
mzur Feb 10, 2022
8b9262a
Merge pull request #81 from biigle/ifdo-report
mzur Feb 10, 2022
ff2bc06
Make model factories compatible with Laravel 8
mzur Feb 15, 2022
bfcf022
Fix compatibility with Flysystem 3
mzur Feb 16, 2022
4623593
Merge pull request #83 from biigle/laravel-9
mzur Feb 21, 2022
c9f5976
WIP Start to implement the VideoIfdoReportGenerator
mzur Mar 3, 2022
b0cd281
Use api middleware for API routes
mzur Mar 9, 2022
3ceadfe
Merge branch 'master' into video-ifdo
mzur Mar 9, 2022
ec3c040
Remove unused route
mzur Mar 11, 2022
3bb4426
Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Mar 28, 2022
e5b617c
Bump node-forge from 1.2.1 to 1.3.0
dependabot[bot] Mar 28, 2022
a8aaff0
Merge pull request #85 from biigle/dependabot/npm_and_yarn/minimist-1…
mzur Mar 28, 2022
07fdc43
Merge pull request #86 from biigle/dependabot/npm_and_yarn/node-forge…
mzur Mar 28, 2022
3d6b733
Use new notificationSettings mixin
mzur Mar 29, 2022
b8dfeb8
Merge branch 'master' of https://github.com/biigle/reports
mzur Mar 29, 2022
9209e05
Fix handling off iFDO array items
mzur Apr 7, 2022
8c2b1c2
Deduplicate code and add project video iFDO report generator
mzur Apr 7, 2022
6ceb509
Implement restrict label options for video iFDO report
mzur Apr 7, 2022
5f66a39
Implement video iFDO report type validation
mzur Apr 7, 2022
9398214
Fix namespace of iFDO report generators
mzur Apr 7, 2022
2d53a51
Fix confidence and timestamps of iFDO reports
mzur Apr 7, 2022
d00b96e
Add UI for video iFDO reports
mzur Apr 7, 2022
c52340d
Update manual article for video iFDO reports
mzur Apr 7, 2022
b6155af
Merge pull request #84 from biigle/video-ifdo
mzur Apr 7, 2022
d2abc72
Make ordering of annotations in iFDO reports consistent
mzur Apr 7, 2022
178a2a2
Fix test
mzur Apr 12, 2022
26d1c9a
Store report files with their file extension
mzur Apr 14, 2022
3dc9be1
Fix report file name migration
mzur Apr 14, 2022
4433992
Fix report file name migration again
mzur Apr 14, 2022
0b7e39c
Fix error handling of migration
mzur Apr 20, 2022
3de0e72
Update annotation type in iFDO reports
mzur Apr 22, 2022
e42d199
Update iFDO shape definition
mzur Apr 25, 2022
c5dc1cc
Remove iFDO creator type
mzur Apr 25, 2022
eed75bb
Remove iFDO label confidence
mzur Apr 25, 2022
f645243
Fix CSV field size errors
mzur Apr 28, 2022
b8ab516
Add created_at timestamp to CSV reports
mzur Apr 28, 2022
5e00e28
Bump async from 2.6.3 to 2.6.4
dependabot[bot] Apr 29, 2022
588285e
Merge pull request #89 from biigle/dependabot/npm_and_yarn/async-2.6.4
mzur Apr 29, 2022
676bc3a
Bump numpy from 1.8.2 to 1.21.0
dependabot[bot] Jun 17, 2022
0f91b5b
Merge pull request #91 from biigle/dependabot/pip/numpy-1.21.0
mzur Jun 20, 2022
0c285c2
Bump numpy from 1.21.0 to 1.22.0
dependabot[bot] Jun 22, 2022
f59fe87
Merge pull request #93 from biigle/dependabot/pip/numpy-1.22.0
mzur Jun 22, 2022
ed992bf
Update npm dependencies
mzur Jun 24, 2022
dd2acc6
initial coco
dlangenk Jul 4, 2022
086f01e
Merge branch 'master' into Coco
dlangenk Jul 4, 2022
7342511
added support for restrictions and zipped output
dlangenk Jul 5, 2022
040edba
added support for project reports
dlangenk Jul 5, 2022
c30e46a
added csv report compatibility
dlangenk Jul 6, 2022
29ef851
added tests
dlangenk Jul 6, 2022
3b674f0
updated date on database migration
dlangenk Jul 7, 2022
0a724ee
Update src/Support/Reports/Volumes/ImageAnnotations/CocoReportGenerat…
dlangenk Jul 11, 2022
fdd2663
Update src/Support/Reports/Volumes/ImageAnnotations/CocoReportGenerat…
dlangenk Jul 11, 2022
01852c3
Update src/resources/views/manual/tutorials/reports-schema.blade.php
dlangenk Jul 11, 2022
27a189e
Fix package-lock with newer npm version
mzur Jul 12, 2022
6977701
Consolidate src/database and src/Database
mzur Jul 12, 2022
93f54ef
Renamed coco script, included some error handling, cleaned it
dlangenk Jul 12, 2022
4875b9f
more testing
dlangenk Jul 12, 2022
e409c88
project test
dlangenk Jul 12, 2022
04d1cb5
removed items from query which were not needed
dlangenk Jul 12, 2022
6cb1ff6
Merge branch 'Coco' of https://github.com/biigle/reports into Coco
dlangenk Jul 12, 2022
7c7fbae
Merge branch 'Coco' of https://github.com/biigle/reports into Coco
mzur Jul 12, 2022
6b2590f
Merge pull request #94 from biigle/Coco
mzur Jul 12, 2022
3469b27
Catch edge case for circles with zero radius in COCO report
mzur Jul 12, 2022
b60c332
Bump terser from 4.8.0 to 4.8.1
dependabot[bot] Jul 20, 2022
5489543
Merge pull request #95 from biigle/dependabot/npm_and_yarn/terser-4.8.1
mzur Aug 8, 2022
6b5f719
fixed error where ellipse is exactly 90° rotated
dlangenk Aug 31, 2022
d0eb1db
Merge pull request #97 from biigle/to_coco_fix
mzur Aug 31, 2022
8da2a28
Fix vulnerable npm dependencies
mzur Nov 21, 2022
6b7eb3c
Merge branch 'master' of https://github.com/biigle/reports
mzur Nov 21, 2022
ad93904
Add integer validation rule to exists rules
mzur Dec 7, 2022
aad685d
Bump json5 from 1.0.1 to 1.0.2
dependabot[bot] Jan 8, 2023
71764b9
Merge pull request #99 from biigle/dependabot/npm_and_yarn/json5-1.0.2
mzur Jan 9, 2023
87d78d1
Fix restrict to labels for project guests
mzur Feb 28, 2023
5f842b5
Fixes missing categories
dlangenk Mar 7, 2023
b3f8020
Bump webpack from 5.75.0 to 5.76.1
dependabot[bot] Mar 15, 2023
eee89d5
Merge pull request #101 from biigle/dependabot/npm_and_yarn/webpack-5…
mzur Mar 15, 2023
8a99c77
Bump word-wrap from 1.2.3 to 1.2.4
dependabot[bot] Jul 18, 2023
96a0f05
Merge pull request #103 from biigle/dependabot/npm_and_yarn/word-wrap…
mzur Aug 7, 2023
fb7ae4d
Resolves bug #82 by using left join
lehecht Sep 12, 2023
ee3a550
Add test cases for deleted user
lehecht Sep 15, 2023
5162ab0
Apply suggestions from code review
mzur Sep 15, 2023
a1e2ef2
Merge pull request #104 from biigle/report-bug
mzur Sep 15, 2023
53f31fd
Update tests for Laravel 10
mzur Oct 4, 2023
8935ad8
Merge pull request #105 from biigle/laravel-10
mzur Oct 4, 2023
4f8f266
Fix test action
mzur Oct 4, 2023
12eebbd
Fix test action with vector database
mzur Oct 13, 2023
d64124e
Bump @babel/traverse from 7.20.1 to 7.23.2
dependabot[bot] Oct 18, 2023
22c5d3e
Merge pull request #107 from biigle/dependabot/npm_and_yarn/babel/tra…
mzur Oct 18, 2023
d29145c
Bump browserify-sign from 4.2.1 to 4.2.2
dependabot[bot] Oct 27, 2023
84359cd
Merge pull request #108 from biigle/dependabot/npm_and_yarn/browserif…
mzur Oct 27, 2023
9eb6c7f
Fix test action with vector database
mzur Dec 13, 2023
deb9904
Update update-schema.yml
mzur Jan 9, 2024
75c36cb
Bump follow-redirects from 1.15.2 to 1.15.4
dependabot[bot] Jan 9, 2024
194eb4e
Merge pull request #109 from biigle/dependabot/npm_and_yarn/follow-re…
mzur Jan 9, 2024
ff6e922
Add missing pandas requirement
mzur Jan 30, 2024
bba24f5
Merge pull request #112 from biigle/patch-1
mzur Jan 30, 2024
685171f
Fix error with inconsistent numpy array shape
mzur Jan 30, 2024
575879b
Merge pull request #113 from biigle/patch-1
mzur Jan 30, 2024
049be52
Bump follow-redirects from 1.15.4 to 1.15.6
dependabot[bot] Mar 16, 2024
34c9af0
Merge pull request #114 from biigle/dependabot/npm_and_yarn/follow-re…
mzur Mar 18, 2024
73149fd
Bump webpack-dev-middleware from 5.3.3 to 5.3.4
dependabot[bot] Mar 23, 2024
5bd7f0a
Merge pull request #115 from biigle/dependabot/npm_and_yarn/webpack-d…
mzur Mar 25, 2024
4972b10
Bump express from 4.18.2 to 4.19.2
dependabot[bot] Mar 28, 2024
7a19647
Merge pull request #116 from biigle/dependabot/npm_and_yarn/express-4…
mzur Apr 2, 2024
0f5f5e7
Implement iFDOv2 reports
mzur Apr 24, 2024
88dcd80
Export label UUIDs and colors in iFDO reports
mzur Apr 24, 2024
94dea47
Bump braces from 3.0.2 to 3.0.3
dependabot[bot] Jun 16, 2024
427c6e3
Merge pull request #121 from biigle/dependabot/npm_and_yarn/braces-3.0.3
mzur Jun 17, 2024
76ab17a
Bump ws from 8.11.0 to 8.17.1
dependabot[bot] Jun 17, 2024
99d0f06
Merge pull request #122 from biigle/dependabot/npm_and_yarn/ws-8.17.1
mzur Jun 18, 2024
4deb067
Upgrade to @biigle/ol:v9.2.4
mzur Jul 10, 2024
de89ef0
Add attributes column to video csv report
ToukL Jul 12, 2024
f621d0a
Update tests for video csv report
ToukL Jul 12, 2024
9269ef0
Update manual for video annotation report
ToukL Jul 12, 2024
919a52b
Merge pull request #125 from ToukL/videos-attrs
mzur Jul 15, 2024
4ec8363
Merge pull request #124 from biigle/ol-v9
mzur Jul 16, 2024
515ab10
Fix test that can sometimes fail
mzur Jul 26, 2024
f6e20e5
Fix renamed parser class
mzur Sep 4, 2024
864666d
Implement export of user UUID in iFDO reports
mzur Sep 4, 2024
723ca79
Fix label ID type in iFDO
mzur Sep 4, 2024
69b1243
Replace assertEquals with assertSame
mzur Sep 4, 2024
f001b97
Fix allowed parameter for video iFDO export
mzur Sep 4, 2024
16cb5b7
Merge branch 'master' into ifdov2
mzur Sep 4, 2024
ba1ced4
Fix docker compose command in test action
mzur Sep 4, 2024
c9d3838
Merge pull request #117 from biigle/ifdov2
mzur Sep 4, 2024
eb543ba
Use new volume method to get metadata disk name
mzur Sep 24, 2024
7333bce
Merge pull request #129 from biigle/patch-1
mzur Sep 24, 2024
0021d67
Converts rectangles to polygon
dbrembilla Oct 4, 2024
1363f5f
Merge pull request #132 from biigle/rectangle-polygon-conversion
mzur Oct 7, 2024
1a752ce
Implement chunking for image annotation CSV report generator
mzur Oct 11, 2024
09110c0
Implement chunking for video annotation CSV report
mzur Oct 11, 2024
98e8556
Implement streamed response for report files
mzur Oct 11, 2024
fdd30b0
Merge pull request #133 from biigle/issue-127
mzur Oct 11, 2024
4504d08
Optimize "limit to newest label" query
mzur Dec 10, 2024
727041e
Fix @biigle/ol package checksum
mzur Dec 11, 2024
c3ce019
Merge pull request #135 from biigle/patch-2
mzur Dec 11, 2024
d7ed70b
Merge branch 'master' into patch-1
mzur Dec 11, 2024
2ad6699
Merge pull request #134 from biigle/patch-1
mzur Dec 11, 2024
3ec2055
Improve performance of "only newest label" query even more
mzur Dec 11, 2024
ce933bc
Merge pull request #136 from biigle/patch-1
mzur Dec 11, 2024
e63b7d6
Prepare for merge into biigle/core
mzur Jan 7, 2025
d5b97d0
Merge remote-tracking branch 'remotes/reports-module/merge-into-core'…
mzur Jan 7, 2025
e0d6af0
Add PHP dependencies of reports module
mzur Jan 7, 2025
5b70a0f
Fix biigle/metadata-ifdo requirement
mzur Jan 7, 2025
221a171
Integrate part of the biigle/reports module
mzur Jan 7, 2025
ca1f731
Integrate remaining files of biigle/reports module
mzur Jan 8, 2025
cf7e70a
Merge branch 'master' into merge-reports-module
mzur Jan 8, 2025
8b7d602
Merge branch 'master' into merge-reports-module
mzur Jan 8, 2025
48b4ad3
Fix type errors
mzur Jan 8, 2025
9f2f395
Update report test cases
mzur Jan 8, 2025
76671dc
Fix volume test
mzur Jan 8, 2025
022289d
Fix CS
mzur Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/AnnotationLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @property int $annotation_id
* @property int $user_id
* @property int $label_id
* @property \Carbon\Carbon $created_at
*/
abstract class AnnotationLabel extends Model
{
Expand Down
54 changes: 54 additions & 0 deletions app/Http/Controllers/Api/ProjectReportController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace Biigle\Http\Controllers\Api;

use Biigle\Http\Requests\StoreProjectReport;
use Biigle\Jobs\GenerateReportJob;
use Biigle\Report;

class ProjectReportController extends Controller
{
/**
* Generate a project report.
*
* @api {post} projects/:id/reports Request a project report
* @apiGroup Reports
* @apiName GenerateProjectReport
*
* @apiParam {Number} id The project ID.
*
* @apiParam (Required arguments) {Number} type_id The report type ID.
*
* @apiParam (Optional arguments) {Boolean} export_area If `true`, restrict the report to the export area of the project. Only available for image annotation reports and the iFDO report.
* @apiParam (Optional arguments) {Boolean} newest_label If `true`, restrict the report to the newest label of each annotation.
* @apiParam (Optional arguments) {Boolean} separate_label_trees If `true`, separate annotations with labels of different label trees to different files or sheets of the spreadsheet. Cannot be used together with `separate_users`. Not available for the iFDO report.
* @apiParam (Optional arguments) {Boolean} separate_users If `true`, separate annotations with labels of different users to different files or sheets of the spreadsheet. Cannot be used together with `separate_label_trees`. Not available for the iFDO report.
* @apiParam (Optional arguments) {Number[]} only_labels Array of label IDs to restrict the report to. Omit or leave empty to take all labels.
* @apiParam (Optional arguments) {Boolean} aggregate_child_labels If `true`, add the abundance of child labels to the abundance of their parent labels and omit the child labels. This is only valid for the abundance report. Labels that are excluded with `only_labels` are not counted.
* @apiParam (Optional arguments) {Boolean} disable_notifications If `true`, suppress notification to the user on report completion.
* @apiParam (Optional arguments) {Boolean} strip_ifdo If `true`, remove annotation information from the original iFDO file before it is populated with BIIGLE annotations. Only available for the iFDO report.
*
* @apiPermission projectMember
*
* @param StoreProjectReport $request
* @param int $id Project ID
*
* @return mixed
*/
public function store(StoreProjectReport $request, $id)
{
$report = new Report;
$report->source()->associate($request->project);
$report->type_id = $request->input('type_id');
$report->user()->associate($request->user());
$report->options = $request->getOptions();
$report->save();

$queue = config('reports.generate_report_queue');
GenerateReportJob::dispatch($report)->onQueue($queue);

if ($this->isAutomatedRequest()) {
return $report;
}
}
}
80 changes: 80 additions & 0 deletions app/Http/Controllers/Api/ReportsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace Biigle\Http\Controllers\Api;

use Biigle\Report;
use Illuminate\Http\Response;
use Storage;

class ReportsController extends Controller
{
/**
* @apiDefine reportOwner Report Owner
* The user must be the owner of the report.
*/

/**
* Shows the specified report file.
*
* @api {get} reports/:id Get a report file
* @apiGroup Reports
* @apiName ShowReport
* @apiPermission reportOwner
* @apiDescription Responds with the file.
*
* @apiParam {Number} id The report ID.
*
* @param int $id report id
* @return mixed
*/
public function show($id)
{
$report = Report::findOrFail($id);
$this->authorize('access', $report);
$report->touch();

$disk = Storage::disk(config('reports.storage_disk'));

if (!$disk->exists($report->getStorageFilename())) {
abort(Response::HTTP_NOT_FOUND);
}

$path = $report->getStorageFilename();
return $disk->download($path, $report->filename)
// Use a custom fallback with fread() because the default fpassthru() could
// lead to an out of memory error with large reports.
->setCallback(function () use ($disk, $path) {
$stream = $disk->readStream($path);
while (!feof($stream)) {
echo fread($stream, 8192);
}
fclose($stream);
});
}

/**
* Delete a report.
*
* @api {delete} reports/:id Delete a report
* @apiGroup Reports
* @apiName DestroyReport
* @apiPermission reportOwner
*
* @apiParam {Number} id The report ID.
*
* @param int $id report id
* @return mixed
*/
public function destroy($id)
{
$report = Report::findOrFail($id);
$this->authorize('destroy', $report);
$report->delete();

if (!$this->isAutomatedRequest()) {
return $this->fuzzyRedirect()
->with('message', 'Report deleted.')
->with('messageType', 'success');
}
}
}
56 changes: 56 additions & 0 deletions app/Http/Controllers/Api/VolumeReportController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Biigle\Http\Controllers\Api;

use Biigle\Http\Requests\StoreVolumeReport;
use Biigle\Jobs\GenerateReportJob;
use Biigle\Report;

class VolumeReportController extends Controller
{
/**
* Generate a volume report.
*
* @api {post} volumes/:id/reports Request a volume report
* @apiGroup Reports
* @apiName GenerateVolumeReport
* @apiDescription Accepts only requests for annotation and image label reports.
*
* @apiParam {Number} id The volume ID.
*
* @apiParam (Required arguments) {Number} type_id The report type ID.
*
* @apiParam (Optional arguments) {Boolean} export_area If `true`, restrict the report to the export area of the volume. Only available for image annotation reports and the iFDO report.
* @apiParam (Optional arguments) {Boolean} newest_label If `true`, restrict the report to the newest label of each annotation.
* @apiParam (Optional arguments) {Boolean} separate_label_trees If `true`, separate annotations with labels of different label trees to different files or sheets of the spreadsheet. Cannot be used together with `separate_users`. Not available for the iFDO report.
* @apiParam (Optional arguments) {Boolean} separate_users If `true`, separate annotations with labels of different users to different files or sheets of the spreadsheet. Cannot be used together with `separate_label_trees`. Not available for the iFDO report.
* @apiParam (Optional arguments) {Number} annotation_session_id ID of an annotation session of the volume. If given, only annotations belonging to the annotation session are included in the report. Not available for the iFDO report.
* @apiParam (Optional arguments) {Number[]} only_labels Array of label IDs to restrict the report to. Omit or leave empty to take all labels.
* @apiParam (Optional arguments) {Boolean} aggregate_child_labels If `true`, add the abundance of child labels to the abundance of their parent labels and omit the child labels. This is only valid for the abundance report. Labels that are excluded with `only_labels` are not counted.
* @apiParam (Optional arguments) {Boolean} disable_notifications If `true`, suppress notification to the user on report completion.
* @apiParam (Optional arguments) {Boolean} strip_ifdo If `true`, remove annotation information from the original iFDO file before it is populated with BIIGLE annotations. Only available for the iFDO report.
*
* @apiPermission projectMember
*
* @param StoreVolumeReport $request
* @param int $id Volume ID
*
* @return mixed
*/
public function store(StoreVolumeReport $request, $id)
{
$report = new Report;
$report->source()->associate($request->volume);
$report->type_id = $request->input('type_id');
$report->user()->associate($request->user());
$report->options = $request->getOptions();
$report->save();

$queue = config('reports.generate_report_queue');
GenerateReportJob::dispatch($report)->onQueue($queue);

if ($this->isAutomatedRequest()) {
return $report;
}
}
}
94 changes: 94 additions & 0 deletions app/Http/Controllers/Api/Volumes/ExportAreaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace Biigle\Http\Controllers\Api\Volumes;

use Biigle\Http\Controllers\Api\Controller;
use Biigle\Volume;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\ValidationException;

class ExportAreaController extends Controller
{
/**
* Show the export area of the volume.
*
* @api {get} volumes/:id/export-area Get the export area
* @apiGroup Reports
* @apiName IndexVolumesExportArea
* @apiPermission projectMember
* @apiDescription The export area is a rectangle defined by two points. This endpoint returns an array containing the coordinates as follows: `[x1, y1, x2, y2]`.
* The first point may be any of the 4 points of the rectangle. The second point is the point not directly adjacent to the first. Only available for image volumes.
*
* @apiSuccessExample {json} Success response:
* [100, 100, 1200, 600]
*
* @param int $id Volume ID
* @return array
*/
public function show($id)
{
$volume = Volume::findOrFail($id);
$this->authorize('access', $volume);

if (!$volume->isImageVolume()) {
abort(Response::HTTP_NOT_FOUND);
}

return $volume->exportArea;
}

/**
* Set the export area.
*
* @api {post} volumes/:id/export-area Set the export area
* @apiGroup Volumes
* @apiName StoreVolumesExportArea
* @apiPermission projectAdmin
* @apiDescription Only available for image volumes.
*
* @apiParam (Required arguments) {Number[]} coordinates Coordinates of the export area formatted as `[x1, y1, x2, y2]` array of integers
*
* @param Request $request
* @param int $id Volume ID
*/
public function store(Request $request, $id)
{
$volume = Volume::findOrFail($id);
$this->authorize('update', $volume);
if (!$volume->isImageVolume()) {
throw ValidationException::withMessages(['id' => 'The export area can only be set for image volumes.']);
}
$this->validate($request, ['coordinates' => 'required|array']);

try {
$volume->exportArea = $request->input('coordinates');
$volume->save();
} catch (Exception $e) {
throw ValidationException::withMessages(['coordinates' => $e->getMessage()]);
}
}

/**
* Remove the export area.
*
* @api {delete} volumes/:id/export-area Remove the export area
* @apiGroup Volumes
* @apiName DestroyVolumesExportArea
* @apiPermission projectAdmin
* @apiDescription Only available for image volumes.
*
* @param int $id Volume ID
*/
public function destroy($id)
{
$volume = Volume::findOrFail($id);
$this->authorize('update', $volume);
if (!$volume->isImageVolume()) {
abort(Response::HTTP_NOT_FOUND);
}
$volume->exportArea = null;
$volume->save();
}
}
76 changes: 76 additions & 0 deletions app/Http/Controllers/Views/Projects/ProjectReportsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace Biigle\Http\Controllers\Views\Projects;

use Biigle\Http\Controllers\Views\Controller;
use Biigle\Modules\MetadataIfdo\IfdoParser;
use Biigle\Project;
use Biigle\ReportType;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class ProjectReportsController extends Controller
{
/**
* Show the new project reports view.
*
* @param Request $request
* @param int $id
*
* @return \Illuminate\View\View
*/
protected function show(Request $request, $id)
{
$project = Project::findOrFail($id);
$hasVideoVolume = $project->videoVolumes()->exists();
$hasImageVolume = $project->imageVolumes()->exists();
if (!$hasVideoVolume && !$hasImageVolume) {
abort(Response::HTTP_NOT_FOUND);
}

$this->authorize('access', $project);

$userProject = $request->user()->projects()->where('id', $id)->first();
$isMember = $userProject !== null;
$isPinned = $isMember && $userProject->getRelationValue('pivot')->pinned;
$canPin = $isMember && 3 > $request->user()
->projects()
->wherePivot('pinned', true)
->count();

$types = ReportType::when($hasImageVolume, fn ($q) => $q->where('name', 'like', 'Image%'))
->when($hasVideoVolume, fn ($q) => $q->orWhere('name', 'like', 'Video%'))
->orderBy('name', 'asc')
->get();


$hasExportArea = $project->imageVolumes()
->whereNotNull('attrs->export_area')
->exists();

$labelTrees = $project->labelTrees()->with('labels', 'version')->get();

$hasIfdos = false;

foreach ($project->volumes as $volume) {
if ($volume->metadata_parser === IfdoParser::class) {
$hasIfdos = true;
break;
}
}

return view('projects.reports', [
'project' => $project,
'isMember' => $isMember,
'isPinned' => $isPinned,
'canPin' => $canPin,
'activeTab' => 'reports',
'reportTypes' => $types,
'hasExportArea' => $hasExportArea,
'hasImageVolume' => $hasImageVolume,
'hasVideoVolume' => $hasVideoVolume,
'labelTrees' => $labelTrees,
'hasIfdos' => $hasIfdos,
]);
}
}
Loading
Loading