Skip to content

Chemistry and Biology

Search the Chemistry and Biology database.

ChemistryBiology ¤

ChemistryBiology(timeout=30)

Bases: KCDB

Chemistry and Biology class.

Parameters:

Name Type Description Default
timeout float | None

The maximum number of seconds to wait for a response from the KCDB server.

30

BASE_URL class-attribute instance-attribute ¤

BASE_URL = 'https://www.bipm.org/api/kcdb'

The base url to the KCDB API.

DOMAIN class-attribute instance-attribute ¤

DOMAIN = Domain(
    code="CHEM-BIO", name="Chemistry and Biology"
)

The Chemistry and Biology domain.

MAX_PAGE_SIZE class-attribute instance-attribute ¤

MAX_PAGE_SIZE = 10000

The maximum number of elements that can be returned in a single KCDB request.

timeout property writable ¤

timeout

The timeout value, in seconds, to use for a KCDB request.

Returns:

Type Description
float | None

The maximum number of seconds to wait for a response from the KCDB server. If None, there is no timeout.

analytes ¤

analytes()

Return all Chemistry and Biology analytes.

Returns:

Type Description
list[Analyte]

A list of Analytes.

categories ¤

categories()

Return all Chemistry and Biology categories.

Returns:

Type Description
list[Category]

A list of Category's.

countries ¤

countries()

Return all countries.

Returns:

Type Description
list[Country]

A list of Country's.

domains ¤

domains()

Return all KCDB domains.

Returns:

Type Description
list[Domain]

A list of Domains.

filter staticmethod ¤

filter(data, pattern, *, flags=0)

Filter the reference data based on a pattern search.

Parameters:

Name Type Description Default
data Iterable[T]

An iterable of a ReferenceData subclass.

required
pattern str

A regular-expression pattern to use to filter results. Uses the label and value attributes of each item in data to perform the filtering.

required
flags int

Pattern flags passed to re.compile.

0

Returns:

Type Description
list[T]

The filtered reference data.

get ¤

get(url, *, json=None, params=None)

Send a GET request to the KCDB server.

Parameters:

Name Type Description Default
url str

The URL for the request.

required
json dict[str, bool | int | str | list[str]] | None

A JSON-serializable object to include in the body of the request.

None
params dict[str, int | str] | None

Query parameters to include in the URL.

None

Returns:

Type Description
Response

The response.

metrology_areas ¤

metrology_areas()

Return all metrology areas.

Returns:

Type Description
list[MetrologyArea]

A list of MetrologyAreas.

non_ionizing_quantities ¤

non_ionizing_quantities()

Return all non-Ionizing Radiation quantities.

Returns:

Type Description
list[NonIonizingQuantity]

A list of NonIonizingQuantity's.

post ¤

post(url, *, json=None, params=None)

Send a POST request to the KCDB server.

Parameters:

Name Type Description Default
url str

The URL for the request.

required
json dict[str, bool | int | str | list[str]] | None

A JSON-serializable object to include in the body of the request.

None
params dict[str, int | str] | None

Query parameters to include in the URL.

None

Returns:

Type Description
Response

The response.

quick_search(
    *,
    excluded_filters=None,
    included_filters=None,
    keywords=None,
    page=0,
    page_size=100,
    show_table=False
)

Perform a quick search.

Parameters:

Name Type Description Default
excluded_filters Iterable[str] | None

Excluded filters. Example: ["cmcServices.AC current", "cmcServices.AC power"]

None
included_filters Iterable[str] | None

Included filters. Example: ["cmcDomain.CHEM-BIO", "cmcBranches.Dimensional metrology"]

None
keywords str | None

Search keywords in elasticsearch format. Example: "phase OR test"

None
page int

Page number requested (0 means first page).

0
page_size int

Maximum number of elements in a page (maximum value is 10000).

100
show_table bool

Set to True to return table data.

False

Returns:

Type Description
ResultsQuickSearch

The CMC quick-search results.

search ¤

search(
    *,
    analyte=None,
    category=None,
    countries=None,
    keywords=None,
    metrology_area="QM",
    page=0,
    page_size=100,
    public_date_from=None,
    public_date_to=None,
    show_table=False
)

Perform a Chemistry and Biology search.

Parameters:

Name Type Description Default
analyte str | Analyte | None

Analyte label. Example: "antimony"

None
category str | Category | None

Category label. Example: "5"

None
countries str | Country | Iterable[str | Country] | None

Country label(s). Example: ["CH", "FR", "JP"]

None
keywords str | None

Search keywords in elasticsearch format. Example: "phase OR multichannel OR water"

None
metrology_area str | MetrologyArea

Metrology area label. Example: "QM"

'QM'
page int

Page number requested (0 means first page).

0
page_size int

Maximum number of elements in a page (maximum value is 10000).

100
public_date_from str | date | None

Minimal publication date. Example: "2005-01-31"

None
public_date_to str | date | None

Maximal publication date. Example: "2020-06-30"

None
show_table bool

Set to True to return table data.

False

Returns:

Type Description
ResultsChemistryBiology

The CMC results for Chemistry and Biology.