@@ -105,6 +105,13 @@ public CcController(
105
105
FeatureExtraction .init (null );
106
106
}
107
107
108
+ /**
109
+ * Create a new cohort characterization
110
+ *
111
+ * @param dto A cohort characterization JSON definition (name, cohorts, featureAnalyses, etc.)
112
+ * @return The cohort characterization definition passed in as input
113
+ * with additional fields (createdDate, hasWriteAccess, tags, id, hashcode).
114
+ */
108
115
@ POST
109
116
@ Path ("/" )
110
117
@ Produces (MediaType .APPLICATION_JSON )
@@ -115,6 +122,12 @@ public CohortCharacterizationDTO create(final CohortCharacterizationDTO dto) {
115
122
return conversionService .convert (createdEntity , CohortCharacterizationDTO .class );
116
123
}
117
124
125
+ /**
126
+ * Create a copy of an existing cohort characterization
127
+ *
128
+ * @param id An existing cohort characterization id
129
+ * @return The cohort characterization definition of the newly created copy
130
+ */
118
131
@ POST
119
132
@ Path ("/{id}" )
120
133
@ Produces (MediaType .APPLICATION_JSON )
@@ -128,6 +141,11 @@ public CohortCharacterizationDTO copy(@PathParam("id") final Long id) {
128
141
return create (dto );
129
142
}
130
143
144
+ /**
145
+ * Get information about the cohort characterization analyses in WebAPI
146
+ *
147
+ * @return A json object with information about the characterization analyses in WebAPI.
148
+ */
131
149
@ GET
132
150
@ Path ("/" )
133
151
@ Produces (MediaType .APPLICATION_JSON )
@@ -140,6 +158,11 @@ public Page<CcShortDTO> list(@Pagination Pageable pageable) {
140
158
});
141
159
}
142
160
161
+ /**
162
+ * Get the design specification for every cohort-characterization analysis in WebAPI.
163
+ *
164
+ * @return A json object with all characterization design specifications.
165
+ */
143
166
@ GET
144
167
@ Path ("/design" )
145
168
@ Produces (MediaType .APPLICATION_JSON )
@@ -148,6 +171,12 @@ public Page<CohortCharacterizationDTO> listDesign(@Pagination Pageable pageable)
148
171
return service .getPageWithLinkedEntities (pageable ).map (this ::convertCcToDto );
149
172
}
150
173
174
+ /**
175
+ * Get metadata about a cohort characterization.
176
+ *
177
+ * @param id The id for an existing cohort characterization
178
+ * @return name, createdDate, tags, etc for a single cohort characterization.
179
+ */
151
180
@ GET
152
181
@ Path ("/{id}" )
153
182
@ Produces (MediaType .APPLICATION_JSON )
@@ -156,6 +185,12 @@ public CcShortDTO get(@PathParam("id") final Long id) {
156
185
return convertCcToShortDto (service .findById (id ));
157
186
}
158
187
188
+ /**
189
+ * Get the complete design specification for a single cohort characterization.
190
+ *
191
+ * @param id The id for an existing cohort characterization
192
+ * @return JSON containing the cohort characterization specification
193
+ */
159
194
@ GET
160
195
@ Path ("/{id}/design" )
161
196
@ Produces (MediaType .APPLICATION_JSON )
@@ -166,6 +201,15 @@ public CohortCharacterizationDTO getDesign(@PathParam("id") final Long id) {
166
201
return convertCcToDto (cc );
167
202
}
168
203
204
+ /**
205
+ * Check if a cohort characterization with the same name exists
206
+ *
207
+ * <p>This endpoint is used to check that a desired name for a characterization does not already exist in WebAPI</p>
208
+ *
209
+ * @param id The id for a new characterization that does not currently exist in WebAPI
210
+ * @param name The desired name for the new cohort characterization
211
+ * @return The number of existing characterizations with the same name that was passed as a query parameter
212
+ */
169
213
@ GET
170
214
@ Path ("/{id}/exists" )
171
215
@ Produces (MediaType .APPLICATION_JSON )
@@ -174,6 +218,11 @@ public int getCountCcWithSameName(@PathParam("id") @DefaultValue("0") final long
174
218
return service .getCountCcWithSameName (id , name );
175
219
}
176
220
221
+ /**
222
+ * Remove a characterization from WebAPI
223
+ *
224
+ * @param id The id for a characterization that currently exists in WebAPI
225
+ */
177
226
@ DELETE
178
227
@ Path ("/{id}" )
179
228
@ Produces (MediaType .APPLICATION_JSON )
@@ -189,7 +238,7 @@ private CohortCharacterizationDTO convertCcToDto(final CohortCharacterizationEnt
189
238
private CcShortDTO convertCcToShortDto (final CohortCharacterizationEntity entity ) {
190
239
return conversionService .convert (entity , CcShortDTO .class );
191
240
}
192
-
241
+
193
242
@ PUT
194
243
@ Path ("/{id}" )
195
244
@ Produces (MediaType .APPLICATION_JSON )
@@ -202,6 +251,14 @@ public CohortCharacterizationDTO update(@PathParam("id") final Long id, final Co
202
251
return conversionService .convert (updatedEntity , CohortCharacterizationDTO .class );
203
252
}
204
253
254
+ /**
255
+ * Add a new cohort characterization analysis to WebAPI
256
+ *
257
+ * @chrisknoll this endpoint did not work when I tried it.
258
+ *
259
+ * @param dto A cohort characterization definition
260
+ * @return The same cohort characterization definition that was passed as input
261
+ */
205
262
@ POST
206
263
@ Path ("/import" )
207
264
@ Produces (MediaType .APPLICATION_JSON )
@@ -213,6 +270,12 @@ public CohortCharacterizationDTO doImport(final CcExportDTO dto) {
213
270
return conversionService .convert (service .importCc (entity ), CohortCharacterizationDTO .class );
214
271
}
215
272
273
+ /**
274
+ * Get a cohort characterization definition
275
+ *
276
+ * @param id The id of an existing cohort characterization definition
277
+ * @return JSON containing the cohort characterization definition
278
+ */
216
279
@ GET
217
280
@ Path ("/{id}/export" )
218
281
@ Produces (MediaType .APPLICATION_JSON )
@@ -221,6 +284,11 @@ public String export(@PathParam("id") final Long id) {
221
284
return service .serializeCc (id );
222
285
}
223
286
287
+ /**
288
+ * Get csv files containing concept sets used in a characterization analysis
289
+ * @param id The id for a cohort characterization analysis
290
+ * @return A zip file containing three csv files (mappedConcepts, includedConcepts, conceptSetExpression)
291
+ */
224
292
@ GET
225
293
@ Path ("/{id}/export/conceptset" )
226
294
@ Produces (MediaType .APPLICATION_OCTET_STREAM )
@@ -232,8 +300,13 @@ public Response exportConceptSets(@PathParam("id") final Long id) {
232
300
ByteArrayOutputStream stream = ExportUtil .writeConceptSetExportToCSVAndZip (exportList );
233
301
return HttpUtils .respondBinary (stream , String .format ("cc_%d_export.zip" , id ));
234
302
}
235
-
236
303
304
+ /**
305
+ * Check that a cohort characterization definition is correct
306
+ * @summary Check a cohort characterization definition
307
+ * @param characterizationDTO A cohort characterization definition object
308
+ * @return A list of warnings that is possibly empty
309
+ */
237
310
@ POST
238
311
@ Path ("/check" )
239
312
@ Produces (MediaType .APPLICATION_JSON )
@@ -242,6 +315,12 @@ public CheckResult runDiagnostics(CohortCharacterizationDTO characterizationDTO)
242
315
return new CheckResult (checker .check (characterizationDTO ));
243
316
}
244
317
318
+ /**
319
+ * Generate a cohort characterization on a single data source
320
+ * @param id The id of an existing cohort characterization in WebAPI
321
+ * @param sourceKey The identifier for the data source to generate against
322
+ * @return A json object with information about the generation job included the status and execution id.
323
+ */
245
324
@ POST
246
325
@ Path ("/{id}/generation/{sourceKey}" )
247
326
@ Produces (MediaType .APPLICATION_JSON )
@@ -256,13 +335,24 @@ public JobExecutionResource generate(@PathParam("id") final Long id, @PathParam(
256
335
return service .generateCc (id , sourceKey );
257
336
}
258
337
338
+ /**
339
+ * Cancel a cohort characterization generation
340
+ * @param id The id of an existing cohort characterization
341
+ * @param sourceKey The sourceKey for the data source to generate against
342
+ * @return Status code
343
+ */
259
344
@ DELETE
260
345
@ Path ("/{id}/generation/{sourceKey}" )
261
346
public Response cancelGeneration (@ PathParam ("id" ) final Long id , @ PathParam ("sourceKey" ) final String sourceKey ) {
262
347
service .cancelGeneration (id , sourceKey );
263
348
return Response .ok ().build ();
264
349
}
265
350
351
+ /**
352
+ * Get all generations for a cohort characterization
353
+ * @param id The id for an existing cohort characterization
354
+ * @return An array of all generations that includes the generation id, sourceKey, start and end times
355
+ */
266
356
@ GET
267
357
@ Path ("/{id}/generation" )
268
358
@ Produces (MediaType .APPLICATION_JSON )
@@ -274,6 +364,11 @@ public List<CommonGenerationDTO> getGenerationList(@PathParam("id") final Long i
274
364
info -> Collections .singletonMap (Constants .Variables .SOURCE , sourcesMap .get (info .getSourceKey ())));
275
365
}
276
366
367
+ /**
368
+ * Get generation information by generation id
369
+ * @param generationId The generation id to look up
370
+ * @return Data about the generation including the generation id, sourceKey, hashcode, start and end times
371
+ */
277
372
@ GET
278
373
@ Path ("/generation/{generationId}" )
279
374
@ Produces (MediaType .APPLICATION_JSON )
@@ -285,6 +380,10 @@ public CommonGenerationDTO getGeneration(@PathParam("generationId") final Long g
285
380
Collections .singletonMap (Constants .Variables .SOURCE , generationEntity .getSource ()));
286
381
}
287
382
383
+ /**
384
+ * Delete a cohort characterization generation
385
+ * @param generationId
386
+ */
288
387
@ DELETE
289
388
@ Path ("/generation/{generationId}" )
290
389
@ Produces (MediaType .APPLICATION_JSON )
@@ -293,6 +392,11 @@ public void deleteGeneration(@PathParam("generationId") final Long generationId)
293
392
service .deleteCcGeneration (generationId );
294
393
}
295
394
395
+ /**
396
+ * Get the definition of a cohort characterization for a given generation id
397
+ * @param generationId
398
+ * @return A cohort characterization definition
399
+ */
296
400
@ GET
297
401
@ Path ("/generation/{generationId}/design" )
298
402
@ Produces (MediaType .APPLICATION_JSON )
@@ -302,6 +406,12 @@ public CcExportDTO getGenerationDesign(
302
406
return conversionService .convert (service .findDesignByGenerationId (generationId ), CcExportDTO .class );
303
407
}
304
408
409
+ /**
410
+ * Get the total number of analyses in a cohort characterization
411
+ *
412
+ * @param generationId
413
+ * @return The total number of analyses in the given cohort characterization
414
+ */
305
415
@ GET
306
416
@ Path ("/generation/{generationId}/result/count" )
307
417
@ Produces (MediaType .APPLICATION_JSON )
@@ -310,6 +420,13 @@ public Long getGenerationsResultsCount( @PathParam("generationId") final Long ge
310
420
return service .getCCResultsTotalCount (generationId );
311
421
}
312
422
423
+ /**
424
+ * Get cohort characterization results
425
+ * @param generationId id for generation
426
+ * @param thresholdLevel The max prevelance for a covariate. Covariates that occur in less than {threholdLevel}%
427
+ * of the cohort will not be returned. Default is 0.01 = 1%
428
+ * @return The complete set of characterization analyses filtered by the thresholdLevel parameter
429
+ */
313
430
@ GET
314
431
@ Path ("/generation/{generationId}/result" )
315
432
@ Produces (MediaType .APPLICATION_JSON )
@@ -318,7 +435,7 @@ public List<CcResult> getGenerationsResults(
318
435
@ PathParam ("generationId" ) final Long generationId , @ DefaultValue ("0.01" ) @ QueryParam ("thresholdLevel" ) final float thresholdLevel ) {
319
436
return service .findResultAsList (generationId , thresholdLevel );
320
437
}
321
-
438
+
322
439
@ POST
323
440
@ Path ("/generation/{generationId}/result" )
324
441
@ Produces (MediaType .APPLICATION_JSON )
@@ -398,6 +515,13 @@ public List<CcPrevalenceStat> getPrevalenceStat(@PathParam("generationId") Long
398
515
return stats ;
399
516
}
400
517
518
+ /**
519
+ * Download a cohort characterization R study package that can be used to run the characterization on an OMOP CDM from R
520
+ * @summary Download a cohort characterization R package
521
+ * @param analysisId id of the cohort characterization to convert to an R study package
522
+ * @param packageName The name of the R study package
523
+ * @return A zip file containing the cohort characterization R study package
524
+ */
401
525
@ GET
402
526
@ Path ("{id}/download" )
403
527
@ Consumes (MediaType .APPLICATION_JSON )
0 commit comments