docstr: Register a data subject.
docstr_tok: ["Register","a","data","subject","."]
code: def add(
      self,
      context: AuthedServiceContext,
      data_subject: DataSubjectCreate,
  ) -> Union[SyftSuccess, SyftError]:
      """Register a data subject."""
  
      member_relationship_add = context.node.get_service_method(
          DataSubjectMemberService.add
      )
  
      member_relationships = data_subject.member_relationships
      for member_relationship in member_relationships:
          parent_ds, child_ds = member_relationship
          for ds in [parent_ds, child_ds]:
              result = self.stash.set(
                  context.credentials,
                  ds.to(DataSubject, context=context),
                  ignore_duplicates=True,
              )
              if result.is_err():
                  return SyftError(message=str(result.err()))
          result = member_relationship_add(
              context, parent_ds.name, child_ds.name
          )
          if isinstance(result, SyftError):
              return result
  
      return SyftSuccess(
          message=f"{len(member_relationships)+1} Data Subjects Registered"
      )
  
imports: from typing import List
  from typing import Optional
  from typing import Union
  from result import Result
  from ...node.credentials import SyftVerifyKey
  from ...serde.serializable import serializable
  from ...store.document_store import BaseUIDStoreStash
  from ...store.document_store import DocumentStore
  from ...store.document_store import PartitionSettings
  from ...store.document_store import QueryKeys
  from ...util.telemetry import instrument
  from ..context import AuthedServiceContext
  from ..response import SyftError
  from ..response import SyftSuccess
  from ..service import AbstractService
  from ..service import SERVICE_TO_TYPES
  from ..service import TYPE_TO_SERVICE
  from ..service import service_method
  from .data_subject import DataSubject
  from .data_subject import DataSubjectCreate
  from .data_subject import NamePartitionKey
  from .data_subject_member_service import DataSubjectMemberService
label_desc: Use image node_id 2 for calling the DataSubjectService obj's underlying member method code with example usage: obj.add(context, data_subject) and returns: SyftSuccess, result, SyftError