GithubHelp home page GithubHelp logo

m0n0368291 / gcms-data-handler Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 1.0 27.34 MB

Batch processing and backup tool for GCMS data

License: GNU General Public License v3.0

Python 100.00%
gcms batch-processing python backup-script agilent gas-chromatography

gcms-data-handler's Introduction

GCMS Data Handler

This tool provides file sorting and backup functionality for gas chromatography systems. These systems normally save all aqcuired data in a default file location. Depending on the IT-infrastructure one might want to save these files in a backup location for safety reasons or to sort them into categories of a certain kind. This way it is possible to better control access to files for individual people or groups of people.

Features

  • moving files from a default location into a specified location
  • sorting of files into subfolders based on filename
  • backup of zipped files into a specified backup folder
  • the script provides a log file with all conducted operations

Workflow of GCMSDH

How does it work?

The script is in a timed loop. After a given time it iterates over all files in the default location and recognizes all files that have been specified in the configuration of the script. It creates a zipped copy of that file in the backup folder. Then the original file is moved to a target directory where multpile subfolders may exist. The script places the files in specified subfolders. The subfolder corresponding to a file is computed by using a regular expression. So the name of a file determines the subfolder it is placed in. This way one can sort the files by person, date, project etc.

Handling of duplicates

The script was written to never delete or overwrite anything so that no data is lost. In order to work, the script can deal with duplicate files. If the script tries to back up a zipped file that already exists in the backup folder, it renames the new file to begin with a unique timestamp. The same applies for the files in the respective subfolders.

Logging

The script keeps a log of alle performed actions. This should make it easier to troubleshoot a non-working script and to track down missing files. The log file is a simple text document in the same folder as the copyscript.

How do I get set up?

The tool is written in pure Python (3.5). There are no third party modules needed. You just need a working install of Python 3.X.

  • Copy the GCMSDH.py into the default location of the files to be sorted. For Agilent Systems this might be D:\MSD_data\.
  • Create a backup folder which contains all necessary subfolders for the sorting operations.
  • Create a folder at a chosen location which contains all necessary subfolders for the sorting operations.
  • Open GCMSDH.py and edit the configurations lines as needed:
    • path and files to declare where the default file location is.
    • acronyms to be used for sorting by adding them to the list of users.
    • target_dir and target_dir2 for the location where the files will be sorted.
    • pattern defines the regular expression that is used to associate the files with the subfolders that they will be sorted into.

Troubleshooting

There are several factors that may prevent the script from working. If the script is not working as intended, follow these steps:

  • check whether all necessary folders are created and the respective acronym has been added to the list of users
  • make sure the user executing the script has the right permissions for the folder containing the data
  • execute the script with elevated privileges
  • manually check for duplicates

Notes

  • The script will never try to handle the newest file in the default location. This is because the newest file is usually opened in the software that created the data file. Therefore an attempt to delete the file after backing up and moving will fail, causing duplicates.
  • Unhandled duplicates essentially cause the script to create an unlimited number of renamed data files and backups. This is because of the never delete anything approach.

Contribution guidelines

There is no way to contribute yet.

Who do I talk to?

Contact me via [email protected]

gcms-data-handler's People

Contributors

grmblflx avatar m0n0368291 avatar

Stargazers

 avatar

Forkers

alixmeng

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.