Lat2DB is a project designed to convert lattice files into JSON format and store them in MongoDB. It utilizes a Lark grammar created by Andreas Felix to parse lattice files.
- Lattice File Conversion: Lat2DB can read a lattice file and export it to JSON format.
- MongoDB Integration: The exported JSON data is inserted into MongoDB for efficient storage and retrieval.
- REST API: Lat2DB is a REST API-based project, built using FastAPI, providing endpoints for interacting with the data.
- Python 3.x
- MongoDB installed and running
- Clone the repository:
git clone <https://github.com/hz-b/lat2db>
- Install dependencies:
pip install -r requirements.txt
To start the FastAPI server, run:
python scripts/main.py
To convert a lattice file to JSON and insert it into MongoDB, you can use the provided script:
python scripts/export_lattice_to_db.py
This script will convert the specified lattice file to JSON format and store it in the MongoDB database.
- GET
/machine/machine
: Retrieve a list of existing machines (lattices) from the MongoDB repository. - GET
/machine/machine/<uid>
: Retrieve a specific machine by its unique identifier (UID) from the MongoDB repository. - POST
/machine/machine
: Create a new machine by posting JSON data.
Thanks to Andreas Felix for the Lark grammar used in this project. Link to Andreas' GitHub Project