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

Create Volumetric Task #7227

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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/classifier/tasks/generic-editor.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = createReactClass
when 'slider' then ['instruction']
when 'highlighter' then ['instruction', 'highlighterLabels']
when 'dataVisAnnotation' then ['instruction', 'tools']
when 'volumetric' then ['instruction']

isAQuestion = @props.task.type in ['single', 'multiple']
canBeRequired = @props.task.type in ['single', 'multiple', 'text']
Expand Down
4 changes: 3 additions & 1 deletion app/classifier/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Highlighter from './highlighter';
import TranscriptionTask from './transcription';
import SubjectGroupComparisonTask from './subjectGroupComparison';
import DataVisAnnotationTask from './dataVisAnnotation'
import VolumetricTask from './volumetric';

const tasks = {
combo: ComboTask,
Expand All @@ -29,7 +30,8 @@ const tasks = {
highlighter: Highlighter,
transcription: TranscriptionTask,
subjectGroupComparison: SubjectGroupComparisonTask,
dataVisAnnotation: DataVisAnnotationTask
dataVisAnnotation: DataVisAnnotationTask,
volumetric: VolumetricTask
};

export default tasks;
50 changes: 50 additions & 0 deletions app/classifier/tasks/volumetric/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import PropTypes from "prop-types";
import React from "react";
import GenericTaskEditor from "../generic-editor";

export default class VolumetricTask extends React.Component {
constructor(props) {
super(props);
}
render() {
return <div>{"VolumetricTask Tool"}</div>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] This could be a bit more descriptive. e.g. "This is a placeholder for the Volumetric Task, which is only supposed to work on the FEM Classifier."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed and implemented.

}
}

VolumetricTask.Editor = GenericTaskEditor;

VolumetricTask.getDefaultTask = () => ({
help: "",
instruction: "Describe how to use this tool",
type: "volumetric",
});

VolumetricTask.getTaskText = (task) => task.instruction;

VolumetricTask.getDefaultAnnotation = () => ({ _toolIndex: 0, value: [] });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this task annotation actually use _toolIndex? If not, then this could just be VolumetricTask.getDefaultAnnotation = () => ({}); to avoid any confusion.


VolumetricTask.defaultProps = {
showRequiredNotice: false,
task: {
help: "",
type: "volumetric",
instruction: "Describe how to use this tool",
kieftrav marked this conversation as resolved.
Show resolved Hide resolved
},
workflow: {
tasks: [],
},
Comment on lines +31 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: what's the workflow used for?

If we're following the same Task pattern in PFE, then this parameter isn't required. We only really need task and showRequiredNotice.

(In practice, it double doesn't matter, since this Task shouldn't be working in PFE. 🤔 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome - thank you for the context. Removed.

};

VolumetricTask.propTypes = {
showRequiredNotice: PropTypes.bool,
task: PropTypes.shape({
help: PropTypes.string,
instruction: PropTypes.string,
required: PropTypes.bool,
tools: PropTypes.array,
type: PropTypes.string,
}),
workflow: PropTypes.shape({
tasks: PropTypes.object,
}),
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query: are propTypes.task.tools and propTypes.workflow actually needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed - didn't need them.

2 changes: 1 addition & 1 deletion app/pages/admin/project-status/experimental-features.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const experimentalFeatures = [
'textFromSubject', // textFromSubject task only works in FEM!
'transcription-task',
'translator-role',
'volumetricViewer',
'volumetricProject', // Turns a project into a Volumetric-enabled Project
'wildcam classroom', // Indicates a Project is linked to a "WildCam Lab"-type Zooniverse Classroom. Allows the classifier to select a workflow (i.e. "classroom assignment") directly via ID.
'workflow assignment',
'worldwide telescope'
Expand Down
10 changes: 9 additions & 1 deletion app/pages/lab-fem/workflow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class EditWorkflowPage extends Component {
} = this.props.workflow.configuration;
if (hide_classification_summaries === undefined) { hide_classification_summaries = true; }

const isCaesarDataFetchingEnabled = this.props.workflow?.configuration?.enable_caesar_data_fetching ?? false;
const isCaesarDataFetchingEnabled = this.props.workflow?.configuration?.enable_caesar_data_fetching ?? false;

return (
<div className="edit-workflow-page">
Expand Down Expand Up @@ -301,6 +301,14 @@ class EditWorkflowPage extends Component {
<small><strong>Data annotation</strong></small>
</button>
</AutoSave> : undefined}{' '}
{this.canUseTask(this.props.project, "volumetricProject") ?
<AutoSave resource={this.props.workflow}>
<button type="button" className="minor-button" onClick={this.addNewTask.bind(this, 'volumetric')} title="Volumetric Task: the volunteer looks at a volumetric viewer, and selects the point of the volume to be annotated.">
<i className="fa fa-th fa-2x"></i>
<br />
<small><strong>Volumetric Task</strong></small>
</button>
</AutoSave> : undefined}{' '}
</div> : undefined}
</div>

Expand Down