bcgov / lucy-web

Web application for LUCY: Inventory and database repository for the creation, treatment, and report on BC Invasive plants and animals.
Apache License 2.0
3 stars 6 forks source link

Observation API Mock Request/Mock endpoint #795

Closed micheal-w-wells closed 4 years ago

micheal-w-wells commented 4 years ago

Observation API Mock Request/Mock endpoint

Originally posted by @micheal-w-wells in https://github.com/bcgov/lucy-web/issues/628#issuecomment-673532010

micheal-w-wells commented 4 years ago

@anissa-agahchen this is what the json looks like for the activity endpoint:

{
  "activityType": "string",
  "activitySubType": "string",
  "date": "string",
  "deviceRequestUID": "string",
  "locationAndGeometry": {
    "anchorPointY": 0,
    "anchorPointX": 0,
    "area": 0,
    "geometry": {},
    "jurisdiction": "string",
    "agency": "string",
    "observer1FirstName": "string",
    "observer1LastName": "string",
    "locationComment": "string",
    "generalComment": "string",
    "photoTaken": true
  },
  "activityTypeData": 
{
        "negative_observation_ind": true,
        "aquatic_observation_ind": true,
        "primary_user_last_name": "mike",
        "secondary_user_first_name": "mike",
        "secondary_user_last_name": "mike",
        "species": "banana",
        "primary_file_id": "test",
        "secondary_file_id": "test",
        "location_comment": "test",
        "general_observation_comment": "general comment",
        "sample_taken_ind": true,
        "sample_label_number": "string"
}

,
  "activitySubTypeData": 

{
"species": "banana",
"distribution": 123,
"density": 123,
"soil_texture": ,
"slope": 123,
"aspect": 123,
"flowering": true,
"specific_use": 123,
"proposed_action": 123,
"seed_stage": 123,
"plant_health": 123,
"plant_life_stage": 123,
"early_detection": ,
"research": true,
"well_on_site_ind": true,
"special_care_ind": true,
"biological_care_ind": true,
"legacy_site_ind": true,
"range_unit": "Canyon"
}
}

The stuff that's common to all observations goes in 'activityTypeData' and the stuff that is specific to a particular type (like terrestrial plant observation) goes in 'activitySubTypeData'.

if you want to work on the model for the higher level fields as specified above, you can use that as your mock request.

popkinj commented 4 years ago

Hey @micheal-w-wells and @NickPhura . I'm creating some mock data so I can work on the geometry section of the API. I'd like your thoughts on the following.

{
    "data": {
        "activityData": {
            "access_description": "Quos dolor blanditiis perferendis. Nesciunt ipsum reprehenderit. Numquam quasi exercitationem et ut quis ex facere eius. Exercitationem voluptatem ducimus quo dolor saepe ut est. Et porro animi labore alias.",
            "aquatic_ind": true,
            "bec_zone": null,
            "biological_ind": true,
            "created_at": "2020-06-24T17:29:55.53743",
            "created_by_user_id": 1,
            "early_detection_rapid_resp_ind": false,
            "elevation_metes": 5,
            "flnro_district": null,
            "flowering": false,
            "general_comment": "Non tempore itaque dignissimos corporis est. Qui sit molestias enim.",
            "hex_id": null,
            "hex_sub_id": null,
            "ipma": "jfkdsljfklds",
            "jurisdiction_code_id": 19,
            "legacy_site_ind": false,
            "moti_district": null,
            "negative_occurance_id": false,
            "observation_aspect_code_id": 6,
            "observation_date": "2020-01-24",
            "observation_geometry_code_id": 1,
            "observation_proposed_action_code_id": 9,
            "observation_slope_code_id": 6,
            "observation_type_code_id": 13,
            "observer_first_name": "facilis",
            "observer_last_name": "nostrum",
            "ownership": "Private",
            "paper_id_primary": "1",
            "paper_id_secondary": "1",
            "photo_indicator": false,
            "range_unit_number": "possimus",
            "raw_albers_x": null,
            "raw_albers_y": null,
            "raw_latitude": 52.543534,
            "raw_longitude": -135.4328492,
            "raw_utm_easting": null,
            "raw_utm_northing": null,
            "raw_utm_zone": null,
            "regional_district": null,
            "research_detection_ind": false,
            "riso": null,
            "sample_identifier": "aut",
            "sample_taken_ind": false,
            "soil_texture_code_id": 5,
            "space_geom_id": 627,
            "special_care_ind": false,
            "species_agency_code_id": 17,
            "species_density_code_id": 4,
            "species_distribution_code_id": 9,
            "species_id": 152,
            "specific_use_code_id": 9,
            "total_area": 20000,
            "updated_at": "2020-06-24T17:29:55.53743",
            "updated_by_user_id": 1,
            "well_ind": false,
            "well_proximity": 20000,
            "well_tag": 1234
        }
    },
    "date": "2014-01-01T23:28:56.782Z",
    "locationAndGeometry": {
        "type": "FeatureCollection",
        "features": [{
            "type": "Feature",
            "geometry": {
                "type": "Point",
                "coordinates": [-125.6, 48.3]
            },
            "properties": {}
        }]
    },
    "activitySubType": "Invasive Terrestrial Plant",
    "activityType": "Observation",
    "deviceRequestUID": "84dc813c-e307-11ea-87d0-0242ac130003"
}
micheal-w-wells commented 4 years ago

@popkinj i like what yo've got in locationAndGeometry but what you stuck in activity data isn't in line with the most recent iteration of the API

If you've got time now we can hop on a call and we can sort through stuff

popkinj commented 4 years ago

Makes sense @micheal-w-wells ... I've got the new format and am running with it.

micheal-w-wells commented 4 years ago

overall this is the method to the madnesss:

{
        // only stuff common to all activity types here
        "activityType": "Observation",
        "activitySubType": "Terrestrial Invasive Plant",
        "date": "2019-04-12",
        "deviceRequestUID": "string",
        "locationAndGeometry": {
                //Where all the geo-stuff goes
        },
        "activityTypeData": {
                // stuff common to parent record type, like observation
        },
        "activitySubTypeData": {
                // stuff specific to child record type, like terrestrial plant observation
        }
}