MapCampaigner icon indicating copy to clipboard operation
MapCampaigner copied to clipboard

campaign.json updates

Open russbiggs opened this issue 5 years ago • 6 comments

Currently the fields we will need to add to campaign.json are

Updating campaign_managers key include osm_id instead of display name

Add campaign_viewers for easier querying when deleting projects

    "campaign_viewers": [
        "123456",
        "987654"
    ],

adding features key which is an array of objects representing each feature type and their total feature count and complete feature count. This will be used to calculate feature completeness more efficiently

e.g.:

        "features": [
            {"type":"school",
            "total":345,
            "complete":12
            }
        ]

adding a contributors key to track individual osm user for contributor list and detail pages. We will want to include team keys for these as well

    "contributors": [
        {"osm_id": 12345,
         "teams": [1,3]
        }
    ]

russbiggs avatar Nov 08 '19 04:11 russbiggs

@JorgeMartinezG @localjo @Eleonore9 we can use this issue to ask questions or provide suggestions for other modifications

russbiggs avatar Nov 08 '19 04:11 russbiggs

How will we look up the display name from the osm_id? If that requires an ajax request, maybe we should store both in the json. Something like:

"campaign_viewers": [
  { osm_id: "123456", name: "Jo Sprague" },
  { osm_id: "987654", name: "Russ Biggs" }
]

localjo avatar Nov 08 '19 12:11 localjo

@localjo good catch. As discussed I think this can work even though username is editable, for now we will keep it static from the time the user is added. We can look at options to check for updates in future sprints

russbiggs avatar Nov 08 '19 18:11 russbiggs

I'm working on the new campaign creation flow, which depends on some of these changes. Have we started implementing any part of these changes yet in any of our branches? If I'm understanding correctly, this is what the relevant keys in campaign.json should look like;

{
  "name": "Campaign Name",
  "uuid": "000000000000",
  "campaign_creator": "Jo",
  "user_id": "123456",
  "total_participants_count": 0, // Is this being used?
  "participants_count_per_type": {}, // Is this being used?
  "campaign_managers": [
    { "osm_id": "123456", "name": "Jo" },
    { "osm_id": "987654", "name": "Russ" }
  ],
  "campaign_viewers": [
    { "osm_id": "564738", "name": "Eleonore" }
  ],
  "features": [
    {
      "type": "school", // Is this the OSM feature name, or user-entered name?
      "total": 345,
      "complete": 12
    }
  ],
  "contributors": [
    {
      "osm_id": "192837",
      "name": "Jorge",
      "teams": [1,3] // What is the teams key and how is it used?
    }
  ]
}

The comments in this snippet have some questions that we'll need to discuss.

localjo avatar Nov 22 '19 11:11 localjo

The delete campaign function also expects

"campaign_viewers": [
  { osm_id: "123456", name: "Jo Sprague" },
  { osm_id: "987654", name: "Russ Biggs" }
]

https://github.com/hotosm/MapCampaigner/pull/762

Eleonore9 avatar Nov 22 '19 13:11 Eleonore9

I've added the osm_id to campaign_managers in this commit. @JorgeMartinezG Can you give this a quick look and see if you think the way I did this will cause any problems? https://github.com/hotosm/MapCampaigner/pull/773/commits/ae8d6d75e12f57cd721a130e7b5123771d318a08

localjo avatar Nov 22 '19 17:11 localjo