code: def __convert_json_to_projects_map(self, json):
          
          ds_repo_to_prj = {}
  
          for project in json:
              for ds in json[project]:
                  if ds == "meta":
                      continue  # not a real data source
                  if ds not in ds_repo_to_prj:
                      if ds not in ds_repo_to_prj:
                          ds_repo_to_prj[ds] = {}
                  for repo in json[project][ds]:
                      if repo in ds_repo_to_prj[ds]:
                          if project == ds_repo_to_prj[ds][repo]:
                              logger.debug("Duplicated repo: %s %s %s", ds, repo, project)
                          else:
                              if len(project.split(".")) > len(ds_repo_to_prj[ds][repo].split(".")):
                                  logger.debug("Changed repo project because we found a leaf: %s leaf vs %s (%s, %s)",
                                               project, ds_repo_to_prj[ds][repo], repo, ds)
                                  ds_repo_to_prj[ds][repo] = project
                      else:
                          ds_repo_to_prj[ds][repo] = project
          return ds_repo_to_prj
docs: Convert JSON format to the projects map format
          map[ds][repository] = project
          If a repository is in several projects assign to leaf
          Check that all JSON data is in the database
  
          :param json: data with the projects to repositories mapping
          :returns: the repositories to projects mapping per data source