def METHOD_NAME(identifier):
    """Generate @id field."""
    # Determine the hostname for the resource URIs.
    # If RENKU_DOMAIN is set, it overrides the host from remote.
    # Default is localhost.
    host = "localhost"
    if project_context.has_context():
        host = project_context.remote.host or host
    host = os.environ.get("RENKU_DOMAIN") or host
    # always set the id by the identifier
    return urljoin(f"https://{host}", posixpath.join("/datasets", quote(identifier, safe="")))