<commit_before>from common_tags import LGA_ID, START_TIME, SURVEYOR_NAME, \
    INSTANCE_DOC_NAME, ATTACHMENTS, GPS
from parsed_xforms.models import xform_instances
from utils import json_response
from deny_if_unauthorized import deny_if_unauthorized

@deny_if_unauthorized()
def map_data_points(request, lga_id):
    """
    The map list needs these attributes for each survey to display
    the map & dropdown filters.
    
    * Mongo doc ID, this is the same as xform_manager.models.Instance.id
    * Date
    * Surveyor name
    * Survey Type
    * LGA ID
    * a URL to access the picture
    * GPS coordinates
    
    """
    match_lga = {LGA_ID : int(lga_id)}
    fields = [START_TIME, SURVEYOR_NAME, INSTANCE_DOC_NAME,
              LGA_ID, ATTACHMENTS, GPS]
    mongo_query = xform_instances.find(spec=match_lga, fields=fields)
    list_of_dicts = list(mongo_query)
    return json_response(list_of_dicts)<commit_msg>Requires that gps coordinates exist for the map view, I'm not sure if this excludes null values.<commit_after>from common_tags import LGA_ID, START_TIME, SURVEYOR_NAME, \
    INSTANCE_DOC_NAME, ATTACHMENTS, GPS
from parsed_xforms.models import xform_instances
from utils import json_response
from deny_if_unauthorized import deny_if_unauthorized

@deny_if_unauthorized()
def map_data_points(request, lga_id):
    """
    The map list needs these attributes for each survey to display
    the map & dropdown filters.
    
    * Mongo doc ID, this is the same as xform_manager.models.Instance.id
    * Date
    * Surveyor name
    * Survey Type
    * LGA ID
    * a URL to access the picture
    * GPS coordinates
    
    """
    match_lga = {LGA_ID: int(lga_id), GPS: {"$exists": True}}
    fields = [START_TIME, SURVEYOR_NAME, INSTANCE_DOC_NAME,
              LGA_ID, ATTACHMENTS, GPS]
    mongo_query = xform_instances.find(spec=match_lga, fields=fields)
    list_of_dicts = list(mongo_query)
    return json_response(list_of_dicts)
{'fraction_non_alphanumeric': 0.06880733944954129, 'fraction_numerical': 0.0, 'mean_word_length': 3.7645631067961167, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3287099', 'n_tokens_mistral': 669, 'n_tokens_neox': 643, 'n_words': 180}