Skip to content

Commit b318e37

Browse files
authored
Merge pull request #12 from movestore/feature/ordered-json
ordered json
2 parents 5ef2693 + 8c642af commit b318e37

16 files changed

Lines changed: 236 additions & 126 deletions

File tree

.idea/cargo-agent-python.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 150 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -38,87 +38,154 @@ Implement code by extending the base class `src/analyzer/base_analyzer.py` to ex
3838
<details>
3939
<summary>An example output of a (serialized json) list</summary>
4040

41-
```
41+
```
42+
[
4243
{
43-
"sensor_types":[
44+
"positions_total_number": 3243
45+
},
46+
{
47+
"timestamps_range": [
48+
"2021-07-01 06:40:00",
49+
"2022-03-15 14:13:00"
50+
]
51+
},
52+
{
53+
"animals_total_number": 1
54+
},
55+
{
56+
"animal_names": [
57+
"Goat-8810"
58+
]
59+
},
60+
{
61+
"taxa": [
62+
"Capra hircus"
63+
]
64+
},
65+
{
66+
"sensor_types": [
4467
"GPS"
45-
],
46-
"taxa":[
47-
"Anser albifrons"
48-
],
49-
"animals_total_number": 2,
50-
"animal_attributes":[
51-
"individual.local.identifier",
68+
]
69+
},
70+
{
71+
"positions_bounding_box": {
72+
"x_min": 14.9216333333333,
73+
"y_min": 37.8303666666667,
74+
"x_max": 14.9606333333333,
75+
"y_max": 37.8717833333333
76+
}
77+
},
78+
{
79+
"projection": "EPSG:4326"
80+
},
81+
{
82+
"tracks_total_number": 1
83+
},
84+
{
85+
"track_names": [
86+
"Goat.8810..deploy_id.1600804509."
87+
]
88+
},
89+
{
90+
"number_positions_by_track": {
91+
"Goat.8810..deploy_id.1600804509.": 3243
92+
}
93+
},
94+
{
95+
"data_attributes": [
96+
"sensor_type_id",
97+
"comments",
98+
"data_decoding_software",
99+
"gps_horizontal_accuracy_estimate",
100+
"gps_speed_accuracy_estimate",
101+
"gps_time_to_fix",
102+
"ground_speed",
103+
"heading",
104+
"height_above_ellipsoid",
105+
"icarus_ecef_vx",
106+
"icarus_ecef_vy",
107+
"icarus_ecef_vz",
108+
"icarus_ecef_x",
109+
"icarus_ecef_y",
110+
"icarus_ecef_z",
111+
"icarus_reset_counter",
112+
"icarus_timestamp_accuracy",
113+
"icarus_timestamp_source",
114+
"icarus_uplink_counter",
115+
"import_marked_outlier",
116+
"location_error_text",
117+
"manually_marked_outlier",
118+
"mortality_status",
119+
"sequence_number",
120+
"sigfox_rssi",
121+
"tag_voltage",
122+
"timestamp",
123+
"transmission_protocol",
124+
"transmission_timestamp",
125+
"event_id",
52126
"visible",
53-
"individual.id",
54-
"deployment.id",
55-
"tag.id",
56-
"study.id",
57-
"sensor.type.id",
58-
"tag.local.identifier",
59-
"individual.taxon.canonical.name",
60-
"study.name",
61-
"sensor.type",
127+
"individual_name_deployment_id",
128+
"deployment_id",
129+
"tag_id",
130+
"individual_id",
131+
"animal_life_stage",
132+
"animal_reproductive_condition",
133+
"attachment_type",
134+
"deploy_off_timestamp",
135+
"deploy_on_person",
136+
"deploy_on_timestamp",
137+
"sensor_type_ids",
138+
"capture_location",
139+
"deploy_on_location",
140+
"deploy_off_location",
141+
"nick_name",
142+
"ring_id",
62143
"sex",
63-
"taxon.canonical.name",
64-
"timestamp.start",
65-
"timestamp.end",
66-
"number.of.events",
67-
"number.of.deployments",
68-
"sensor.type.ids",
69-
"animalName"
70-
],
71-
"positions_total_number":4653,
72-
"track_attributes":[
73-
"event.id",
74-
"timestamp",
75-
"location.long",
76-
"location.lat",
77-
"heading",
78-
"height.above.ellipsoid",
79-
"migration.stage",
80-
"migration.stage.standard"
81-
],
82-
"timestamps_range":[
83-
"2013-09-30 08:30:48",
84-
"2014-10-25 08:30:44"
85-
],
86-
"animal_names":[
87-
"2704",
88-
"2731"
89-
],
90-
"positions_bounding_box":[
91-
{
92-
"min":6.2172,
93-
"max":39.4644,
94-
"_row":"coords.x1"
95-
},
96-
{
97-
"min":51.4005,
98-
"max":63.9659,
99-
"_row":"coords.x2"
100-
}
101-
],
102-
"tracks_total_number":2,
103-
"projection":[
104-
"+proj=longlat +datum=WGS84 +no_defs"
105-
],
106-
"track_names":[
107-
"X2704",
108-
"X2731"
109-
],
110-
"number_positions_by_track":[
111-
{
112-
"positions_number":706,
113-
"animal":"X2704"
114-
},
115-
{
116-
"positions_number":3947,
117-
"animal":"X2731"
118-
}
144+
"taxon_canonical_name",
145+
"individual_number_of_deployments",
146+
"mortality_location",
147+
"tag_local_identifier",
148+
"tag_number_of_deployments",
149+
"study_id",
150+
"acknowledgements",
151+
"citation",
152+
"grants_used",
153+
"has_quota",
154+
"i_am_owner",
155+
"is_test",
156+
"license_terms",
157+
"license_type",
158+
"name",
159+
"study_number_of_deployments",
160+
"number_of_individuals",
161+
"number_of_tags",
162+
"principal_investigator_name",
163+
"study_objective",
164+
"study_type",
165+
"suspend_license_terms",
166+
"i_can_see_data",
167+
"there_are_data_which_i_cannot_see",
168+
"i_have_download_access",
169+
"i_am_collaborator",
170+
"study_permission",
171+
"timestamp_first_deployed_location",
172+
"timestamp_last_deployed_location",
173+
"number_of_deployed_locations",
174+
"taxon_ids",
175+
"contact_person_name",
176+
"main_location",
177+
"individual_local_identifier",
178+
"timestamp_tz",
179+
"geometry"
180+
]
181+
},
182+
{
183+
"n": [
184+
"non-empty-result"
119185
]
120186
}
121-
```
187+
]
188+
```
122189
</details>
123190

124191
### 4. Add documentation about the requested IO type
@@ -146,3 +213,11 @@ After you have created a pull request to our GitHub repository, our administrato
146213
### 8. Request the new IO type on MoveApps
147214

148215
With the pull request link from above, you are able to request the IO type on MoveApps. This can be done during _initialization_ of a new App at MoveApps and following the link for _requesting a new IO type_. You need the information from the _first step of this document (Preparation)_ and the link to your _Pull Request_.
216+
217+
## How to run the complete cargo-agent locally (e2e)
218+
219+
1. Open `main.py` and adjust `dev_analyze_file`. This file will be analyzed.
220+
2. Run `main.py`
221+
3. The cargo-agent listens now to an added or modified file named by 1.: `INFO: init for /opt/couchbits/projects/max-planck-gesellschaft/moveapps/apps/cargo-agent-python/resources/raw/input2_LatLon.pickle`
222+
4. Now insert or modify this file (eg. by `touch resources/raw/input2_LatLon.pickle`): `INFO: output-file change detected!`
223+
5. The result json file content will be printed and persisted in `resources/result/result.json`

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from src.cargo_agent_event_handler import CargoAgentEventHandler
55
import os
66

7-
dev_analyze_file: str = os.getcwd() + "/resources/raw/input2.pickle"
7+
dev_analyze_file: str = os.getcwd() + "/resources/raw/input1_LatLon.pickle"
88
dev_analyze_file_type_slug: str = "moving_pandas_trajectory_collection"
99
dev_result_file: str = os.getcwd() + "/resources/result/result.json"
1010
dev_working_copy: str = os.getcwd() + "/resources/result/working_copy"

resources/raw/README.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Set of input data to test apps.
2+
3+
*Content*
4+
- input1: 1 goat, median fix rate = 30mins, tracking duration 7.5 month, gps, local movement
5+
- input2: 3 storks, median fix rate = 1sec, tracking duration 2 weeks, gps, local movement
6+
- input3: 1 stork, median fix rate = 1h | 1day | 1 week, tracking duration 11.5 years, argos, includes migration
7+
- input4: 3 geese, median fix rate = 1h | 4h, tracking duration 1.5 years, gps, includes migration
8+
9+
*I/O types*
10+
- all data sets are provided as 'MovingPandas.TrajectoryCollection'
11+
12+
13+
*Projection*
14+
- data are provided in "lat/long" (EPSG:4326) and projected to "Mollweide" (ESRI:54009) in order to test your app accordingly for not projected and projected data. If your app does not allow projected data or only can deal with projected data, document and either build a automatic transformation in the app or make it fail with an informative error message. The app "Change projection" can be refered to for the user to change the projection of the data acordingly previous to your app.
15+
16+
*File names*
17+
input1_LatLon.pickle
18+
input1_Mollweide.pickle
19+
20+
input2_LatLon.pickle
21+
input2_Mollweide.pickle
22+
23+
input3_LatLon.pickle
24+
input3_Mollweide.pickle
25+
26+
input4_LatLon.pickle
27+
input4_Mollweide.pickle
28+
29+

resources/raw/input1.pickle

-68.9 MB
Binary file not shown.
1.69 MB
Binary file not shown.

resources/raw/input2.pickle

-3.59 MB
Binary file not shown.

resources/raw/input3.pickle

-1.25 MB
Binary file not shown.

resources/raw/input3_LatLon.pickle

1.41 MB
Binary file not shown.
1.41 MB
Binary file not shown.

0 commit comments

Comments
 (0)