Skip to content

Commit

Permalink
Update classifier documentation to link together all existing README'…
Browse files Browse the repository at this point in the history
…s and provide some additional context on the overarching code architecture and underlying data models.
  • Loading branch information
kieftrav committed Aug 8, 2024
1 parent 2668aab commit 8b44baf
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 25 deletions.
37 changes: 36 additions & 1 deletion packages/lib-classifier/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
# Zooniverse Classifier

A standalone library for the Zooniverse project classifier, including state management and UI component views.
A standalone library for the Zooniverse Project Classifier. The `Classifier` is comprised of three major pieces - the [SubjectViewer](/packages/lib-classifier/src/components/Classifier/components/SubjectViewer/README.md), the [Tasks](/packages/lib-classifier/src/plugins/tasks/README.md), and the [Store](/packages/lib-classifier/src/store/README.md).

```mermaid
flowchart TD
Classifier-->SubjectViewer
Classifier-->TaskArea
Classifier-->RootStore
```

- `SubjectViewer` is responsible for subject interaction and display
- `Tasks` are responsible for describing the type of data that the research team collects for a given `subject`.
- `Store` is responsible for managing the application state throughout the classification process.

## Classifier Render Process

The render process starts with a [Layout](/packages/lib-classifier/src/components/Classifier/components/Layout/README.md) that determines which components get loaded. The components that are loaded within the `Layout` but aren't related directly to the `SubjectViewer`, `Tasks`, or `Store` are as follows:

- [Banners](/packages/lib-classifier/src/components/Classifier/components/Banners/README.md)
- Feedback
- [ImageToolbar](/packages/lib-classifier/src/components/Classifier/components/ImageToolbar/README.md)
- MetaTools
- [QuickTalk](/packages/lib-classifier/src/components/Classifier/components/QuickTalk/README.md)

```mermaid
flowchart TB
Layout-->SubjectViewer
Layout-->TaskArea
Layout-->ImageToolbar
Layout-->Banners
Layout-->Feedback
Layout-->MetaTools
Layout-->QuickTalk
```

## Classifier Hooks
[Hooks](/packages/lib-classifier/src/hooks/README.md) are a collection of utility functions for the `Classifier`.

## Contributing

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ A subject viewer is a component designed to render the media of a subject and an

- [`VariableStarViewer`](components/VariableStarViewer/README.md) - renders JSON and an image media file for a composite of two scatter plots, two bar charts, and an image. Supports pan and zoom for each scatter plot independently as well as project specific interactive tools for the scatter plots.
- [`DataImageViewer`](components/DataImageViewer/README.md) - renders JSON as a scatter plot and an image media file side by side. Supports pan and zoom for the scatter plot and image independently.
- [`FlipbookViewer`](components/FlipbookViewer/README.md) - renders subjects with multiple images one image at a time using the `SingleImageViewer`.
- [`SeparateFramesViewer`](components/SeparateFramesViewer/README.md) - renders subjects with multiple images all at the same time using the `SingleImageViewer` for each image. Must use the `FlipbookViewer` first to enable separate frames.
- [`SubjectGroupViewer`](components/SubjectGroupViewer/README.md) - renders a group of subjects each with their own single image media file. This is meant to only work with the subject group comparison task. Supports pan and zoom for all subjects simultaneously as well as some configurations for rendering.
- [`ImageAndTextViewer`](components/ImageAndTextViewer/README.md) - renders a single image or a single text media file, with a toggle to switch between which media file is displayed.

Expand Down
73 changes: 50 additions & 23 deletions packages/lib-classifier/src/plugins/tasks/readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Classifier tasks
## Importing tasks
# Classifier Tasks

Tasks are the individual steps in a workflow that are used to collect data for an individual subject. The currently supported tasks are listed below:

- [Highlighter](/packages/lib-classifier/src/plugins/tasks/experimental/highlighter/README.md)
- [Simple Dropdown](/packages/lib-classifier/src/plugins/tasks/dropdown-simple/README.md)
- [Subject Group Comparison](/packages/lib-classifier/src/plugins/tasks/subjectGroupComparison/README.md)
- [Text from Subject](/packages/lib-classifier/src/plugins/tasks/experimental/textFromSubject/README.md)
- [Transcription](/packages/lib-classifier/src/plugins/tasks/experimental/transcription/README.md)
- [Drawing](/packages/lib-classifier/src/plugins/drawingTools/README.md)

** Note: Drawing tasks can be subdivided into Drawing Tools with corresponding `model`, `component`, and `annotation` models. There are some special cases called out with their own documentation.
- [Circle](/packages/lib-classifier/src/plugins/drawingTools/components/Circle/README.md)
- [Polygon](/packages/lib-classifier/src/plugins/drawingTools/components/Polygon/README.md)
- [FreehandLine](/packages/lib-classifier/src/plugins/drawingTools/experimental/components/FreehandLine/README.md)

## Task Structure

Every task has the same general structure:

```mermaid
flowchart TB
Task
Task---TaskComponent
Task---TaskModel
Task---AnnotationModel
```

## Adding a New Task
- create a new directory under `tasks` for your task.
- export a view component and task and annotation models.
```js
import { default as TaskComponent } from './components/MyNewTask'
import { default as TaskModel } from './models/MyNewTask'
import { default as AnnotationModel } from './models/MyNewAnnotation'

export default {
TaskComponent,
TaskModel,
AnnotationModel
}
```
- export your task from `tasks/index.js`, using the task type as the named export.
```js
export { default as myNewTask } from './myNewTask'
```

## Importing Tasks

```js
import * as tasks from '@plugins/tasks'
Expand All @@ -16,25 +62,6 @@ The default tasks export is a simple map of unique task types (`single`, `multip
- `taskRegistry.get(type (string))`: return the `Task` for `type`, or an empty object.
- `taskRegistry.values(property ('TaskComponent|TaskModel|AnnotationModel'))`: return all registered Tasks. Specify an optional property to return an array of only those properties eg. `const annotationModels = taskRegistry.values('AnnotationModel')`.

## Adding a new task
- create a new directory under `tasks` for your task.
- export a view component and task and annotation models.
```js
import { default as TaskComponent } from './components/MyNewTask'
import { default as TaskModel } from './models/MyNewTask'
import { default as AnnotationModel } from './models/MyNewAnnotation'

export default {
TaskComponent,
TaskModel,
AnnotationModel
}
```
- export your task from `tasks/index.js`, using the task type as the named export.
```js
export { default as myNewTask } from './myNewTask'
```

## React Components

A React component for a task takes a Task model and renders it as HTML. The basic shape is:
Expand All @@ -48,7 +75,7 @@ const SingleChoiceTask = tasks.single.TaskComponent
- _task_ is the task model to render.
- _disabled_ should be set if the task is disabled eg. while waiting for a subject to load.

## Task models
## Task Models

```js
import * as tasks from '@plugins/tasks'
Expand All @@ -75,7 +102,7 @@ Tasks may implement the following actions to hook into the workflow classificati
- _complete(annotation)_ Runs when exiting a step task by pressing Next or Done.
- _validate_ Runs when exiting a step task by pressing Next or Done. Intended for annotation validation, but could be used for any kind of validation if it must run on step Next or Done. Drawing task deletes invalid tool marks when this is called.

## Annotation models
## Annotation Models

```js
import * as tasks from '@plugins/tasks'
Expand Down
46 changes: 46 additions & 0 deletions packages/lib-classifier/src/store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,52 @@ The classifier store is built upon [mobx-state-tree](https://mobx-state-tree.js.
- snapshotting for caching, time travelling, logging, etc
- observability and reactivity

## Store Architecture
The `RootStore` is the base model for the classifier, and is a hierarchically flat key-value mapping of `{ [typeStore]: [typeStore]() }` to make referencing between related stores easier. The `RootStore` is composed of the following stores:

- ClassificationStore
- FeedbackStore
- FieldGuideStore
- ProjectStore
- SubjectStore
- SubjectSetStore
- SubjectViewerStore
- TutorialStore
- UserProjectPreferences
- WorkflowStore
- WorkflowStepStore

Although the `RootStore` state is managed in a flat hierarchy, the data model of a `Project` in relation to a user's `Classification` is hierarchical with its dependency graph as follows:

```mermaid
flowchart LR
Project
Project-->Feedback
Project-->FieldGuide
Project-->SubjectSet
Project-->Workflow
Project-->Tutorial
SubjectSet-->Subject
SubjectSet-->Workflow
Tutorial-->Workflow
Subject-->Annotation
Workflow-->WorkflowStep
WorkflowStep-->Annotation
Annotation-->Classification
```

## Stores with Documentation
- [Feedback](/packages/lib-classifier/src/store/feedback/README.md)
- [SubjectGroup](/packages/lib-classifier/src/store/subjects/SubjectGroup/README.md)
- [SubjectViewerStore](/packages/lib-classifier/src/store/SubjectViewerStore/README.md)

## Utilities
- [Utilities](/packages/lib-classifier/src/store/utils/README.md)
- [Translations](/packages/lib-classifier/src/translations/README.md)
- [Workers](/packages/lib-classifier/src/workers/README.md)

## Panoptes resources

We mostly work with Panoptes resources, so we have a standardized model to work with them. The `Resource` model defines the baseline model for Panoptes resources defining the resource id as the unique identifier to use in the tree. The `ResourceStore` model defines set of actions that can be used to asynchronously HTTP request and store the result of the request. Every Panoptes resource we request for should be a composition with the `ResourceStore`.
Expand Down
3 changes: 2 additions & 1 deletion packages/lib-classifier/src/store/feedback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ Note: lab components are currently part of [Panoptes-Front-End](https://github.c

## Strategies

A strategy is the method for reconciling a user's annotations and the known data defined on the subject. The following strategies are available:
A [strategy](strategies/README.md) is the method for reconciling a user's annotations and the known data defined on the subject. The following strategies are available:

### Drawing Task

- [Column](strategies/drawing/column/README.md)
- [Radial](strategies/drawing/radial/README.md)

### Question Task
Expand Down

0 comments on commit 8b44baf

Please sign in to comment.