-
Notifications
You must be signed in to change notification settings - Fork 0
ecrf importer converter #31
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0ee2ad8
Add optional eCRF importer file converter modules.
rkrenn 8738255
Route Interfast3 lab CSV into multi-sheet Excel via Proband search.
rkrenn 5c2de66
Prefer JWT username claim when resolving the REST API user.
rkrenn 821c9c7
Publish convert intermediates via FileService and move Interfast3 out…
rkrenn 8ac2d35
Harden convert output and converter module loading.
rkrenn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
CTSMS/BulkProcessor/RestRequests/ctsms/shared/ToolsService/CompleteEcrfField.pm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| package CTSMS::BulkProcessor::RestRequests::ctsms::shared::ToolsService::CompleteEcrfField; | ||
| use strict; | ||
|
|
||
| ## no critic | ||
|
|
||
| use CTSMS::BulkProcessor::ConnectorPool qw( | ||
| get_ctsms_restapi | ||
| ); | ||
|
|
||
| use CTSMS::BulkProcessor::RestProcessor qw( | ||
| copy_row | ||
| get_query_string | ||
| ); | ||
|
|
||
| use CTSMS::BulkProcessor::RestConnectors::CtsmsRestApi qw(_get_api); | ||
| use CTSMS::BulkProcessor::RestItem qw(); | ||
|
|
||
| require Exporter; | ||
| our @ISA = qw(Exporter CTSMS::BulkProcessor::RestItem); | ||
| our @EXPORT_OK = qw( | ||
| complete_ecrf_field | ||
| ); | ||
|
|
||
| my $default_restapi = \&get_ctsms_restapi; | ||
| my $get_complete_path_query = sub { | ||
| my ($name_infix, $limit) = @_; | ||
| my %params = (); | ||
| $params{nameInfix} = $name_infix if defined $name_infix; | ||
| $params{limit} = $limit if defined $limit; | ||
| return 'tools/complete/ecrffield/' . get_query_string(\%params); | ||
| }; | ||
|
|
||
| my $fieldnames = [ | ||
| 'id', | ||
| 'name', | ||
| 'uniqueName', | ||
| 'title', | ||
| 'titleL10nKey', | ||
| 'externalId', | ||
| 'value', | ||
| 'label', | ||
| ]; | ||
|
|
||
| sub new { | ||
|
|
||
| my $class = shift; | ||
| my $self = CTSMS::BulkProcessor::RestItem->new($class,$fieldnames); | ||
|
|
||
| copy_row($self,shift,$fieldnames); | ||
|
|
||
| return $self; | ||
|
|
||
| } | ||
|
|
||
| sub complete_ecrf_field { | ||
|
|
||
| my ($name_infix, $limit, $load_recursive,$restapi,$headers) = @_; | ||
| my $api = _get_api($restapi,$default_restapi); | ||
| return builditems_fromrows($api->get(&$get_complete_path_query($name_infix, $limit),$headers),$load_recursive,$restapi); | ||
|
|
||
| } | ||
|
|
||
| sub builditems_fromrows { | ||
|
|
||
| my ($rows,$load_recursive,$restapi) = @_; | ||
|
|
||
| my $item; | ||
|
|
||
| if (defined $rows and ref $rows eq 'ARRAY') { | ||
| my @items = (); | ||
| foreach my $row (@$rows) { | ||
| $item = __PACKAGE__->new($row); | ||
| push @items,$item; | ||
| } | ||
| return \@items; | ||
| } elsif (defined $rows and ref $rows eq 'HASH') { | ||
| $item = __PACKAGE__->new($rows); | ||
| return $item; | ||
| } | ||
| return undef; | ||
|
|
||
| } | ||
|
|
||
| sub TO_JSON { | ||
|
|
||
| my $self = shift; | ||
| my $label = $self->{label} // $self->{uniqueName} // $self->{title} // $self->{name} // $self->{id}; | ||
| my $value = $self->{value} // $self->{id}; | ||
| return { | ||
| value => $value, | ||
| label => $label, | ||
| }; | ||
|
|
||
| } | ||
|
|
||
| 1; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.