Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d3af475
move from terra
jyu00 Jun 17, 2021
7506759
run black
jyu00 Jun 17, 2021
4503267
convert service exception to log
jyu00 Jun 17, 2021
5e97146
fix lint
jyu00 Jun 17, 2021
6bd5c64
log post processing failure
jyu00 Jun 17, 2021
1780a37
remove data index
jyu00 Jun 17, 2021
e3a2d31
fix test can package typo
jyu00 Jun 17, 2021
b727010
Merge branch 'main' into results-db
yaelbh Jun 20, 2021
d2482ac
Merge remote-tracking branch 'upstream/main' into results-db
jyu00 Jun 23, 2021
8139169
Merge remote-tracking branch 'origin/results-db' into results-db
jyu00 Jun 23, 2021
1fd9dd5
remove experiment_class and result_class
jyu00 Jun 23, 2021
404d7be
fix lint
jyu00 Jun 23, 2021
aa507c8
Merge branch 'main' into results-db
yaelbh Jun 24, 2021
248f5aa
Merge branch 'main' into results-db
yaelbh Jun 24, 2021
b367355
Merge branch 'main' into results-db
yaelbh Jun 24, 2021
c09d010
Merge branch 'main' into results-db
yaelbh Jun 24, 2021
87f2355
Merge branch 'main' into results-db
yaelbh Jun 27, 2021
f09667c
doc update
jyu00 Jun 28, 2021
c98e2c6
rename classes
jyu00 Jun 28, 2021
9070a89
review comments
jyu00 Jun 28, 2021
25c5156
Merge remote-tracking branch 'origin/results-db' into results-db
jyu00 Jun 28, 2021
5205ee6
fix lint
jyu00 Jun 28, 2021
11d392a
Merge branch 'main' into results-db
yaelbh Jun 29, 2021
e916c5f
review comments
jyu00 Jun 30, 2021
156bf4a
Merge remote-tracking branch 'origin/results-db' into results-db
jyu00 Jun 30, 2021
e2980ad
Merge remote-tracking branch 'upstream/main' into results-db
jyu00 Jun 30, 2021
7169edd
fix lint
jyu00 Jun 30, 2021
111c7ad
add db service to doc
jyu00 Jun 30, 2021
ede3a31
fix doc
jyu00 Jun 30, 2021
6653396
remove extra service keyword
jyu00 Jul 1, 2021
c433999
fix type hint
jyu00 Jul 1, 2021
2e01e94
review comments
jyu00 Jul 1, 2021
6f564d8
Merge branch 'main' into results-db
jyu00 Jul 1, 2021
d086374
Merge branch 'main' into results-db
yaelbh Jul 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/apidocs/database_service.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _qiskit-experiments:

.. automodule:: qiskit_experiments.database_service
:no-members:
:no-inherited-members:
:no-special-members:
1 change: 1 addition & 0 deletions docs/apidocs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Qiskit Experiments API Reference
tomography
analysis
data_processing
database_service

95 changes: 95 additions & 0 deletions qiskit_experiments/database_service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
=============================================================
Database Service (:mod:`qiskit_experiments.database_service`)
=============================================================

.. currentmodule:: qiskit_experiments.database_service

This subpackage contains classes used to define the data structure of
an experiment, including its data, metadata, analysis results, and figures, as
well as the interface to an experiment database service. An experiment database
service allows one to store, retrieve, and query experiment related data.

:class:`DbExperimentDataV1` is the main class that defines the structure of
experiment data, which consists of the following:

* Results from circuit execution, which is called ``data`` in this class.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting here in the rendered docs looks a bit weird to me, too far indented maybe?

image

I got the docs from the build output artifact.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2e01e94

The :meth:`DbExperimentDataV1.add_data`
method allows you to add circuit jobs and job results. If jobs are added,
the method asynchronously waits for them to finish and extracts job results.
:meth:`DbExperimentDataV1.data` can then be used to retrieve this data.
Note that this data is not saved in the database. It is included in this
class only for convenience.

* Experiment metadata. This is a freeform keyword-value dictionary. You can
use this to save extra information, such as the physical qubits the experiment
operated on, in the database. :meth:`DbExperimentDataV1.set_metadata` and
:meth:`DbExperimentDataV1.metadata` are methods to set and retrieve metadata,
respectively.

* Analysis results. It is likely that some analysis is to be done on the
experiment data once the circuit jobs finish, and the result of this
analysis can be stored in the database. Similar to ``DbExperimentDataV1``,
:class:`DbAnalysisResultV1` defines the data structure of an analysis
result and provides methods to interface with the database. Being a separate
class, :class:`DbAnalysisResultV1` allows you to modify an analysis result
without modifying the experiment data.

* Figures. Some analysis functions also generate figures, which can also be
saved in the database.

:class:`DatabaseServiceV1` provides low-level abstract interface for accessing the
database, such as :meth:`DatabaseServiceV1.create_experiment` for creating a
new experiment entry and :meth:`DatabaseServiceV1.update_experiment` for
updating an existing entry. :class:`DbExperimentDataV1` has methods that wrap
around some of these low-level database methods. For example,
:meth:`DbExperimentDataV1.save` calls :meth:`DatabaseServiceV1.create_experiment`
under the cover to save experiment related data. The low-level methods are only
expected to be used when you want to interact with the database directly - for
example, to retrieve a saved analysis result.

Currently only IBM Quantum provides this database service. See
`qiskit-ibmq-provider <https://qiskit.org/documentation/apidoc/ibmq_experiment.html>`_
for more details.

Classes
=======

.. autosummary::
:toctree: ../stubs/

DbExperimentData
DbExperimentDataV1
DbAnalysisResult
DbAnalysisResultV1
DatabaseService
DatabaseServiceV1


Exceptions
==========

.. autosummary::
:toctree: ../stubs/

DbExperimentDataError
DbExperimentEntryExists
DbExperimentEntryNotFound
"""

from .db_experiment_data import DbExperimentData, DbExperimentDataV1
from .db_analysis_result import DbAnalysisResult, DbAnalysisResultV1
from .database_service import DatabaseService, DatabaseServiceV1
from .exceptions import DbExperimentDataError, DbExperimentEntryExists, DbExperimentEntryNotFound
Loading