Package: pyclarify
PyClarifyfrompyclarifyimportClientdata={"times":["2022-10-10T00:00:00"],"series":{"temperature":[19],"pressure":[1025]}}client=Client("credentials.json")client.insert(data)PyClarify helps users of Clarify to easily read, write and manipulate data in Clarify.Data scientists can easily filter data, convert it topandaswith our built in methods, and write results back.System integrators can set up pipelines for automatic streaming of data, and update labels on the fly.Useful tutorials and documentationPyClarify SDKPyClarify documentationClarify Developer documentationBasic tutorial on using Python with ClarifyPrerequisitesIn order to start using the Python SDK, you needTo know a bit of Python. For a refresher, see theOfficial Python tutorial.Python3 (>= 3.7) and pip.Credentials from a Clarify integration. See theintroduction notebookfor a complete introduction.Where to get itThe source code is currently hosted on GitHub at:https://github.com/clarify/pyclarifyBinary installers for the latest released version are available at thePython
Package Index (PyPI).# PyPI installpipinstallpyclarifyDependenciesrequests- The most used (and trusted) HTTP library.Pydantic- Allowing for strict typing and data validation.Typing Extensions- Brings the typing use of new type system features on older Python versions, allowing us to support python 3.7+.Interact with ClarifyPyClarify provides a fast and easy way to interact with Clarify.
TheClientclass takes as an argument the path of your credentials in string format, which should always be the first step when starting to interact with PyClarify.For information about the Clarify Developer documentation
clickhere.QuickstartWe recommend using Google Colab to quickly learn how to interact with Clarify using Python. We have created an interactive introduction tutorial where you will learn all the basics to get you started.Access you data with theClarifyClientfrompyclarifyimportClientclient=Client("clarify-credentials.json")Create newSignalsfrompyclarifyimportSignalsignal=Signal(name="Home temperature",description="Temperature in the bedroom",labels={"data-source":["Raspberry Pi"],"location":["Home"]})response=client.save_signals(input_ids=["INPUT_ID"],signals=[signal],create_only=False)Populate your signals usingDataFramesfrompyclarifyimportDataFramedata=DataFrame(series={"INPUT_ID_1":[1,None],"INPUT_ID_2":[None,5]},times=["2021-11-01T21:50:06Z","2021-11-02T21:50:06Z"],)response=client.insert(data)Query your stored signalsresponse=client.select_signals(skip=10,limit=50,sort=["-id"])Publish them asItemsfrompyclarifyimportItemclient=Client("./clarify-credentials.json")item=Item(name="Home temperature",description="Temperature in the bedroom",labels={"data-source":["Raspberry Pi"],"location":["Home"]},visible=True)response=client.publish_signals(signal_ids=['<SIGNAL_ID>'],items=[item],create_only=False)Use filters to get a specific selectionfrompyclarify.queryimportFilter,Regexonly_raspberries=Filter(fields={"labels.unit-type":Regex(value="Raspberry")})response=client.select_items(filter=only_raspberries)Get the data and include relationshipsresponse=client.data_frame(filter=only_raspberries,include=["item"])Look at our reference!ChangelogWondering about upcoming or previous changes to the SDK? Take a look at theCHANGELOG.ContributingWant to contribute? Check outCONTRIBUTING.