```python:inference/core/workflows/core_steps/sinks/roboflow/dataset_upload/v1.py
import supervision as sv
from concurrent.futures import ThreadPoolExecutor
from fastapi import BackgroundTasks
from inference.core.cache.base import BaseCache
from inference.core.workflows.execution_engine.entities.base import WorkflowImageData
from typing import List, Literal, Optional, Tuple, Union

WORKSPACE_NAME_CACHE_EXPIRE = 900  # 15 min
TIMESTAMP_FORMAT = "%Y_%m_%d"
DUPLICATED_STATUS = "Duplicated image"
BatchCreationFrequency = Literal["never", "daily", "weekly", "monthly"]


def register_datapoint_at_roboflow(
    image: WorkflowImageData,
    prediction: Optional[Union[sv.Detections, dict]],
    target_project: str,
    usage_quota_name: str,
    persist_predictions: bool,
    minutely_usage_limit: int,
    hourly_usage_limit: int,
    daily_usage_limit: int,
    max_image_size: Tuple[int, int],
    compression_level: int,
    registration_tags: List[str],
    fire_and_forget: bool,
    labeling_batch_prefix: str,
    new_labeling_batch_frequency: BatchCreationFrequency,
    cache: BaseCache,
    background_tasks: Optional[BackgroundTasks],
    thread_pool_executor: Optional[ThreadPoolExecutor],
    api_key: str,
    image_name: Optional[str] = None,
) -> Tuple[bool, str]:
    if fire_and_forget and background_tasks:
        background_tasks.add_task(
            execute_registration,
            image,
            prediction,
            target_project,
            persist_predictions,
            usage_quota_name,
            minutely_usage_limit,
            hourly_usage_limit,
            daily_usage_limit,
            max_image_size,
            compression_level,
            registration_tags,
            labeling_batch_prefix,
            new_labeling_batch_frequency,
            cache,
            api_key,
            image_name,
        )
        return False, "Element registration happens in the background task"
    if fire_and_forget and thread_pool_executor:
        thread_pool_executor.submit(
            execute_registration,
            image,
            prediction,
            target_project,
            persist_predictions,
            usage_quota_name,
            minutely_usage_limit,
            hourly_usage_limit,
            daily_usage_limit,
            max_image_size,
            compression_level,
            registration_tags,
            labeling_batch_prefix,
            new_labeling_batch_frequency,
            cache,
            api_key,
            image_name,
        )
        return False, "Element registration happens in the background task"
    return execute_registration(
        image,
        prediction,
        target_project,
        persist_predictions,
        usage_quota_name,
        minutely_usage_limit,
        hourly_usage_limit,
        daily_usage_limit,
        max_image_size,
        compression_level,
        registration_tags,
        labeling_batch_prefix,
        new_labeling_batch_frequency,
        cache,
        api_key,
        image_name,
    )


RECREATION_INTERVAL2TIMESTAMP_GENERATOR = {
    "daily": generate_today_timestamp,
    "weekly": generate_start_timestamp_for_this_week,
    "monthly": generate_start_timestamp_for_this_month,
}
```
```python:inference/core/workflows/core_steps/sinks/roboflow/dataset_upload/v2.py
import random
import supervision as sv
from concurrent.futures import ThreadPoolExecutor
from fastapi import BackgroundTasks
from inference.core.cache.base import BaseCache
from inference.core.workflows.core_steps.sinks.roboflow.dataset_upload.v1 import register_datapoint_at_roboflow
from inference.core.workflows.execution_engine.entities.base import WorkflowImageData
from typing import List, Literal, Optional, Tuple, Union

BatchCreationFrequency = Literal["never", "daily", "weekly", "monthly"]


def maybe_register_datapoint_at_roboflow(
    image: WorkflowImageData,
    prediction: Optional[Union[sv.Detections, dict]],
    target_project: str,
    usage_quota_name: str,
    data_percentage: float,
    persist_predictions: bool,
    minutely_usage_limit: int,
    hourly_usage_limit: int,
    daily_usage_limit: int,
    max_image_size: Tuple[int, int],
    compression_level: int,
    registration_tags: List[str],
    fire_and_forget: bool,
    labeling_batch_prefix: str,
    new_labeling_batch_frequency: BatchCreationFrequency,
    cache: BaseCache,
    background_tasks: Optional[BackgroundTasks],
    thread_pool_executor: Optional[ThreadPoolExecutor],
    api_key: str,
    image_name: Optional[str] = None,
) -> Tuple[bool, str]:
    normalised_probability = data_percentage / 100
    if random.random() < normalised_probability:
        return register_datapoint_at_roboflow(
            image,
            prediction,
            target_project,
            usage_quota_name,
            persist_predictions,
            minutely_usage_limit,
            hourly_usage_limit,
            daily_usage_limit,
            max_image_size,
            compression_level,
            registration_tags,
            fire_and_forget,
            labeling_batch_prefix,
            new_labeling_batch_frequency,
            cache,
            background_tasks,
            thread_pool_executor,
            api_key,
            image_name,
        )
    return False, "Registration skipped due to sampling settings"
```