"geo_loc_name": "blah", "lat_lon": "blah", "material": "blah", "project_name": "blah", "rel_to_oxygen": "blah", "samp_collect_device": "blah", "samp_mat_process": "blah", "samp_size": "blah", "source_mat_id": [ "a", "b", "c" ] } proj.name = "Test name" proj.description = "Test description" proj.center = "Test center" proj.contact = "Test contact" proj.srp_id = "Test SRP ID" proj.mixs = mixs_data proj.tags = [ "test", "project", "ihmp" ] proj.add_tag("another") proj.add_tag("and_another") if proj.is_valid(): print("Valid!") success = proj.save() if success: project_id = proj.id print("Succesfully saved project. ID: %s" % project_id) proj2 = Project.load(project_id)
load_config_from_file from cutlass import iHMPSession from cutlass import Project as OSDFNode # Project info file name info_file = '../data_files/project_info.yaml' # load username, password from files username = load_string_from_file('../auth/username.txt') password = load_string_from_file('../auth/password.txt') session = iHMPSession(username, password) print("Required fields: {}".format(OSDFNode.required_fields())) # load project info from info_file config = load_config_from_file(info_file) for node_info in config: node = OSDFNode() node.name = node_info['name'] node.description = node_info['description'] node.center = node_info['center'] node.contact = node_info['contact'] node.srp_id = node_info['srp_id'] node.tags = node_info['tags'] node.mixs = node_info['mixs'] # print(node.to_json(indent=2)) save_if_valid(node, OSDFNode)