Primary Muscle Targets for Exercises in the hasaneyldrm/exercises-dataset
The primary muscle target for each exercise is stored in the target field of every record in the data/exercises.json file, representing the main muscle the movement is designed to emphasize.
The hasaneyldrm/exercises-dataset repository contains a structured collection of 1,324 exercise records, each documenting which muscle groups are emphasized during the movement. Understanding how to access and interpret the primary muscle targets is essential for building fitness applications, filtering workout routines, or analyzing exercise distributions.
Understanding the Dataset Schema
Each exercise object in the dataset defines three distinct fields related to muscle targeting:
target— The primary muscle that the exercise emphasizes (e.g., "abs", "biceps", "glutes")muscle_group— The primary synergist or supporting muscle group, often representing a larger anatomical region (e.g., "hip flexors")secondary_muscles— An array of additional muscles that act as helpers or stabilizers during the movement
In the README.md file at lines 70-72, the schema documentation explicitly defines target as the primary muscle field. A concrete example appears in the sample record for "3/4 sit-up" where the target field is set to "abs", the muscle_group is "hip flexors", and the secondary_muscles array contains ["hip flexors", "lower back"] according to the documentation at lines 24-30.
How to Extract Primary Muscle Targets
To retrieve the primary muscle targets across the entire collection, read the target property from each JSON object in data/exercises.json. Below are practical implementations in several languages.
Python (Standard Library)
Use the built-in json module and collections.Counter to analyze frequency distributions:
import json
from collections import Counter
with open("data/exercises.json", "r", encoding="utf-8") as f:
exercises = json.load(f)
# Count how many times each primary target appears
target_counts = Counter(ex["target"] for ex in exercises)
print("Top 10 primary muscle targets:")
for muscle, count in target_counts.most_common(10):
print(f"{muscle}: {count}")
Python (Pandas)
For data science workflows, load the JSON into a DataFrame to leverage vectorized operations:
import json
import pandas as pd
with open("data/exercises.json", "r", encoding="utf-8") as f:
data = json.load(f)
df = pd.DataFrame(data)
print(df["target"].value_counts().head(10))
JavaScript and Node.js
In Node.js environments, require the JSON file and use array methods to extract unique targets:
const exercises = require("./data/exercises.json");
// Get a Set of unique primary targets
const targets = new Set(exercises.map(e => e.target));
console.log("Unique primary muscle targets:", [...targets].sort());
// Frequency count
const counts = exercises.reduce((acc, ex) => {
acc[ex.target] = (acc[ex.target] || 0) + 1;
return acc;
}, {});
console.log("Top 10 targets:", Object.entries(counts)
.sort((a, b) => b[1] - a[1])
.slice(0, 10));
TypeScript
For type-safe access, define an interface matching the data/exercises.schema.json structure:
interface Exercise {
id: string;
name: string;
category: string;
body_part: string;
equipment: string;
instructions: Record<string, string>;
instruction_steps: Record<string, string[]>;
muscle_group: string;
secondary_muscles: string[];
target: string; // ← primary muscle target
media_id: string;
image: string;
gif_url: string;
attribution: string;
created_at: string;
}
import exercises from "./data/exercises.json";
const data = exercises as Exercise[];
// Unique targets
const uniqueTargets = Array.from(new Set(data.map(e => e.target))).sort();
console.log("Primary muscle targets:", uniqueTargets);
// Frequency
const freq = data.reduce<Record<string, number>>((acc, ex) => {
acc[ex.target] = (acc[ex.target] ?? 0) + 1;
return acc;
}, {});
console.log("Most common targets:", Object.entries(freq)
.sort((a, b) => b[1] - a[1])
.slice(0, 10));
Key Files and Schema Validation
The repository structure provides three critical resources for working with primary muscle targets:
data/exercises.json— The main data file containing the array of 1,324 exercise objects, each with thetargetfielddata/exercises.schema.json— JSON Schema defining the required structure and data types, including validation for thetargetpropertyREADME.md— Human-readable documentation describing the relationship betweentarget,muscle_group, andsecondary_musclesfields
According to the schema definition in data/exercises.schema.json, the target field is required for every exercise record, ensuring consistent data availability across the dataset.
Summary
- The primary muscle target for each exercise is stored in the
targetfield ofdata/exercises.json - Each record distinguishes between primary muscles (
target), supporting groups (muscle_group), and stabilizers (secondary_muscles) - The dataset contains 1,324 exercises with consistent schema validation ensuring every entry has a defined primary target
- Extract targets using standard JSON parsing in Python, JavaScript, or TypeScript by accessing the
.targetproperty on each exercise object
Frequently Asked Questions
What is the difference between target and muscle_group in the dataset?
The target field specifies the single primary muscle that receives the main load during the exercise (e.g., "abs"), while muscle_group indicates the broader anatomical region or synergist muscles that support the movement (e.g., "hip flexors"). This distinction allows applications to filter exercises by both specific muscles and general body regions.
How can I validate that an exercise record contains a primary muscle target?
Each exercise in data/exercises.json must conform to data/exercises.schema.json, which defines the target field as a required string property. When parsing the dataset, verify that ex.target exists and contains a non-empty string to ensure compliance with the schema.
Are secondary muscles also considered primary targets for exercises?
No, secondary muscles function as helpers or stabilizers rather than primary targets. According to the schema documentation in the README, the secondary_muscles array lists muscles that assist the movement but do not receive the main emphasis, distinguishing them from the single primary target stored in the target field.
Can I filter exercises by multiple primary muscle targets simultaneously?
Yes, since target is a string value on each exercise object, you can filter the dataset by creating a set or array of desired targets and selecting exercises where ex.target matches any value in your filter list. The dataset structure supports efficient filtering because every record contains the primary target as a top-level property.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →