Skip to content

Commit eb8de14

Browse files
authored
Merge pull request #11 from TaskarCenterAtUW/dev
Dev to stage sync
2 parents 0a11ca5 + b624d8a commit eb8de14

File tree

13 files changed

+119
-575
lines changed

13 files changed

+119
-575
lines changed

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@ The project is built on Python with FastAPI framework. All the regular nuances f
2323
- Connecting this to cloud will need the following in the `.env` file
2424

2525
```bash
26-
UPLOAD_TOPIC=xxxx
27-
UPLOAD_SUBSCRIPTION=xxxx
28-
VALIDATION_TOPIC=xxxx
2926
QUEUECONNECTION=xxxx
3027
STORAGECONNECTION=xxxx
28+
VALIDATION_REQ_TOPIC=xxxx
29+
VALIDATION_REQ_SUB=xxxx
30+
VALIDATION_RES_TOPIC=xxxx
31+
CONTAINER_NAME=xxxx
32+
AUTH_PERMISSION_URL=xxx
33+
3134
```
3235

3336
The application connect with the `STORAGECONNECTION` string provided in `.env` file and validates downloaded zipfile using `python-osw-validation` package.
3437
`QUEUECONNECTION` is used to send out the messages and listen to messages.
3538

36-
### How to Setup and Build
39+
40+
### How to Set up and Build
3741
Follow the steps to install the python packages required for both building and running the application
3842

3943
1. Setup virtual environment
@@ -56,9 +60,42 @@ Follow the steps to install the python packages required for both building and r
5660
```
5761
3. By default `get` call on `localhost:8000/health` gives a sample response
5862
4. Other routes include a `ping` with get and post. Make `get` or `post` request to `http://localhost:8000/health/ping`
59-
5. Once the server starts, it will start to listening the subscriber(`UPLOAD_SUBSCRIPTION` should be in env file)
63+
5. Once the server starts, it will start to listening the subscriber(`VALIDATION_REQ_SUB` should be in env file)
64+
65+
66+
#### Request Format
67+
68+
```json
69+
{
70+
"messageId": "tdei_record_id",
71+
"messageType": "workflow_identifier",
72+
"data": {
73+
"file_upload_path": "file_upload_path",
74+
"user_id": "user_id",
75+
"tdei_project_group_id": "tdei_project_group_id"
76+
}
77+
}
78+
```
79+
80+
#### Response Format
81+
82+
```json
83+
{
84+
"messageId": "tdei_record_id",
85+
"messageType": "workflow_identifier",
86+
"data": {
87+
"file_upload_path": "file_upload_path",
88+
"user_id": "user_id",
89+
"tdei_project_group_id": "tdei_project_group_id",
90+
"success": true/false,
91+
"message": "message" // if false the error string else empty string
92+
},
93+
"publishedDate": "published date"
94+
}
95+
```
96+
6097

61-
### How to Setup and run the Tests
98+
### How to Set up and run the Tests
6299

63100
Make sure you have set up the project properly before running the tests, see above for `How to Setup and Build`.
64101

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ uvicorn==0.20.0
77
coverage==7.2.7
88
html_testRunner==1.2.1
99
httpx==0.24.1
10-
python-osw-validation==0.0.3
10+
python-osw-validation==0.0.5

src/assets/osw-upload.json

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,9 @@
11
{
2-
"messageType": "osw-upload",
3-
"publishedDate": "2023-02-08T08:33:36.267213Z",
2+
"messageId": "c8c76e89f30944d2b2abd2491bd95337",
3+
"messageType": "workflow_identifier",
44
"data": {
5-
"stage": "OSW-Upload",
6-
"request": {
7-
"tdei_project_group_id": "0b41ebc5-350c-42d3-90af-3af4ad3628fb",
8-
"collected_by": "6D3E5B8C-FB16-4B6A-9436-72FD24756CC9",
9-
"collection_date": "2022-11-22T09:43:07.978Z",
10-
"collection_method": "manual",
11-
"publication_date": "2022-11-22T09:43:07.978Z",
12-
"data_source": "local",
13-
"polygon": {
14-
"coordinates": [
15-
[
16-
[
17-
77.5873101438346,
18-
12.975857172137523
19-
],
20-
[
21-
77.58650666918095,
22-
12.97272532145334
23-
],
24-
[
25-
77.5869485802404,
26-
12.970219812510848
27-
],
28-
[
29-
77.58739049129997,
30-
12.967792576658127
31-
],
32-
[
33-
77.5886760507459,
34-
12.967753427498707
35-
],
36-
[
37-
77.58911796180547,
38-
12.969123644412946
39-
],
40-
[
41-
77.59016247885529,
42-
12.972921063276544
43-
],
44-
[
45-
77.58984108899386,
46-
12.973429991296015
47-
],
48-
[
49-
77.5904035212514,
50-
12.974995917131267
51-
],
52-
[
53-
77.58863587701325,
54-
12.975074213164191
55-
],
56-
[
57-
77.5873101438346,
58-
12.975857172137523
59-
]
60-
]
61-
]
62-
},
63-
"osw_schema_version": "1.0.0"
64-
},
65-
"meta": {
66-
"file_upload_path": "https://tdeisamplestorage.blob.core.windows.net/osw/test_upload/valid.zip"
67-
},
68-
"response": {
69-
"success": true,
70-
"message": "File uploaded for the Project Group : 0b41ebc5-350c-42d3-90af-3af4ad3628fb with tdei record id : c8c76e89f30944d2b2abd2491bd95337"
71-
},
72-
"tdei_record_id": "c8c76e89f30944d2b2abd2491bd95337",
73-
"tdei_project_group_id": "0b41ebc5-350c-42d3-90af-3af4ad3628fb",
74-
"user_id": "c59d29b6-a063-4249-943f-d320d15ac9ab"
5+
"file_upload_path": "https://tdeisamplestorage.blob.core.windows.net/osw/test_upload/valid.zip",
6+
"user_id": "c59d29b6-a063-4249-943f-d320d15ac9ab",
7+
"tdei_project_group_id": "0b41ebc5-350c-42d3-90af-3af4ad3628fb"
758
}
769
}

src/assets/osw-validation.json

Lines changed: 9 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,11 @@
11
{
2-
"messageType": "osw-validation",
3-
"publishedDate": "2023-02-08T08:33:36.267213Z",
4-
"data": {
5-
"stage": "OSW-Validation",
6-
"request": {
7-
"tdei_project_group_id": "0b41ebc5-350c-42d3-90af-3af4ad3628fb",
8-
"collected_by": "6D3E5B8C-FB16-4B6A-9436-72FD24756CC9",
9-
"collection_date": "2022-11-22T09:43:07.978Z",
10-
"collection_method": "manual",
11-
"valid_from": "2022-11-22T09:43:07.978Z",
12-
"valid_to": "2022-11-22T09:43:07.978Z",
13-
"data_source": "local",
14-
"polygon": {
15-
"coordinates": [
16-
[
17-
[
18-
77.5873101438346,
19-
12.975857172137523
20-
],
21-
[
22-
77.58650666918095,
23-
12.97272532145334
24-
],
25-
[
26-
77.5869485802404,
27-
12.970219812510848
28-
],
29-
[
30-
77.58739049129997,
31-
12.967792576658127
32-
],
33-
[
34-
77.5886760507459,
35-
12.967753427498707
36-
],
37-
[
38-
77.58911796180547,
39-
12.969123644412946
40-
],
41-
[
42-
77.59016247885529,
43-
12.972921063276544
44-
],
45-
[
46-
77.58984108899386,
47-
12.973429991296015
48-
],
49-
[
50-
77.5904035212514,
51-
12.974995917131267
52-
],
53-
[
54-
77.58863587701325,
55-
12.975074213164191
56-
],
57-
[
58-
77.5873101438346,
59-
12.975857172137523
60-
]
61-
]
62-
]
63-
},
64-
"osw_schema_version": "1.0.0"
65-
},
66-
"meta": {
67-
"file_upload_path": "https://tdeisamplestorage.blob.core.windows.net/osw/2023%2FFEBRUARY%2F0b41ebc5-350c-42d3-90af-3af4ad3628fb%2Fvalid_c8c76e89f30944d2b2abd2491bd95337.zip",
68-
"isValid": true
69-
},
70-
"response": {
71-
"success": true,
72-
"message": "Validation successful"
73-
},
74-
"tdei_record_id": "c8c76e89f30944d2b2abd2491bd95337",
75-
"tdei_project_group_id": "0b41ebc5-350c-42d3-90af-3af4ad3628fb",
76-
"user_id": "c59d29b6-a063-4249-943f-d320d15ac9ab"
77-
}
2+
"messageId": "c8c76e89f30944d2b2abd2491bd95337",
3+
"messageType": "workflow_identifier",
4+
"data": {
5+
"file_upload_path": "https://tdeisamplestorage.blob.core.windows.net/osw/test_upload/valid.zip",
6+
"user_id": "c59d29b6-a063-4249-943f-d320d15ac9ab",
7+
"tdei_project_group_id": "0b41ebc5-350c-42d3-90af-3af4ad3628fb",
8+
"success": true,
9+
"message": ""
10+
}
7811
}

src/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
class EventBusSettings:
99
connection_string: str = os.environ.get('QUEUECONNECTION', None)
10-
upload_topic: str = os.environ.get('UPLOAD_TOPIC', None)
11-
upload_subscription: str = os.environ.get('UPLOAD_SUBSCRIPTION', None)
12-
validation_topic: str = os.environ.get('VALIDATION_TOPIC', None)
10+
upload_topic: str = os.environ.get('VALIDATION_REQ_TOPIC', None)
11+
upload_subscription: str = os.environ.get('VALIDATION_REQ_SUB', None)
12+
validation_topic: str = os.environ.get('VALIDATION_RES_TOPIC', None)
1313
container_name: str = os.environ.get('CONTAINER_NAME', 'osw')
1414

1515

0 commit comments

Comments
 (0)