An example parser for openBIS using the bam-masterdata interface.
This repository is intended to be used as a template or example to be forked to generate new parsers in openBIS
integrated with the openbis-upload-helper.
You can either fork or use this repository as a template.
Click on the button Use this template and choose Create a new repository:
You will be prompted to create a new repository. Choose:
- Place to host the repository (organization or your own profile). In our case, we selected BAMResearch
- Give a name. We named our repository masterdata-parser-nerxiv
- Write a short description.
- Choose Public visibility.
With your new repository created, clone it locally:
git clone https://github.com/BAMresearch/masterdata-parser-example.gitNote: we will be using our example with this repository to showcase the commands. Please, change the corresponding paths to your own repository naming conventions.
We have now a new folder, masterdata-parser-example, containing the following structure:
masterdata-parser-example
├── LICENSE
├── pyproject.toml
├── README.md
├── src
│ ├── masterdata_parser_example
│ ├── __init__.py
│ ├── parser.py
│ └── _version.py
└── tests
├── __init__.py
├── conftest.py
└── test_parser.pyBelow you can find an explanation of each file. You can also change the name of the package from masterdata_parser_example to your preferred package name <pkg-name>.
In order to create your new parser, you have to:
- Define a new class in
src/<pkg-name>/parser.pyinstead ofMasterdataParserExample. We recommend naming itPkgName. - Modify
src/<pkg-name>/__init__.pyentry point variables:
from .parser import PkgName
# Add more metadata if needed
<pkg-name>_entry_point = {
"name": "PkgName",
"description": "A new parser for masterdata.",
"parser_class": PkgName,
}- Modify the
pyproject.tomlline[project.entry-points."bam.parsers"]to the new entry point:
<pkg-name>_entry_point = "<pkg-name>:<pkg-name>_entry_point"- Modify all other parts in
pyproject.tomlwhere the<pkg-name>ismasterdata_parser_exampleto your package name.
To be added!
With the new structure, you can work in your parser to map data from your files into openBIS by modifying src/<pkg-name>/parser.py and the testing
module tests/test_parser.py.
Once your new parser has been developed and tested, you can add it to the registry of parsers in the openbis-upload-helper. We recommend you contacting the maintainers of the application with a link to your parser repository.

