Skip to content

A python client library for interacting with the SciCat data catalog backend.

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt
Notifications You must be signed in to change notification settings

SciCatProject/pyscicat

 
 

Repository files navigation

Pyscicat

Pyscicat is a python client library for interacting with the SciCat backend. It sends messages to the SciCat backend over HTTP. It currently does not contain any command line interface.

Documentation for Pyscicat is available here.

Basic usage example

from datetime import datetime

from pyscicat.client import ScicatClient 
from pyscicat.model import (Ownable, RawDataset, DatasetType, Sample)

# Create a client object. The account used should have the ingestor role in SciCat
client = ScicatClient(base_url="http://localhost/api/v3", username="admin", password="2jf70TPNZsS")

ownable = Ownable(ownerGroup="aGroup", accessGroups=[])

# Create a Dataset object. Notice how we pass the `ownable` instance.
dataset = RawDataset(
    size=42,
    owner="ingestor",
    contactEmail="[email protected]",
    creationLocation="magrathea",
    creationTime=str(datetime.now().isoformat()),
    instrumentId="earth",
    proposalId="deepthought",
    dataFormat="planet",
    type = DatasetType.raw,
    principalInvestigator="admin",
    sourceFolder="/foo/bar",
    scientificMetadata={"a": "field"},
    sampleId="gargleblaster",
    **ownable.model_dump(),
)
dataset_id = client.datasets_create(dataset)

sample = Sample(
    sampleId="gargleblaster",
    owner="Chamber of Commerce",
    description="A legendary drink.",
    sampleCharacteristics={"Flavour": "Unknown, but potent"},
    isPublished=False,
    **ownable.model_dump()
)
sample_id = client.upload_sample(sample)

Notes

To develop with SciCatLive, connect to your local running instance with:

client = ScicatClient(base_url="http://localhost/api/v3", username="admin", password="2jf70TPNZsS", auto_login=False)
client._headers["Host"] = "backend.localhost"
client.login()

Then use the client normally.

About

A python client library for interacting with the SciCat data catalog backend.

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.2%
  • Shell 0.8%