Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DB1 and DB2 report processing to SUSHI #31

Merged
merged 8 commits into from
Apr 22, 2016

Conversation

ghost
Copy link

@ghost ghost commented Apr 21, 2016

Added code to generically catch metrics from SUSHI responses and create CounterDatabase instances for each. Required two new methods, one to CounterDatabase parent class CounterEresource to check that all months in reporting period are present and add them if not. The other to CounterReport to check that all metrics required by COUNTER are present and add them if not. Unit tests and data files are provided for processing the reports, can provide for individual methods if requested.

Ed Hill added 7 commits April 20, 2016 17:42
DB reports are different because they have multiple metrics
on multiple lines, and SUSHI protocol provides limited
guarantees on how they will be formatted. Catch month values
in a dict with metrics as keys, then send each as a
CounterDatabase object
Provide a mapping from SUSHI codes to COUNTER names
for DB reports. If parsing a pre-formatted COUNTER
report, it will fall back to whatever is already in
the report.
SUSHI protocol does not require transmission of
fields with zero use. Ensures months with no data
are inserted with a 0, then sorted. Calls from
CounterDatabase.as_generic to accurately write as a
COUNTER compliant report.
SUSHI protocol does not guarantee fields with zero use
are in a report. If a field has no use for a given
period, it might not show up in the report at all.

If a report is a datbase report, check each database
to ensure it has all metrics and insert them with a 0
for the first month of the reporting period. After all
metrics have been established, sort them so they write
to file in the correct order (sort order will be
maintained after the subsequent title sort)
TestConvertRawDatabase tests that all information is
correct and in the correct order for a DB report.
Utilizes sushi_simple_db1.xml which is in part based
on formatting from ProQuest SUSHI reports

TestRawDatabaseWithMissingData tests that, on output,
SUSHI data is correct and full even if zero-value fields
were not sent. January is missing data and there are no
records for 'record_view' in the data source. Utilizes
sushi_db1_missing_record_view.xml which is in part based
on formatting from EBSCO SUSHI reports.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 99.592% when pulling d34ff72 on chill17:addingdbtosushi into ae185df on pitthsls:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 99.592% when pulling 44c5e8e on chill17:addingdbtosushi into ae185df on pitthsls:master.

@Wooble
Copy link
Member

Wooble commented Apr 21, 2016

LGTM; I'm not too worried about the coveralls complaint.

I'll play around with it a bit tomorrow morning and most likely merge it. Thank you!

@Wooble Wooble merged commit cc26625 into pitthsls:master Apr 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants