# Python library for WQX (wqxlib)
This is a Python library for creating XML documents for direct submission to WQX Web without using an import configuration file. If your use-case is complex, this feature may save you the hassle of uploading incremental changes to an import configuration file as you detect more edge cases or struggle to make an import configuration file which is flexible enough for your purposes. Just modify your code to produce the proper XML file and use the `WQXWeb` class from the sister project [`wqxweblib`](https://github.com/FlippingBinary/wqxweblib-python) to upload it. It's also useful for submitting new monitoring locations or other types of data which are one-off situations. Sometimes it's easier to just build the XML file directly than it is to first create an import configuration file (or copy one) and specify the parameters in a CSV or XSL file. If you find a bug, please submit a pull request on [Github](https://github.com/FlippingBinary/wqxlib-python) or open an issue there. I'm also open to suggestions for how to improve the creation of XML files. Currently, it's quite complex due to its flexibility.
This code is supported by the National Science Foundation under Award No. OIA-1458952. Any opinions, findings and conclusions, or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
## Contents
- [Python library for WQX (wqxlib)](#python-library-for-wqx-wqxlib)
- [Contents](#contents)
- [Getting Started](#getting-started)
- [Package Versioning](#package-versioning)
- [Import WQX Module](#import-wqx-module)
- [WQXLib XML API Reference](#wqxlib-xml-api-reference)
- [Document](#document)
- [Header](#header)
- [Payload](#payload)
- [Submission](#submission)
- [WQXLib's WQX v3.0 XML API Reference](#wqxlibs-wqx-v30-xml-api-reference)
- [Activity](#activity)
- [ActivityDescription](#activitydescription)
- [ActivityGroup](#activitygroup)
- [ActivityLocation](#activitylocation)
- [ActivityMetric](#activitymetric)
- [ActivityMetricType](#activitymetrictype)
- [AlternateMonitoringLocationIdentity](#alternatemonitoringlocationidentity)
- [AquiferInformation](#aquiferinformation)
- [AttachedBinaryObject](#attachedbinaryobject)
- [BibliographicReference](#bibliographicreference)
- [BiologicalActivityDescription](#biologicalactivitydescription)
- [BiologicalHabitatCollectionInformation](#biologicalhabitatcollectioninformation)
- [BiologicalHabitatIndex](#biologicalhabitatindex)
- [BiologicalResultDescription](#biologicalresultdescription)
- [CollectionEffort](#collectioneffort)
- [ComparableAnalyticalMethod](#comparableanalyticalmethod)
- [DataQualityIndicator](#dataqualityindicator)
- [DetectionQuantitationLimit](#detectionquantitationlimit)
- [ElectronicAddress](#electronicaddress)
- [Entity_Update_Identifiers](#entity_update_identifiers)
- [FrequencyClassInformation](#frequencyclassinformation)
- [HorizontalAccuracyMeasure](#horizontalaccuracymeasure)
- [IndexType](#indextype)
- [LabSamplePreparation](#labsamplepreparation)
- [Measure](#measure)
- [MeasureCompact](#measurecompact)
- [MonitoringLocation](#monitoringlocation)
- [MonitoringLocationGeospatial](#monitoringlocationgeospatial)
- [MonitoringLocationIdentity](#monitoringlocationidentity)
- [NetInformation](#netinformation)
- [Organization](#organization)
- [OrganizationAddress](#organizationaddress)
- [OrganizationDescription](#organizationdescription)
- [Organization_Delete](#organization_delete)
- [Project](#project)
- [ProjectMonitoringLocationWeighting](#projectmonitoringlocationweighting)
- [ReferenceMethod](#referencemethod)
- [Result](#result)
- [ResultAnalyticalMethod](#resultanalyticalmethod)
- [ResultDescription](#resultdescription)
- [ResultLabInformation](#resultlabinformation)
- [SampleDescription](#sampledescription)
- [SamplePreparation](#samplepreparation)
- [SimpleContent](#simplecontent)
- [TaxonomicDetails](#taxonomicdetails)
- [Telephonic](#telephonic)
- [WellInformation](#wellinformation)
- [WQX](#wqx)
- [WQXTime](#wqxtime)
- [WQXDelete](#wqxdelete)
- [WQXUpdateIdentifiers](#wqxupdateidentifiers)
## Getting Started
Look in the `examples` directory for a more complete example with sample data.
1. Install this package using `pip`
pip install wqxlib
2. Import the `WQXSubmission` class
from wqxlib import WQXSubmission
3. Use the `with ... as` syntax to create the submission
with WQXSubmission(filename='example.xml') as submission:
# Manipulate submission object properties
4. After creating the submission, submit it using the `wqxweblib` package or manually in WQX Web.
## Package Versioning
This package uses a five-segment version number. The first two segments of the version number indicate the version of WQX it supports. The last three segments follow the [Semantic Versioning](https://semver.org/) standard and are specific to only this package, not any WQX release. They are in the format `x.y.z` where `x` is the major version number, `y` is the minor version number, and `z` is the patch version number.
The major version number increments when incompatible API changes are made. The minor version number increments when functionality is added in a backward compatible manner. The patch version number increments when there are backward compatible bug fixes.
It is a good practice to lock the first three digits of the version in your `requirements.txt` file, if you are using one. That allow you to safely rebuild your environment without accidentally introducing breaking changes. For the current version, that would mean adding a line to your `requirements.txt` file like this:
wqxlib<3.0.1
# WQXLib XML API Reference
The following low-level classes describe the larger structure of a valid XML document for WQXWeb submission. These classes contain the building blocks provided by WQX v3.0. You are not required to interact with these directly. Use of the `with ... as` syntax is highly recommended.
## Document
The base document type used for submission to WQXWeb.
**Parameters:**
- `id` (ID)
- `header` (Header)
- `payload` (List[Payload])
## Header
**Parameters:**
- `author` (str)
- `organization` (str)
- `title` (str)
- `creationTime` (datetime)
- `comment` (str)
- `dataService` (str)
- `contactInfo` (str)
- `notification` (List[str])
- `sensitivity` (str)
- `property` (dict)
## Payload
The Payload section of the document contains the WQX data.
- `operation` (OperationType) - either "UPDATE_INSERT" or "DELETE".
- `wqx` (WQX) - this must be a v3.0 `WQX` object as described in the next section, if provided.
- `wqxUpdateIdentifiers` (WQXUpdateIdentifiers) - this must be a v3.0 `WQXUpdateIdentifiers` object as described in the next section, if provided.
- `wqxDelete` (WQXDelete) - this must be a v3.0 `WQXDelete` object as described in the next section, if provided.
## Submission
This is the container of the entire submission.
**Parameters:**
- `document` (Document)
# WQXLib's WQX v3.0 XML API Reference
The following classes describe the building blocks of a v3.0 XML document for WQXWeb submission. This is the current version of the standard and there are no plans to create an API for the older versions. If you want to, please use the pattern of the v3.0 code and submit a pull request so others can benefit from your code too.
All of the described classes come directly from the XSD files which are used by WQX to validate input.
To import any of the following types, pull them from `wqxlib` like this:
from wqxlib import (
MonitoringLocation,
MonitoringLocationGeospatial,
MonitoringLocationIdentity,
Organization
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
wqxlib-3.0.0.6.0.tar.gz (83个子文件)
wqxlib-3.0.0.6.0
PKG-INFO 30KB
wqxlib
WQXActivity.py 2KB
ImportConfiguration.py 3KB
WQXResult.py 5KB
Header.py 9KB
Document.py 119KB
WQXElectronicAddress.py 330B
WQXTelephonic.py 275B
WQXSubmission.py 7KB
__main__.py 340B
__init__.py 674B
WQXAttachedBinaryObject.py 342B
WQXSample.py 392B
Submission.py 3KB
Payload.py 6KB
wqx_v3_0
BiologicalHabitatCollectionInformation.py 8KB
WQX_Delete.py 2KB
ActivityGroup.py 5KB
BibliographicReference.py 5KB
Organization_Delete.py 7KB
Measure.py 4KB
IndexType.py 5KB
MonitoringLocationIdentity.py 12KB
ActivityMetric.py 6KB
Entity_Update_Identifiers.py 10KB
ActivityMetricType.py 6KB
AttachedBinaryObject.py 3KB
NetInformation.py 5KB
SampleDescription.py 7KB
WQX_Update_Identifiers.py 2KB
DataQualityIndicator.py 5KB
SamplePreparation.py 8KB
ActivityLocation.py 8KB
BiologicalResultDescription.py 12KB
Result.py 8KB
WellInformation.py 7KB
TaxonomicDetails.py 9KB
ResultLabInformation.py 13KB
HorizontalAccuracyMeasure.py 175B
MeasureCompact.py 2KB
BiologicalActivityDescription.py 5KB
FrequencyClassInformation.py 5KB
__init__.py 3KB
WQX.py 2KB
Project.py 8KB
OrganizationDescription.py 4KB
BiologicalHabitatIndex.py 6KB
ReferenceMethod.py 5KB
ElectronicAddress.py 2KB
DetectionQuantitationLimit.py 5KB
MonitoringLocation.py 5KB
ProjectMonitoringLocationWeighting.py 10KB
Telephonic.py 3KB
ResultAnalyticalMethod.py 5KB
Organization.py 10KB
OrganizationAddress.py 6KB
WQXTime.py 2KB
CollectionEffort.py 2KB
LabSamplePreparation.py 6KB
AlternateMonitoringLocationIdentity.py 3KB
MonitoringLocationGeospatial.py 13KB
Activity.py 7KB
AquiferInformation.py 4KB
SimpleContent.py 58KB
ResultDescription.py 24KB
ComparableAnalyticalMethod.py 3KB
ActivityDescription.py 20KB
WQXOrganizationAddress.py 338B
WQXMonitoringLocation.py 1KB
exceptions.py 185B
WQXOrganizationDescription.py 354B
pyproject.toml 548B
tests
test_create_wqx_document.py 4KB
__init__.py 0B
LICENSE 1KB
setup.cfg 38B
setup.py 2KB
wqxlib.egg-info
PKG-INFO 30KB
requires.txt 61B
SOURCES.txt 3KB
top_level.txt 13B
dependency_links.txt 1B
README.md 30KB
共 83 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功