Skip to content

Commit c2be79b

Browse files
author
dcweber
committed
Initial upload of SDK
1 parent cd6ec7a commit c2be79b

File tree

162 files changed

+19825
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+19825
-3
lines changed

Authentication.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Authentication
2+
3+
The whcs-python-sdk project supports the following types of authentication:
4+
- Identity and Access Management (IAM)
5+
6+
The apikey for your service can be found by clicking the service instance of the resources list in the IBM Cloud dashboard.
7+
8+
## programming examples
9+
```python
10+
import watson_health_cognitive_services as whys
11+
12+
13+
Service = whcs.AnnotatorForClinicalDataV1('my_service_url', 'my_apikey', 'api_version')
14+
```
15+
16+
```python
17+
import watson_health_cognitive_services as whys
18+
19+
20+
Service = whcs.InsightsFOrMedicalLiteratureServiceV1('my_service_url', 'my_apikey', 'api_version')
21+
```

CONTRIBUTING.md

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Questions
2+
3+
If you are having difficulties using the APIs or have a question about the IBM Cloud and Services,
4+
please ask a question on [dW Answers][dw] or [Stack Overflow][stackoverflow].
5+
6+
# Issues
7+
8+
If you encounter an issue with the Python Core SDK, you are welcome to submit a [bug report](https://github.com/IBM/whcs-python-sdk/issues).
9+
Before that, please search for similar issues. It's possible somebody has encountered this issue already.
10+
11+
# Code
12+
## Commit Messages
13+
Commit messages should follow the [Angular Commit Message Guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines).
14+
This is because our release tool - [semantic-release](https://github.com/semantic-release/semantic-release) -
15+
uses this format for determining release versions and generating changelogs.
16+
Tools such as [commitizen](https://github.com/commitizen/cz-cli) or [commitlint](https://github.com/conventional-changelog/commitlint)
17+
can be used to help contributors and enforce commit messages.
18+
Here are some examples of acceptable commit messages, along with the release type that would be done based on the commit message:
19+
20+
| Commit message | Release type |
21+
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|
22+
| `fix(Returns Model) Passages serialization error.` | Patch Release |
23+
| `feat(Repository Messages): add support for returning repository responses.` | ~~Minor~~ Feature Release |
24+
25+
# Pull Requests
26+
27+
If you want to contribute to the repository, here's a quick guide:
28+
29+
1. Fork the repository
30+
1. Install `virtualenv` and `tox`
31+
1. Develop and test your code changes with [pytest].
32+
* Respect the original code [style guide][styleguide].
33+
* Only use spaces for indentation.
34+
* Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
35+
* Check for unnecessary whitespace with `git diff --check` before committing.
36+
* Make sure your code supports Python 3.5, 3.6, and 3.7. You can use `pyenv` and `tox` for this
37+
1. Make the test pass
38+
1. Check code coverage. Add tests for all new functionality and ensure overall coverage does not decrease.
39+
1. Commit your changes
40+
* Commits should follow the [Angular commit message guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). This is because our release tool uses this format for determining release versions and generating changelogs. To make this easier, we recommend using the [Commitizen CLI](https://github.com/commitizen/cz-cli) with the `cz-conventional-changelog` adapter.
41+
1. Push to your fork and submit a pull request to the `dev` branch
42+
43+
# Running the tests
44+
45+
You probably want to set up a [virtualenv].
46+
47+
1. Clone this repository:
48+
```sh
49+
git clone [email protected]/IBM/python-sdk-core.git
50+
```
51+
1. Install the SDK as an editable package using the current source:
52+
```sh
53+
pip3 install --editable .
54+
```
55+
1. Install the test dependencies with:
56+
```sh
57+
pip3 install -r requirements-dev.txt
58+
```
59+
1. Run the test cases with:
60+
The test cases make use of configuration files to provide API input.
61+
Each module in the SDK has a config.ini file in the test folder with
62+
default values for a provisioned Standard plan instance of the service.
63+
Populate the missing elements from the settings section so a connection
64+
to your service instance can be generated. From the module directory
65+
For your provisioned service run the following command:
66+
```sh
67+
Python -m pytest tests/functional
68+
```
69+
NOTE: If you have provisioned a Custom plan instance of Insights for Medical Literature
70+
The Tests will fail until enriched content has been added to the instance. All default
71+
Values may need to be updated to reflect your level of enrichment.
72+
73+
# Developer's Certificate of Origin 1.1
74+
By making a contribution to this project, I certify that:
75+
76+
(a) The contribution was created in whole or in part by me and I
77+
have the right to submit it under the open source license
78+
indicated in the file; or
79+
80+
(b) The contribution is based upon previous work that, to the best
81+
of my knowledge, is covered under an appropriate open source
82+
license and I have the right under that license to submit that
83+
work with modifications, whether created in whole or in part
84+
by me, under the same open source license (unless I am
85+
permitted to submit under a different license), as indicated
86+
in the file; or
87+
88+
(c) The contribution was provided directly to me by some other
89+
person who certified (a), (b) or (c) and I have not modified
90+
it.
91+
92+
(d) I understand and agree that this project and the contribution
93+
are public and that a record of the contribution (including all
94+
personal information I submit with it, including my sign-off) is
95+
maintained indefinitely and may be redistributed consistent with
96+
this project or the open source license(s) involved.
97+
98+
# Additional Resources
99+
100+
* [General GitHub documentation](https://help.github.com/)
101+
* [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
102+
103+
[IBM Watson Health Support](https://ibmwatsonhealth.force.com/mysupport/s/)
104+
[styleguide]: http://google.github.io/styleguide/pyguide.html
105+
[pytest]: http://pytest.org/latest/
106+
[virtualenv]: http://virtualenv.readthedocs.org/en/latest/index.html

LICENSE LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

README.md

+91-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,91 @@
1-
# whcs-python-sdk
2-
Watson Health Cognitive Services Python SDK
1+
[![Build Status](https://travis.ibm.com/ibmcloud/platform-services-java-sdk.svg?token=eW5FVD71iyte6tTby8gr&branch=master)](https://travis.ibm.com/ibmcloud/platform-services-java-sdk)
2+
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
3+
4+
# Watson Health Cognitive Services Python SDK Version 0.0.1
5+
6+
The IBM Watson Health Cognitive Services (WHCS) Python SDK allows developers to programmaticlly interact with the following WHCS services:
7+
8+
| Service Name | Artifact Id |
9+
|--------------|-------------|
10+
| [Annotator for Clinical data](https://cloud.ibm.com/apidocs/wh-acd) | annotator_for_clinical_data |
11+
| [Insights for Medical Literature](https://cloud.ibm.com/apidocs/wh-iml) | insights_for_medical_literature |
12+
13+
## Prerequisites
14+
15+
[ibm-cloud-onboarding]: https://cloud.ibm.com/registration?target=%2Fdeveloper%2Fwatson&
16+
17+
An [IBM CLoud](ibm-cloud-onboarding) account.
18+
An IAM API key to allow the SDK to access your provisioned service instance.
19+
Python 3.5 or above
20+
21+
## Installation
22+
23+
To install, use `pip`
24+
25+
```bash
26+
pip install --upgrade whys-python-sdk
27+
```
28+
29+
## Authentication
30+
The whcs-python-sdk project supports the following types of authentication:
31+
- Identity and Access Management (IAM)
32+
33+
For more information about how to use authentication with your services click [here](Authentication.md)
34+
35+
## Using the SDK
36+
For general SDK usage information, please see [this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md)
37+
38+
## Examples
39+
For SDK usage examples, please see the service API documentation. There are code examples and sample responses for each service API
40+
- [Annotator for Clinical data](https://cloud.ibm.com/apidocs/wh-acd)
41+
- [Insights for Medical Literature](https://cloud.ibm.com/apidocs/wh-iml)
42+
43+
## Questions
44+
45+
If you are having difficulties using this SDK or have a question about the IBM Cloud services,
46+
please ask a question at [IBM Watson Health Support](https://ibmwatsonhealth.force.com/mysupport/s/).
47+
48+
## Issues
49+
If you encounter an issue with the project, you are welcome to submit a
50+
[bug report](https://github.com/IBM/whcs-python-sdk>/issues).
51+
Before that, please search for similar issues. It's possible that someone has already reported the problem.
52+
53+
## Logging
54+
55+
### Enable logging
56+
57+
```python
58+
import logging
59+
logging.basicConfig(level=logging.DEBUG)
60+
```
61+
62+
This would show output of the form:
63+
```
64+
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): iam.cloud.ibm.com:443
65+
DEBUG:urllib3.connectionpool:https://iam.cloud.ibm.com:443 "POST /identity/token HTTP/1.1" 200 1809
66+
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): gateway.watsonplatform.net:443
67+
DEBUG:urllib3.connectionpool:https://gateway.watsonplatform.net:443 "POST /assistant/api/v1/workspaces?version=2018-07-10 HTTP/1.1" 201 None
68+
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): gateway.watsonplatform.net:443
69+
DEBUG:urllib3.connectionpool:https://gateway.watsonplatform.net:443 "GET /assistant/api/v1/workspaces/883a2a44-eb5f-4b1a-96b0-32a90b475ea8?version=2018-07-10&export=true HTTP/1.1" 200 None
70+
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): gateway.watsonplatform.net:443
71+
DEBUG:urllib3.connectionpool:https://gateway.watsonplatform.net:443 "DELETE /assistant/api/v1/workspaces/883a2a44-eb5f-4b1a-96b0-32a90b475ea8?version=2018-07-10 HTTP/1.1" 200 28
72+
```
73+
74+
### Low level request and response dump
75+
To get low level information of the requests/ responses:
76+
77+
```python
78+
from http.client import HTTPConnection
79+
HTTPConnection.debuglevel = 1
80+
```
81+
82+
## Open source @ IBM
83+
Find more open source projects on the [IBM Github Page](http://ibm.github.io/)
84+
85+
## Contributing
86+
See [CONTRIBUTING](CONTRIBUTING.md).
87+
88+
## License
89+
90+
The IBM Cloud MySDK Java SDK is released under the Apache 2.0 license.
91+
The license's full text can be found in [LICENSE](LICENSE).

__init__.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2018 IBM All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from .version import __version__
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright 2018 IBM All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from .annotator_for_clinical_data_v1 import AnnotatorForClinicalDataV1
16+
from .annotator_for_clinical_data_v1 import AcdFlow
17+
from .annotator_for_clinical_data_v1 import AcdProfile
18+
from .annotator_for_clinical_data_v1 import AllergyMedication
19+
from .annotator_for_clinical_data_v1 import Annotation
20+
from .annotator_for_clinical_data_v1 import Annotator
21+
from .annotator_for_clinical_data_v1 import AnnotatorFlow
22+
from .annotator_for_clinical_data_v1 import AssistanceAnnotation
23+
from .annotator_for_clinical_data_v1 import AttributeValueAnnotation
24+
from .annotator_for_clinical_data_v1 import AttributeValueEntry
25+
from .annotator_for_clinical_data_v1 import CancerDiagnosis
26+
from .annotator_for_clinical_data_v1 import Concept
27+
from .annotator_for_clinical_data_v1 import ConceptValue
28+
from .annotator_for_clinical_data_v1 import ConfigurationEntity
29+
from .annotator_for_clinical_data_v1 import ContainerAnnotation
30+
from .annotator_for_clinical_data_v1 import ContainerGroup
31+
from .annotator_for_clinical_data_v1 import Disambiguation
32+
from .annotator_for_clinical_data_v1 import EjectionFractionAnnotation
33+
from .annotator_for_clinical_data_v1 import Flow
34+
from .annotator_for_clinical_data_v1 import FlowEntry
35+
from .annotator_for_clinical_data_v1 import LabValueAnnotation
36+
from .annotator_for_clinical_data_v1 import ListStringWrapper
37+
from .annotator_for_clinical_data_v1 import MedicationAnnotation
38+
from .annotator_for_clinical_data_v1 import Name
39+
from .annotator_for_clinical_data_v1 import NegatedSpan
40+
from .annotator_for_clinical_data_v1 import NluEntities
41+
from .annotator_for_clinical_data_v1 import Node
42+
from .annotator_for_clinical_data_v1 import Procedure
43+
from .annotator_for_clinical_data_v1 import Relations
44+
from .annotator_for_clinical_data_v1 import RequestContainer
45+
from .annotator_for_clinical_data_v1 import Section
46+
from .annotator_for_clinical_data_v1 import SectionTrigger
47+
from .annotator_for_clinical_data_v1 import Smoking
48+
from .annotator_for_clinical_data_v1 import SpellCorrectedText
49+
from .annotator_for_clinical_data_v1 import SpellingCorrection
50+
from .annotator_for_clinical_data_v1 import Suggestion
51+
from .annotator_for_clinical_data_v1 import SymptomDisease
52+
from .annotator_for_clinical_data_v1 import UnstructuredContainer
53+
from .annotator_for_clinical_data_v1 import ACDException
54+
55+
#from .util import CustomDeserializer
56+
#from .util import CustomCollection

0 commit comments

Comments
 (0)