# Flows and Activities

Flows and activities form the structure and content of your [courses](https://docs.eduflow.com/guides/courses).

They're visible through the sidebar and Eduflow's URL structure.

`https://app.eduflow.com/courses/<course_id>/flows/<flow_id>/activities/<activity_id>`

Tip: Viewing the URL is a quick way to get the ID of a course, flow, activity, submission, or review.

## Flows

Flows are containers for activities.

Flows contain activities. Activities always have exactly one flow.

{% hint style="info" %}
Gotcha: Activities at the root-level of the sidebar belong to an invisible flow, "class-level activities".
{% endhint %}

## Activities

There are a growing list of activities for Eduflow. Activities accessible to your institution's course can be seen through the "Create Activity" button on the bottom right of the sidebar.

### Activity types

| Activity          | Description                                                                                                                             |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Content           | Displays a read-only content to user                                                                                                    |
| Video             | Similar to Content, but allows for a Video upload or embedding Vimeo / YouTube                                                          |
| Submission        | Student submits content (Rich text, video recording/screencast, file upload, google drive upload)                                       |
| Self review       | Review of one's own Submission                                                                                                          |
| Instructor review | Instructor's review of Submission                                                                                                       |
| Peer review       | Student's are assigned to review each other's submissions                                                                               |
| Score             | Calculate custom, composite scores based on activity completion, review scores                                                          |
| HapYak            | Integration video courses from HapYak                                                                                                   |
| Zoom              | Integrate zoom calls                                                                                                                    |
| Grade passback    | [LTI Basic Outcomes v1.1](https://www.imsglobal.org/spec/lti-bo/v1p1/) support (single output supported, e.g. completion, review score) |
| Select a tag      | Lets students assign themselves to a tag in a course                                                                                    |
| Discussion        | Lets participants create topics and submit comments and replies                                                                         |

### Querying

Since there are many activity types, activities make use of [GraphQL Interfaces](https://graphql.org/learn/schema/#interfaces).

Common fields, such as `id` and `title` can be represented through `ActivityInterface`, via an [inline fragment](https://graphql.org/learn/queries/#inline-fragments). Interfaces and inline fragments are what allow structured, typed access to generic and specialized information in GraphQL.

{% content-ref url="../graphql/inline-fragments" %}
[inline-fragments](https://docs.eduflow.com/graphql/inline-fragments)
{% endcontent-ref %}

#### Listing (inside course)

{% tabs %}
{% tab title="Query" %}

```graphql
{
  course(id: "00000000-5945-95c7-65fc-a9747b300320") {
    flows {
      title
      activities {
        ... on ActivityInterface {
          id
          title
          __typename
        }
      }
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "course": {
      "flows": [
        {
          "title": "Root flow",
          "activities": [
            {
              "id": "901abf26-f691-41d6-8777-a398e1f61b31",
              "title": "Welcome aboard!",
              "__typename": "ContentActivity"
            }
          ]
        },
        {
          "title": "Corporate Culture",
          "activities": [
            {
              "id": "faa38ffe-6d2c-4f4b-ae1d-cd43c616a7d2",
              "title": "Our Mission",
              "__typename": "ContentActivity"
            },
            {
              "id": "c5426418-0772-46b1-a84c-3f6f1e9d2925",
              "title": "Make an impact",
              "__typename": "SubmissionActivity"
            },
            {
              "id": "ae8f3183-0fd0-48e1-b52d-2f455cd78db7",
              "title": "Spot-check and team build",
              "__typename": "PeerReviewActivity"
            },
            {
              "id": "b59a7ae2-eeac-45ae-99b2-898f201c0955",
              "title": "Introspect and reflect",
              "__typename": "FeedbackReflectionActivity"
            },
            {
              "id": "b303c4ee-c450-4960-a951-082afe5b1c10",
              "title": "From your manager",
              "__typename": "TeacherReviewActivity"
            },
            {
              "id": "88ee9906-dc7d-4fa0-a13c-81ed68372ca6",
              "title": "How would you improve?",
              "__typename": "SelfReviewActivity"
            },
            {
              "id": "948561cc-5aed-4ff4-92a6-a761fc38d154",
              "title": "Water cooler",
              "__typename": "ContentActivity"
            },
            {
              "id": "73568026-fdd9-4c11-8662-bf5f291b99e3",
              "title": "Networking: Meet across divisions",
              "__typename": "ContentActivity"
            }
          ]
        },
        {
          "title": "Paper in the 2000's",
          "activities": [
            {
              "id": "f4017cb7-f924-4671-a9f1-913cc8244a3a",
              "title": "Paper: Relevant today?",
              "__typename": "ContentActivity"
            },
            {
              "id": "f79b1238-5b93-41bf-9af1-78a84b8fbcbb",
              "title": "How do you use paper?",
              "__typename": "SubmissionActivity"
            },
            {
              "id": "923944e7-51f8-4606-b2fa-f6d35fb0c158",
              "title": "Our philosophy",
              "__typename": "ContentActivity"
            }
          ]
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

#### via ID

Specialty fields, such as `countStudentsCompleted` on `SubmissionActivity` can be reached by adding an [inline fragment](https://graphql.org/learn/queries/#inline-fragments).

{% tabs %}
{% tab title="Query" %}

```graphql
{
  activity(id: "c5426418-0772-46b1-a84c-3f6f1e9d2925") {
    ... on ActivityInterface {
      id
      title
      __typename
    }
    ... on SubmissionActivity {
      countStudentsCompleted
    }
  }
}

```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "activity": {
      "id": "c5426418-0772-46b1-a84c-3f6f1e9d2925",
      "title": "Make an impact",
      "__typename": "SubmissionActivity",
      "countStudentsCompleted": 8
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Mutations

#### Mark activities as complete

`markActivityComplete`

{% tabs %}
{% tab title="Query" %}

```graphql
mutation {
  markActivityComplete(
    activityId: "5b1f1253-68ea-4583-bfff-0ae5938fcd64", 
    studentEmail: "student@example.edu"
  ) {
    activity {
      ... on ActivityInterface {
        title
      }
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "markActivityComplete": {
      "activity": {
        "title": "Onboarding (New Employees)"
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Scores and calculations

To learn more about querying the scores of Reviews, see the Outputs summary section:

{% content-ref url="course-summary-outputs" %}
[course-summary-outputs](https://docs.eduflow.com/guides/course-summary-outputs)
{% endcontent-ref %}
