Skip to main content

xplordb

Mineral Exploration Database template/ system for Postgres/PostGIS and QGIS.

The project incorporates import scripts, data storage, validation, reporting, 3D drill trace generation and more. psql, pgAdmin and QGIS are the suggested database and GIS front-end programs.

The xplordb database template also comes with a python xplordb package.

Installation

xplordb package can be installed with pip :

pip install xplordb

Install xplordb schema

from xplordb.import_ddl import ImportDDL
import_ddl = ImportDDL(db='xplordb',
                       user='postgres',
                       password='postgres',
                       host='localhost',
                       port=5432)

import_ddl.import_xplordb_schema(import_data=False,
                                 full_db=False)

xplordb schema installation can only be done on existing database

Create xplordb database

from xplordb.create_db import CreateDatabase
create_db = CreateDatabase(connection_db='postgres',
                       user='postgres',
                       password='postgres',
                       host='localhost',
                       port=5432)

create_db.create_db(db='xplordb', import_data=False, full_db=False)

connection database is needed for new database creation

Available options are :

  • import_data : Import sample data
  • full_db : Import not mandatory tables

xplordb API

With xplordb package you can data to an xplordb database.

Here are some examples of API use.

Create mandatory Person and Dataset

from xplordb.sqlalchemy.base import create_session
from xplordb.datamodel.person import Person
from xplordb.datamodel.dataset import Dataset
from xplordb.import_data import ImportData

session = create_session(
        database='xplordb',
        host='localhost',
        port=5432,
        user='postgres',
        password='postgres')
import_data = ImportData(session)
import_data.import_persons_array([Person(trigram="xdb",full_name= "default")])
import_data.import_datasets_array([Dataset(name="default",loaded_by= "xdb")])
session.commit()

Create a collar

from xplordb.sqlalchemy.base import create_session
from xplordb.datamodel.collar import Collar
from xplordb.import_data import ImportData

session = create_session(
        database='xplordb',
        host='localhost',
        port=5432,
        user='postgres',
        password='postgres')
import_data = ImportData(session)
import_data.import_collars_array([Collar(hole_id="collar",
                                         data_set='default',  
                                         loaded_by='xdb',
                                         x=100.0,y= 100.0,z= 0.0,srid= 3857)])
session.commit()

We assume that person and dataset are already available in xplordb database

Add survey to collar

from xplordb.sqlalchemy.base import create_session
from xplordb.datamodel.survey import Survey
from xplordb.import_data import ImportData

session = create_session(
        database='xplordb',
        host='localhost',
        port=5432,
        user='postgres',
        password='postgres')
import_data = ImportData(session)
import_data.import_surveys_array([Survey('collar', 'default', 'xdb', dip=0.0,azimuth= 45.0,depth= 0.0),
                                  Survey('collar', 'default', 'xdb', dip=0.1,azimuth= 44.5,depth= 100.0),
                                  Survey('collar', 'default', 'xdb', dip=0.0,azimuth= 45.0,depth= 200.0)])
session.commit()

We assume that person dataset and collar are already available in xplordb database

Use sqlalchemy session for new query

xplordb module provides sqlalchemy table description that can be used to interact with xplordb database without using ImportData class :

  • ref.person : xplordb.sqlalchemy.ref.person.XplordbPersonTable
  • ref.dataset : xplordb.sqlalchemy.ref.dataset.XplordbDatasetTable
  • dh.collar : xplordb.sqlalchemy.dh.collar.XplordbCollarTable
  • dh.survey : xplordb.sqlalchemy.dh.survey.XplordbSurveyTable
  • ref.lithology : xplordb.sqlalchemy.ref.lithcode.XplordbLithCodeTable
  • df.lith : xplordb.sqlalchemy.df.lith.XplordbLithTable

Example to get all survey for a collar list:

from xplordb.sqlalchemy.base import create_session
from xplordb.sqlalchemy.dh.survey import XplordbSurveyTable

session = create_session(
        database='xplordb',
        host='localhost',
        port=5432,
        user='postgres',
        password='postgres')
collars_id = ['HOLE_1', 'HOLE_2']
surveys = session.query(XplordbSurveyTable).filter(XplordbSurveyTable.hole_id.in_(collars_id)).all()

Metadata

Release files for xplordb 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xplordb 1.2.0
File Size Uploaded Provenance
xplordb-1.2.0.tar.gz 64.6 kB Without provenance Details

Release files / xplordb-1.2.0.tar.gz

Download URL xplordb-1.2.0.tar.gz
Size 64.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d7647ac25d8508ae452c46ff25cb6bec0ec3f72c979fa07e7fb01348912eb143
BLAKE2b-256 checksum
How to use checksums
2170ed1d8c548c41d4aeeb0bd84e24174cbfa5b12f1110f42f50e6478d657d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for xplordb 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page