|
1 | 1 | <div class="hero-section"> |
2 | | - <h1><i class="fas fa-hexagon" style="margin-right: 0.5rem;"></i>Using the OpenHEXA Toolbox</h1> |
| 2 | + <h1><i class="fas fa-hexagon" style="margin-right: 0.5rem;"></i>OpenHEXA Toolbox DHIS2</h1> |
3 | 3 | </div> |
4 | | -</div> |
5 | | - |
6 | | -# OpenHEXA Toolbox DHIS2 |
7 | 4 |
|
8 | 5 | An utility library to acquire and process data from a DHIS2 instance. |
9 | 6 |
|
@@ -444,100 +441,3 @@ True |
444 | 441 | >>> period_from_string("2022Q3") == q1 |
445 | 442 | True |
446 | 443 | ``` |
447 | | - |
448 | | - |
449 | | - |
450 | | -# OpenHEXA Toolbox IASO |
451 | | - |
452 | | -Module to fetch data from IASO. |
453 | | - |
454 | | -## Installation |
455 | | - |
456 | | -``` sh |
457 | | -pip install openhexa.toolbox |
458 | | -``` |
459 | | - |
460 | | -## Usage |
461 | | - |
462 | | -### Connect to an instance |
463 | | - |
464 | | -Credentials are required to initialize a connection to IASO instance. Credentials should contain the username and |
465 | | -password to connect to an instance of IASO. You have as well to provide the host name to for the api to connect to: |
466 | | -* Staging environment https://iaso-staging.bluesquare.org/api |
467 | | -* Production environment https://iaso.bluesquare.org/api |
468 | | - |
469 | | -Import IASO module as: |
470 | | -``` |
471 | | -from openhexa.toolbox.iaso import IASO |
472 | | - |
473 | | -iaso = IASO("https://iaso-staging.bluesquare.org","username", "password") |
474 | | -``` |
475 | | - |
476 | | -### Read data |
477 | | - |
478 | | -After importing IASO module, you can use provided method to fetch Projects, Organisation Units and Forms that you have |
479 | | -permissions for. |
480 | | -``` |
481 | | -# Fetch projects |
482 | | -iaso.get_projects() |
483 | | -# Fetch organisation units |
484 | | -iaso.get_org_units() |
485 | | -# Fetch submitted forms filtered by form_ids passed in url parameters and with choice to fetch them as dataframe |
486 | | -iaso.get_form_instances(page=1, limit=1, as_dataframe=True, |
487 | | - dataframe_columns=["Date de création","Date de modification","Org unit"], ids=276) |
488 | | -# Fetch forms filtered by organisaiton units and projects that you have permissions to |
489 | | -iaso.get_forms(org_units=[781], projects=[149]) |
490 | | -``` |
491 | | - |
492 | | -You can as well provide additional parameters to the method to filter on desired values as key value arguments. |
493 | | -You can have an overview on the arguments you can filter on API documentation of IASO. |
494 | | - |
495 | | -# OpenHEXA Toolbox - OpenHEXA Client (no longer maintained) |
496 | | - |
497 | | -_⚠️ We now recommend using the [SDK OpenHexa Client](sdk.md#using-the-openhexa-client) instead. It contains plenty of (typed) methods and can be semi-automatically extended by the OpenHexa team. The toolbox client will not be maintained/extended in the future_ |
498 | | - |
499 | | -The OpenHEXA class is part of the OpenHexa toolbox, designed for interacting with the OpenHexa platform's API. |
500 | | -The OpenHEXAClient module enables users to interact with the OpenHEXA backend using GraphQL syntax. |
501 | | - |
502 | | -## Installation |
503 | | - |
504 | | -``` sh |
505 | | -pip install openhexa.toolbox |
506 | | -``` |
507 | | - |
508 | | -## Usage |
509 | | - |
510 | | -### Connect to the API |
511 | | - |
512 | | -To initialize the OpenHEXA class, you need to provide the server_url of the OpenHexa instance and either a username/password combination or an API token for authentication. |
513 | | -Two-factor authentication should be disabled for this method. |
514 | | - |
515 | | -```python |
516 | | -from openhexa.toolbox.hexa import OpenHEXA |
517 | | -# We can authenticate using username / password |
518 | | -hexa = OpenHEXA("https://app.demo.openhexa.org", username="username", password="password") |
519 | | - |
520 | | -# You can also use the token provided by OpenHEXA on the pipelines page. |
521 | | -hexa = OpenHEXA("https://app.demo.openhexa.org", token="token") |
522 | | -``` |
523 | | - |
524 | | -### Play with the API |
525 | | - |
526 | | -After importing Hexa module, you can use provided method to fetch Projects, Organisation Units and Forms that you have |
527 | | -permissions for. |
528 | | - |
529 | | -```python |
530 | | -from openhexa.toolbox.hexa import OpenHEXA |
531 | | -# Get workspaces |
532 | | -workspaces = hexa.get_workspaces() |
533 | | - |
534 | | -# Get pipelines in a specific workspace |
535 | | -workspace_slug = workspaces['workspaces']['items'][0]['slug'] |
536 | | -pipelines = hexa.get_pipelines(workspace_slug) |
537 | | - |
538 | | -# Run a pipeline |
539 | | -pipeline_id = pipelines['pipelines']['items'][0]['id'] |
540 | | -run_response = hexa.run_pipeline(id=pipeline_id,config={}, send_notification=True) |
541 | | - |
542 | | -print(run_response) |
543 | | -``` |
0 commit comments