Get, post and delete predictions
get_prediction_by_id(api_key, id)
¶
Retrieve one prediction record by its ID.
Source code in mosqlient/registry/_prediction_get_impl.py
100 101 102 103 | |
get_predictions(api_key, id=None, model_id=None, model_name=None, model_owner=None, model_organization=None, adm_level=None, model_time_resolution=None, disease=None, model_category=None, imdc_year=None, start=None, end=None)
¶
Retrieve one or more prediction records from the Mosqlimate API.
Parameters¶
api_key : str API key used to authenticate with the Mosqlimate service. id : int, optional Unique identifier of the prediction. model_id : int, optional Unique identifier of the model. model_name : str, optional Name of the model (repository name). model_owner : str, optional Username of the model owner (e.g. GitHub username). model_organization : str, optional Name of the organization that owns the model. adm_level : int, optional Administrative level (0: national, 1: state, 2: municipality, 3: sub-municipality). model_time_resolution : str, optional Temporal resolution ('day', 'week', 'month', 'year'). disease : str, optional Disease code (e.g., 'A90' for Dengue, 'A92.0' for Chikungunya, 'A92.5' for Zika). model_category : str, optional Category of the model (e.g., 'quantitative', 'spatio_temporal_quantitative'). imdc_year : int, optional The year of the IMDC if the model was part of a competition (e.g., 2024). start : date, optional Filter predictions with data starting on or after this date. end : date, optional Filter predictions with data ending on or before this date.
Returns¶
List[Prediction] A list of prediction objects matching the filters.
Source code in mosqlient/registry/_prediction_get_impl.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
get_predictions_between(api_key, start, end)
¶
Retrieve predictions where data falls within the date range.
Source code in mosqlient/registry/_prediction_get_impl.py
157 158 159 160 161 | |
upload_prediction(api_key, repository, disease, description, commit, prediction, adm_level, case_definition='probable', published=True, adm_0='BRA', adm_1=None, adm_2=None, adm_3=None)
¶
Upload a prediction to the Mosqlimate API.
Parameters¶
api_key : str API key used to authenticate with the Mosqlimate service. repository : str The repository identifier in the format "owner/repo_name". disease : str The disease code in the IDC-10 format. Example: "A90". description : str Textual description of the prediction run. commit : str Git commit hash associated with the model version. prediction : list of dict or pandas.DataFrame Forecast data. If a DataFrame is provided, it must contain columns matching the prediction schema (date, pred, lower_95, etc.). adm_level : int Administrative level, options: 0, 1, 2, 3 (National, State, Municipality, Sub Municipality) case_definition : str, default="probable" The case definition used (e.g., "probable" or "reported"). published : bool, default=False Whether the prediction should be visible to the public. adm_0 : str, default="BRA" ISO 3166-1 alpha-3 country code. adm_1 : int, optional State-level administrative division geocode. adm_2 : int, optional Municipality-level geocode. adm_3 : int, optional Sub-municipality-level geocode.
Returns¶
Prediction The created Prediction object.
Source code in mosqlient/registry/_prediction_post_impl.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
delete_prediction(api_key, prediction_id)
¶
Function to delete a prediction registered in the platform. Only the author can remove the prediction.
Parameters¶
api_key : str
API key used to authenticate with the Mosqlimate service.
prediction_id : int
Prediction id.
Returns¶
request response
Source code in mosqlient/registry/_prediction_delete_impl.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |