hotosm / MapCampaigner

Campaign management tool
BSD 3-Clause "New" or "Revised" License
38 stars 23 forks source link

campaign.json updates #765

Open russbiggs opened 4 years ago

russbiggs commented 4 years ago

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 commented 4 years ago

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

localjo commented 4 years ago

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" }
]
russbiggs commented 4 years ago

@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

localjo commented 4 years ago

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.

Eleonore9 commented 4 years ago

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

localjo commented 4 years ago

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