<commit_before># Example Pythin script to execute the labcas-upload and labcas-update workflows

from gov.nasa.jpl.edrn.labcas.labcas_client import LabcasClient

if __name__ == '__main__':
        
    datasetId = 'mydata'
    labcasClient = LabcasClient()
    
    # print out workflow definition
    #labcasClient.getWorkflowsByEvent("labcas-upload")
    # or equivalently
    labcasClient.getWorkflowById("urn:edrn:LabcasUploadWorkflow")

'''
    # core metadata fields
    metadata = { 'Description':'My own data',
                 'DatasetName':'My Data',
                 'ProtocolId':'99',
                 'LeadPI':'<NAME>'} 
    

    # upload dataset staged in directory 'mydata'
    labcasClient.uploadDataset(datasetId, metadata)

    # upload the dataset again:
    # o a new version will be generated
    # o the product type metadata will be completey overridden
    metadata['ProtocolId'] = '98'
    labcasClient.uploadDataset(datasetId, metadata)
 
    # update dataset metadata - no new version is generated
    metadata['LeadPI'] = '<NAME>'
    labcasClient.updateDataset(datasetId, metadata)
    
    # list all product types in File manager
    labcasClient.listProductTypes()
    
    # query the product types from the XML/RPC File Manager interface
    labcasClient.getProductTypeByName(datasetId)
    
    # or equivalently
    labcasClient.getProductTypeById("urn:edrn:%s" % datasetId)
    
    # list all products for given dataset == product type
    labcasClient.listProducts(datasetId)
'''<commit_msg>Re-instating the full example script.<commit_after># Example Pythin script to execute the labcas-upload and labcas-update workflows

from gov.nasa.jpl.edrn.labcas.labcas_client import LabcasClient

if __name__ == '__main__':
        
    datasetId = 'mydata'
    labcasClient = LabcasClient()
    
    # print out workflow definition
    #labcasClient.getWorkflowsByEvent("labcas-upload")
    # or equivalently
    labcasClient.getWorkflowById("urn:edrn:LabcasUploadWorkflow")
    
    # core metadata fields
    metadata = { 'Description':'My own data',
                 'DatasetName':'My Data',
                 'ProtocolId':'99',
                 'LeadPI':'<NAME>'} 
    

    # upload dataset staged in directory 'mydata'
    labcasClient.uploadDataset(datasetId, metadata)

    # upload the dataset again:
    # o a new version will be generated
    # o the product type metadata will be completey overridden
    metadata['ProtocolId'] = '98'
    labcasClient.uploadDataset(datasetId, metadata)
 
    # update dataset metadata - no new version is generated
    metadata['LeadPI'] = '<NAME>'
    labcasClient.updateDataset(datasetId, metadata)
    
    # list all product types in File manager
    labcasClient.listProductTypes()
    
    # query the product types from the XML/RPC File Manager interface
    labcasClient.getProductTypeByName(datasetId)
    
    # or equivalently
    labcasClient.getProductTypeById("urn:edrn:%s" % datasetId)
    
    # list all products for given dataset == product type
    labcasClient.listProducts(datasetId)
{'fraction_non_alphanumeric': 0.08630759247242051, 'fraction_numerical': 0.0025957170668397143, 'mean_word_length': 3.217510259917921, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7662278', 'n_tokens_mistral': 887, 'n_tokens_neox': 856, 'n_words': 238}