README.md 2.55 KB
Newer Older
Chad Leong's avatar
Chad Leong committed
1
2
# LAS Loader utility for Wellbore DDMS

3
## :exclamation: This is currently in development
Chad Leong's avatar
Chad Leong committed
4

Chad Leong's avatar
Chad Leong committed
5
6
7
8
9
## Description

1. This will be the OSDU LAS loader utility to support Wellbore DDMS.

2. This is a wrapper behind the Wellbore DDMS [API](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/wellbore/wellbore-domain-services/-/blob/master/spec/generated/openapi.json)
10
11
12

## Development

13
The application uses a virtual environment managed by pipenv. To execute the application and run the tests you will need to install Python 3.9 and pipenv.
14
15
16
The source code and unit test are stored in the `src` folder.

To download the package dependencies for the virtual environment change to the src folder and run:
17

18
19
20
21
22
```
pipenv install --dev
```

To run the tests and flake8 linting:
23

24
25
```
pipenv run flake8
Gregory Harris's avatar
Gregory Harris committed
26
pipenv run pytest
27
28
```

Greg Harris's avatar
Greg Harris committed
29
Alternatively, an interactive shell in the virtual environment can be created by running:
30

31
32
33
34
35
36
37
```
pipenv shell
```

### Adding package dependencies

Package dependencies are added using the pipenv command. Dependencies required for only the unit tests should be added to the `[dev-packages]` of the `Pipfile` by using:
38

39
40
41
```
pipenv install --dev package_name
```
42

43
Production packages should be installed using:
44

45
46
```
pipenv install package_name
47
```
Gregory Harris's avatar
Gregory Harris committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61

### Usage via the command line interface

To invoke the CLI using the virtual environment and from within the `src` folder:
```
pipenv run python -m lascli <group> <command> <options>
```
Available groups are `fileload` and `list`. Help can be obtained with the `-h` option.
```
pipenv run python -m lascli -h
pipenv run python -m lascli fileload -h
pipenv run python -m lascli fileload ingest -h
```

Greg Harris's avatar
Greg Harris committed
62
63
64
65
66
67
A token is required to access an OSDU instance. The `-t/--token` option is used to specify the token, this is a string. As tokens are long strings we recommend that the token is stored in an environment variable. For example, on a Windows command prompt:
```
set OSDUTOKEN <token>
pipenv run python -m lascli fileload ingest -t $OSDUTOKEN
```
This keeps the command line short.
Gregory Harris's avatar
Gregory Harris committed
68

Greg Harris's avatar
Greg Harris committed
69
### Config file
Gregory Harris's avatar
Gregory Harris committed
70

Greg Harris's avatar
Greg Harris committed
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
The LASCLI requires a configuration file that has the following JSON structure:
```
{
    "data_partition_id": "opendes",
    "acl_domain": "contoso.com",
    "ref_curve_id": "DEPT",
    "legal":
    {
        "legaltags": ["opendes-public-usa-dataset-7643990"],
        "otherRelevantDataCountries": ["US"],
        "status": "compliant"    
    },
    "data": {
        "default": {
            "viewers": [ "data.default.viewers@opendes.contoso.com" ],
            "owners": [ "data.default.owners@opendes.contoso.com" ]
        }
    }
}
```