Create a new Simulator Sample File
Description
There will be times when we need to retest live simulation of a training record. Initially we can do it with the the playback feature of the training record. But if because of some reason that is not sufficient. Let's say we want to see the pusher and faunaDB responses too. In such case we may need to create a new sample file based on the training record in question.
Steps
1. In the production site, go to the Training Record page
2. Save ehm_data
- Open the training record in question
- In the details page, open the
Developer Toolsin browser. - Go to the
Networktab and refresh the page - You will find a request with the id of the record
- Within the response, find
data > item > ehm_dataobject. - Copy the whole object, and save it somewhere for future use.
3. Create sample file
- In your editor, create a json file with the following structure
{ "data": { "list": [] } } - replace the
listproperty array with theehm_dataarray. It would look something like this:{ "data": { "list": [ { "id": 249169, "uuid": "725e3adf-7f3e-4c7e-a414-9fdd923d8076", "index": 1816, "eq_training_record_id": 321, "ehm_id": null, "horse_id": "136", "heart_rate": "000", "step_counter": "23", "speed": "0.0", "latitude": "5410.04400N", "longitude": "00426.92930W", "battery_voltage": "3986", "device_time": "1661511264.3552", "device_id": "69794347", "hrm_id": null, "parsed_coordinates": { "latitude": "5410.04400N", "longitude": "00426.92930W", "parsed_latitude": "54° 10' 4.4\" N", "parsed_longitude": "4° 26' 92.93\" W", "dd_latitude": 54.1674, "dd_longitude": -4.44882 }, "latency_json": { "device_time": "10:54:24", "api_endpoint_time": "2022-08-26T10:54:24.699Z", "current_time": "2022-08-26T11:01:43.902Z", "device_to_api": 1659849753434645, "api_to_app": 439203000, "overall": 1659850192637645 }, "meta": null, "created_by": null, "updated_by": null, "deleted_by": null, "created_at": "2022-08-26 11:02:00", "updated_at": "2022-08-26 11:02:00", "deleted_at": null, "extensions": [ { "id": 159716, "eq_ehm_data_id": 249169, "eq_map_id": 21, "index": 1816, "is_checkpoint": 0, "checked_marker_name": null, "checked_marker_id": null, "split_time": "0.13", "stride": "", "avg_speed": "9.96", "avg_stride": "0.01", "avg_heart_rate": "0.00", "parsed_coordinates": null, "meta": null, "created_by": null, "updated_by": null, "deleted_by": null, "created_at": "2022-08-26 11:02:02", "updated_at": "2022-08-26 11:02:02", "deleted_at": null } ] }, {...}, {...}, ... ] } }
- save this file as a json file.
4. Replace horse id with horse rfid
In your json file's list of ehm data, replace horse_id with horse_rfid in the first object of the list.
5. If : you have updated database
If you have a copy of the latest production database, then you can skip all further steps and directly use the Json file for simulation.
6. If : you do not have an updated database
- In the production site, find the horse profile using the horse id.
- Find the training center of the horse.
- Copy the training center in your site hosted on localhost
- Import the Race Course that is associated with the training record to your localhost site
- Now copy the horse profile to your localhost site.
7. Start your local equetronic-api server
8. Upload the sample file, and test your simulation
Table of Contents