# PYP Term Grade Scores

ManageBac+'s Term Grades in the Primary Years Program have a complex data structure due to the nature of assessment and reporting within that curriculum. Thus, the API responses have a deeply nested properties, different from other term grades in other curricula.

In order to extract the grades ("scores") that are embedded in the response requires understanding how to flatten the nested structure, which can be accomplished by understanding the patterns in the data.

This article is intended to provide developers with a high-level overview in order to parse responses to extract scores.

## Term Grade Entities

A term grade entity has three IDs that establish its uniqueness:

* Class ID
* Term ID
* Student ID

The API is accessed via a Class ID and Term ID passed as path parameters, and the responses is an array of records where the Student ID can be obtained:

`/v2/classes/:class_id/assessments/term/:term_id/term-grades`

To determine valid `term_id` for a given class, please use the `/v2/classes` or `/v2/classes/:class_id` endpoint, which includes a `start_term_id` and `end_term_id` for each class class, and then the `/v2/school/academic-years` endpoint to loop through the terms in-between.

## Responses

Each record has nested keys that correspond to different sections on the term grade report, for example `atl_assessment`, `rubrics`, `subjects`, and `units`, highlighted here:

```json
{
    "students": [
        {
            "id": 123455,
            "name": "Last Name, First Name",
            "term_grade": [
                "atl_assessments": {},
                "comments": "Comment",
                "rubrics": [],
                "subjects": [],
                "units": []
            ]
        },
        // ...
    ]
}
```

## Nested Properties

When the above properties are expanded, the keys provided within each key can differ according to settings. For example, The units structure may have scores embedded inside of different areas of a unit, for example "overall\_assessment".

```json
    // ...
    "units": [
        {
            "comment": null,
            "id": 123456,
            "overall_assessment": {
                "criteria": [
                    {
                        "id": 1234,
                        "score": "G",  // <--- score
                        "title": "Effort"
                    }
                ]
            },
            "ss_assessment": {},
            "subjects": {},
            "title": "How the World Works (Change)",
            "transciplinary_theme": {

            }
        }
    ],
    // ...
```

These values correspond to the teacher evaluations entered into the term grade, if enabled. These evaluations can be done on a per-unit basis:

<figure><img src="https://github.com/classroomtechtools/faria_edu_dev_portal_staging/blob/main/managebac+/.gitbook/assets/image%20(1).png" alt=""><figcaption></figcaption></figure>

Other scores are deeply nested into the subjects structure. Depending on settings, it can have the path subjects -> stands -> standards -> standards -> criteria.

Other possible paths are:

* subjects -> strands -> criteria
* subjects -> phases -> criteria
* subjects -> strands -> standards -> criteria
* subjects -> strands -> standards -> standards -> criteria


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.fariaedu.com/integrations-portal/managebac/recipes/pyp-term-grade-scores.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
