A package for interacting with PrISMa Platform APIs. PrISMa is a holistic system for numerical synthesis and assessment of Metal-Organic Frameworks and their applications, for Direct Air Capture of CO2. For more information, see: https://prisma.hw.ac.uk.
Project description
PrISMa API
Python client for the PrISMa platform APIs.
This package provides:
- legacy v1 wrappers on the main
apiobject - a larger v2 REST client on
api.v2 - local config-based API-key management
PrISMa is a platform for numerical synthesis and assessment of metal-organic frameworks and related carbon-capture workflows.
Installation
From PyPI
pip install prisma_api
Requirements
- Python 3.10+
- Runtime dependencies are installed automatically from
pyproject.toml
Authentication and configuration
The client uses an API key stored in a local config file.
First-time setup
import prisma_api
api = prisma_api.init()
On first use, the package creates a config file and prompts for an API key.
Upgrades
pip install --upgrade prisma_api
Find the config path
from prisma_api.config import locate_config
print(locate_config())
Typical locations:
- macOS/Linux:
~/.config/prisma_api/config.yaml - Windows:
%APPDATA%/prisma-api/prisma_api/config.yaml
Create or update the config programmatically
from prisma_api.config import create_config_file
create_config_file(api_key="YOUR_API_KEY_HERE")
Environment-variable mode
If you do not want to use the config file:
export PRISMA_API_KEY="YOUR_API_KEY_HERE"
export PRISMA_API_DEV="False"
from prisma_api.prisma_api import prisma_api
api = prisma_api(use_config_file=False)
Quick start
import prisma_api
api = prisma_api.init()
# v2 list endpoints return JSON by default in the main client
materials = api.v2.list_materials(name="ABEX")
print(materials[:2])
# switch list endpoints to pandas DataFrames if preferred
api.set_return_format("dataframe")
materials_df = api.v2.list_materials(name="ABEX")
print(materials_df.head())
Flowsheets
import prisma_api
api = prisma_api.init()
flowsheet = api.v2.get_flowsheet(name="dac_min")
Return formats
All v2 list endpoints support two formats:
json: returnslist[dict]dataframe: returnspandas.DataFrame
Detail endpoints always return dict.
api.set_return_format("json")
records = api.v2.get_molecules()
api.set_return_format("dataframe")
df = api.v2.get_molecules()
Main objects
prisma_api.init()Returns the main client object.apiLegacy v1 wrappers plus configuration helpers.api.v2PrismaAPIv2instance with the v2 REST surface.
v1 wrappers
The main client exposes these v1 methods:
get_mofs(payload={})get_carbon_isotherms(payload={})get_carbon_data_nested(payload={}, safe_names=False)get_materials_data(payload={}, separate_experimental=True)update_adsorption_singlepoint(df)update_heat_capacity_all_tidy(df)update_isotherm_h2(df)update_mofchecker(df)update_zeopp_metrics(df)
Configuration helpers on the main client:
set_return_format(fmt)update_dev_mode(dev)
Module-level helpers exported from the package:
prisma_api.initprisma_api.PrismaAPIv2prisma_api.update_dev_modeprisma_api.update_dev_host_portprisma_api.locate_config
v2 wrapper list
All methods below are available on api.v2.
Health and flowsheets
health()get_flowsheet(name="dac_min")
Materials and bundles
list_materials(name=None, limit=10000)get_material(material_id)get_materials_psdi(name=None, limit=500, offset=0)get_material_psdi(material_id)get_material_property_bundle(mof, sim_or_exp=None, good_structure=None, limit=500, offset=0, query=None)preflight_material_check(name)
Case bundles and pack builders
get_cases_bundle(name=None, source=None, sink=None, region=None, limit_cases=100, limit_props=2000)build_case_spec(case_id)build_scenario_spec(scenario_id)build_case_pack(case_id, scenario_id=None)list_case_packs(source=None, sink=None, region=None, study=None, include_scenarios=False, limit=100, offset=0)
Catalog and reference data
get_molecules(name=None, limit=500, offset=0)get_molecule(molecule_id)get_elements(symbol=None, name=None, limit=500, offset=0)get_element(element_id)get_regions(code=None, name=None, limit=500, offset=0)get_region(region_id)get_sources(name=None, limit=500, offset=0)get_source(source_id)get_sinks(name=None, limit=500, offset=0)get_sink(sink_id)get_transport_scenarios(name=None, limit=500, offset=0)get_transport_scenario(ts_id)get_utilities(name=None, limit=500, offset=0)get_utility(utility_id)get_references(name=None, doi=None, limit=500, offset=0)get_reference(ref_id)get_transports(name=None, limit=500, offset=0)get_transport(transport_id)get_subsystems(name=None, type=None, limit=500, offset=0)get_subsystem(subsystem_id)get_properties(name=None, domain=None, category=None, object_id=None, limit=500, offset=0)get_property(property_id)get_equipment(name=None, group=None, limit=500, offset=0)get_equipment_item(equipment_id)get_equipment_costs(equipment_id=None, limit=500, offset=0)get_equipment_cost(cost_id)get_equipment_designs(equipment_id=None, key=None, limit=500, offset=0)get_equipment_design(design_id)get_process_conditions(name=None, type=None, limit=500, offset=0)get_process_condition(condition_id)get_process_configurations(name=None, type=None, limit=500, offset=0)get_process_configuration(config_id)get_contactor_configurations(name=None, type=None, limit=500, offset=0)get_contactor_configuration(config_id)get_cost_indices(year=None, limit=500, offset=0)get_cost_index(index_id)get_constants(param=None, limit=500, offset=0)get_constant(constant_id)get_mea_baselines(name=None, limit=500, offset=0)get_mea_baseline(mea_id)get_mea_kpis(name=None, category=None, limit=500, offset=0)get_mea_kpi(kpi_id)
Science data
get_isotherm(mof=None, molecule=None, temperature_min=None, temperature_max=None, sim_or_exp=None, good_structure=None, limit=500, offset=0)get_water_kpis(mof=None, molecule=None, source=None, sim_or_exp=None, good_structure=None, limit=500, offset=0)get_carbon_zeopp(mof=None, good_structure=None, limit=500, offset=0)get_carbon_zeopp_item(item_id)get_carbon_zeopp_experimental(mof=None, limit=500, offset=0)get_carbon_zeopp_experimental_item(item_id)
TEA, LCA, cases, and scenarios
get_output_kpis(scenario_id=None, mof=None, good_structure=None, limit=500, offset=0)get_output_kpi(kpi_id)upsert_output_kpis(df)get_region_costs(region=None, name=None, year=None, limit=500, offset=0)get_region_cost(rc_id)upsert_region_costs(df)get_ambient_parameters(name=None, limit=500, offset=0)get_ambient_parameter(ap_id)upsert_ambient_parameters(df)get_cases(source=None, sink=None, region=None, study=None, limit=500, offset=0)get_case(case_id)get_scenarios(case_id=None, name=None, type=None, limit=500, offset=0)get_scenario(scenario_id)get_screening_summaries(scenario_id=None, limit=500, offset=0)get_screening_summary(summary_id)
Examples
Materials
import prisma_api
api = prisma_api.init()
materials = api.v2.list_materials(name="ABEX")
first = materials[0]
detail = api.v2.get_material(first["id"])
PSDI detail
psdi = api.v2.get_materials_psdi(name="Lewatit")
first_psdi = psdi[0]
record = api.v2.get_material_psdi(first_psdi["id"])
Flowsheet retrieval
flowsheet = api.v2.get_flowsheet(name="dac_min")
print(flowsheet["template_id"])
Advanced property-bundle query
get_material_property_bundle supports a generic query dictionary for more complex endpoint-specific filtering.
Supported keys are:
commonmaterialsisothermszeopp_simulatedzeopp_experimentalwater_kpis
Merge precedence is:
- defaults
common- endpoint-specific filters
bundle = api.v2.get_material_property_bundle(
"HKUST",
good_structure=True,
query={
"common": {"limit": 50},
"materials": {"limit": 20},
"isotherms": {
"molecule": "CO2",
"temperature_min": 273,
"temperature_max": 350,
},
"water_kpis": {"source": "DAC"},
},
)
print(bundle.keys())
Cases and scenarios
cases = api.v2.get_cases(region="GB", limit=10)
case_id = cases[0]["id"]
case_detail = api.v2.get_case(case_id)
scenario_list = api.v2.get_scenarios(case_id=case_id)
case_pack = api.v2.build_case_pack(case_id)
Testing
Run the test suite with:
pytest tests/ -v --cov=prisma_api --cov-report=term-missing
Additional documentation
Notes
- Production v2 base URL:
https://prisma-platform.org/api/v2 - Authentication header:
X-API-Key - Local development routing is controlled through config and
api.update_dev_mode(True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prisma_api-0.3.2.tar.gz.
File metadata
- Download URL: prisma_api-0.3.2.tar.gz
- Upload date:
- Size: 47.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e6126e77e5bd8ea25bf9f858761a7d2f9d8616424eb347758e148e7ab62ae62
|
|
| MD5 |
a0f071e181873eb0e1953629e6b81cca
|
|
| BLAKE2b-256 |
4bc98943084bd655bc916d92056db28b1e8283833de981d6dbb91d3cfdab8748
|
Provenance
The following attestation bundles were made for prisma_api-0.3.2.tar.gz:
Publisher:
publish.yml on RCCS-CaptureTeam/prisma_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prisma_api-0.3.2.tar.gz -
Subject digest:
7e6126e77e5bd8ea25bf9f858761a7d2f9d8616424eb347758e148e7ab62ae62 - Sigstore transparency entry: 1940390248
- Sigstore integration time:
-
Permalink:
RCCS-CaptureTeam/prisma_api@9b2767e0a557fd16fc14d03e44e335d13148bbf5 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/RCCS-CaptureTeam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9b2767e0a557fd16fc14d03e44e335d13148bbf5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file prisma_api-0.3.2-py3-none-any.whl.
File metadata
- Download URL: prisma_api-0.3.2-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
464cba0df4abd95293e9e113a4b7beccb2c6186ba7889c931967726bebb4ce5b
|
|
| MD5 |
218e298c0c5ac99e40a507ccdf44932b
|
|
| BLAKE2b-256 |
cad746ca36b0ec57e578d67fecbe08380e44e1e40a06338046d7962de89df28a
|
Provenance
The following attestation bundles were made for prisma_api-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on RCCS-CaptureTeam/prisma_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
prisma_api-0.3.2-py3-none-any.whl -
Subject digest:
464cba0df4abd95293e9e113a4b7beccb2c6186ba7889c931967726bebb4ce5b - Sigstore transparency entry: 1940390297
- Sigstore integration time:
-
Permalink:
RCCS-CaptureTeam/prisma_api@9b2767e0a557fd16fc14d03e44e335d13148bbf5 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/RCCS-CaptureTeam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9b2767e0a557fd16fc14d03e44e335d13148bbf5 -
Trigger Event:
release
-
Statement type: