def main(nameFilename,
         debug=False,
         dataFilename=None,
         learningPaths={},
         students=None,
         period=None,
         heatMapColor="jet",
         functions=None,
         filterQuickClicks=False,
         filesToSave={
             "metaData": True,
             "nodes": True
         },
         conceptHitsParams=None,
         heatMapParams=None,
         studentGroups=None,
         **restArgs):
    Visualisation.init(nameFilename)
    settings = {}
    settings['learningpaths'] = learningPaths
    settings['students'] = students if not students is None else {
        "whitelist": False,
        "list": []
    }
    settings['period'] = period if not period is None else {"usePeriod": False}

    if dataFilename is None:
        dataFilename = [
            x for x in input(
                "which file would you like to use?(please enter the name of the excel file "
                "or files seperated by commas)\n").split(',')
        ]

    sample = {
        'learningpaths': {},
        'students': {
            'whitelist':
            True,
            'list': [{
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }, {
                'type': 'text',
                'value': '*****@*****.**'
            }]
        },
        'period': {
            'usePeriod': False,
            'startDate': datetime.datetime(2019, 9, 1, 0, 0),
            'endDate': datetime.datetime(2019, 12, 13, 0, 0)
        }
    }
    print(settings == sample)

    data = FilterData.filterAndExtractData(dataFilename, settings, debug=debug)
    if debug: print("done extracting data")

    # Annonymisation.annonymiseExtracted(data)
    # if debug: print("done making data anonymous")
    lookup = {}
    with open("inputFiles/studentsEncoded.csv", 'r') as studsEncode:
        reader = csv.reader(studsEncode)
        for name, number in reader:
            lookup[name] = number
    Annonymisation.alternateAnonymiseExtracted(data, lookup)

    output = DataProcessing.processDataExtracted(data,
                                                 settings['learningpaths'],
                                                 filterQuickClicks,
                                                 filesToSave=filesToSave,
                                                 timeOnPageCalc=True)
    # ToDo if visualisation's input is fixed, output['nodes'] can be used instead of loading nodes.json each time
    firstHit = []
    try:
        os.mkdir("outputs/hitsperday")
    except:
        pass
    try:
        os.mkdir("outputs/hoursperday")
    except:
        pass
    # for user in output["users"]:
    #     print(user)
    #     try:
    #         os.mkdir("outputs/user" + user)
    #     except:
    #         pass
    #     firstHit.append(Visualisation.hitsPerDayPerUser(output["users"], user, output["nodes"], settings))
    #     Visualisation.hoursPerDayPerUser(output['users'], user, output['nodes'], settings)
    # print(max(firstHit))
    for studentGroup in studentGroups:
        print(studentGroup)
        try:
            os.mkdir("outputs/hoursPerDayPerStudent/")
        except:
            pass
        try:
            os.mkdir("outputs/hoursPerDayPerStudent/" + studentGroup)
        except:
            pass
        print(studentGroup)
        for student in studentGroups[studentGroup]:
            student = "student " + str(student)
            Visualisation.hoursPerDayPerUserNoConcepts(
                output['users'],
                student,
                output['nodes'],
                settings,
                givenName="outputs/hoursPerDayPerStudent/" + studentGroup +
                "/" + student)

    # for path in settings['learningpaths']:
    #     Visualisation.learningpathFlowthrough(settings['learningpaths'][path])
    #     Visualisation.hitsPerDayPerLearningPath(pathId=path, settings=settings)
    #     Visualisation.heatMapOfGivenNodes(givenNodes=settings['learningpaths'][path]['list'],
    #                                       filename="heatmapPath" + str(path), colors=heatMapColor)
    #     if debug: print("done for path " + str(path))
    if debug: print(settings)
    DataProcessing.csvExports(nameFilename,
                              learningPaths=settings['learningpaths'],
                              functions=functions)

    # if not functions is None:
    #     if ("all" in functions or "allHitsPerDayPerConceptGraph" in functions) and conceptHitsParams:
    #         if debug: print("HitsPerDayPerConceptGraph same scale")
    #         Visualisation.generateSetOfPathVisits(conceptHitsParams, settings=settings,
    #                                               debug=debug, users=False, specificConcept=True)
    #     if "HitsPerDayPerConceptGraph" in functions and conceptHitsParams:
    #         if debug: print("HitsPerDayPerConceptGraph varying scales")
    #         for conceptId in conceptHitsParams:
    #             Visualisation.hitsPerDay(nodeId=conceptId)
    #     if "usersPerDayPerLearningPath" in functions:  # not all, because if we want all, they should be on the same scale
    #         if debug: print("usersPerDayPerLearningPath varying scales")
    #         for path in settings['learningpaths']:
    #             Visualisation.usersPerDayPerLearningPath(path, settings=settings)
    #     if "all" in functions or "allUsersPerDayPerLearningPath" in functions:
    #         if debug: print("UsersPerDayPerLearningPath same scale")
    #         Visualisation.generateSetOfPathVisits(pathId=list(settings['learningpaths']), settings=settings,
    #                                               debug=debug, users=True)
    #     if "all" in functions or "allHitsPerDayPerLearningPath" in functions:
    #         if debug: print("HitsPerDayPerLearningPath same scale")
    #         Visualisation.generateSetOfPathVisits(pathId=list(settings['learningpaths']), settings=settings,
    #                                               debug=debug)
    #     if "all" in functions or "allNodesFlowthrough" in functions:
    #         if debug: print("allNodesFlowthrough")
    #         Visualisation.allNodesFlowthrough(debug=debug)  # ToDo there is currently no way to properly display this
    #     if ("all" in functions or "allNodesHeatMap" in functions) and heatMapParams:
    #         if debug: print("allNodesHeatmap")
    #         Visualisation.heatMapOfGivenNodes(**heatMapParams)

    # ToDo nodes.json could be saved in such a way that the same nodes.json is not generated twice for the same settings
    if "all" not in filesToSave:  # remove any unwanted files
        if "metaData" not in filesToSave:
            if debug: print("removing metadata.json")
            os.remove("outputs/metaData.json")
        if "nodes" not in filesToSave:
            if debug: print("removing nodes.json")
            os.remove("outputs/nodes.json")