Skip to content

Commit

Permalink
Comments and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matsbov committed Dec 28, 2024
1 parent ce4ee75 commit 0c7e075
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
27 changes: 27 additions & 0 deletions grails-app/controllers/au/org/ala/collectory/GbifController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,33 @@ class GbifController {
* Returns out-of-sync datasets for a specific data provider. The data provider is expected
* to provide datasets downloaded from GBIF (either full datasets or repatriated).
*/
@Operation(
method = "GET",
tags = "gbif",
operationId = "outOfSyncGbif",
summary = "Returns out-of-sync datasets for a specific data provider",
parameters = [
@Parameter(
name = "uid",
in = PATH,
description = "provider uid",
schema = @Schema(implementation = String),
example = "dr1",
required = true
),
],
responses = [
@ApiResponse(
description = "A list of datasets and meta data",
responseCode = "200",
content = [
@Content(
mediaType = "application/json"
)
]
)
]
)
@Path("/ws/gbif/outOfSync/{uid}")
@Produces("application/json")
def outOfSync() {
Expand Down
30 changes: 30 additions & 0 deletions grails-app/controllers/au/org/ala/collectory/IptController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ class IptController {
}
}

/**
* Renders a compare view (IPT vs Atlas) for a specific data provider
*/
def compare() {

DataProvider dataProvider = DataProvider.findByUid(params.uid)
Expand All @@ -248,6 +251,33 @@ class IptController {
* Returns out-of-sync datasets for a specific data provider. The data provider is expected
* to provide datasets from an IPT.
*/
@Operation(
method = "GET",
tags = "ipt",
operationId = "outOfSyncIpt",
summary = "Returns out-of-sync datasets for a specific data provider",
parameters = [
@Parameter(
name = "uid",
in = PATH,
description = "provider uid",
schema = @Schema(implementation = String),
example = "dr1",
required = true
),
],
responses = [
@ApiResponse(
description = "A list of datasets and meta data",
responseCode = "200",
content = [
@Content(
mediaType = "application/json"
)
]
)
]
)
@Path("/ws/ipt/outOfSync/{uid}")
@Produces("application/json")
def outOfSync() {
Expand Down
8 changes: 7 additions & 1 deletion grails-app/services/au/org/ala/collectory/GbifService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,12 @@ class GbifService {
result
}

/**
* Returns a list of datasets for a specific data provider
* @param dataProvider a data provider whose datasets are downloaded from GBIF
* @param onlyOutOfSync true to only include datasets that are out of sync
* @return a data structure containing a list of datasets and metadata
*/
def getDatasetComparison(DataProvider dataProvider, boolean onlyOutOfSync) {

// Get all GBIF data resources for this data provider
Expand Down Expand Up @@ -655,9 +661,9 @@ class GbifService {
type: dr.resourceType,
repatriationCountry: dr.repatriationCountry,
sourcePublished: getGbifDatasetLastUpdated(dr.gbifRegistryKey).toInstant(),
atlasPublished: dr.lastUpdated.toInstant(),
sourceCount: gbifDatasetRecordCountMap.getOrDefault(dr.gbifRegistryKey, 0),
atlasCount: atlasDatasetRecordCountMap.getOrDefault(dr.uid, 0),
atlasPublished: dr.lastUpdated.toInstant(),
pending: []
]

Expand Down
8 changes: 7 additions & 1 deletion grails-app/services/au/org/ala/collectory/IptService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ class IptService {
}
}

/**
* Returns a list of datasets for a specific data provider
* @param dataProvider a data provider whose datasets are provided by an IPT
* @param onlyOutOfSync true to only include datasets that are out of sync
* @return a data structure containing a list of datasets and metadata
*/
def getDatasetComparison(DataProvider dataProvider, boolean onlyOutOfSync) {

def result = []
Expand Down Expand Up @@ -262,9 +268,9 @@ class IptService {
sourceUrl: it.eml.replace("eml.do", "resource"),
type: it.type,
sourcePublished: it.lastPublished,
atlasPublished: "-",
sourceCount: it.recordsByExtension["http://rs.tdwg.org/dwc/terms/Occurrence"],
atlasCount: hasRecords ? 0 : null,
atlasPublished: "-",
pending: []
]

Expand Down

0 comments on commit 0c7e075

Please sign in to comment.