Code Monkey home page Code Monkey logo

Comments (5)

sburns avatar sburns commented on August 29, 2024

Hi Steve!

Currently no plans but I'd of course welcome a PR. I think they finally revoked my vandy credentials from REDCap, so if you submit a PR it will likely fail CI :(

from pycap.

damonms avatar damonms commented on August 29, 2024

from pycap.

remifrazierucsf avatar remifrazierucsf commented on August 29, 2024

from pycap.

bobromeo avatar bobromeo commented on August 29, 2024

The title of this issue is not yet OK :), the Pull Request is not yet handled.
Looked into files of the branch, 'delete_record' only deletes 1 record, so the README.rst should be changed to singular.
-OR-
Better still: the .py could be changed to allow multiple records to be deleted, because the API allows for records[0], records[1] etc.
I am a noob at GitHub and Python is not my forté, but here's my 3cts solution for deleting records.
This works, but i am not yet using records[1] etc, have to dig in a bit deeper :)
Also: a nice 'delete_records' should iterate over chunks of 1000 or so ...

dataRep = {
    'token': api_key,
    'content': 'report',
    'format': 'csv',
    'report_id': '16',
    'rawOrLabel': 'raw',
    'rawOrLabelHeaders': 'raw',
    'exportCheckboxLabel': 'false',
    'returnFormat': 'csv'
}
dataDel = {
    'token': api_key,
    'action': 'delete',
    'content': 'record',
    'records[0]': 'xxx'
}
rr = requests.post(api_url, data = dataRep, verify=False)
for rrl in rr.iter_lines(chunk_size=128,decode_unicode=True):
    if(rrl != 'record_id'):
        dataDel["records[0]"] = rrl.strip('\"')
        rd = requests.post(api_url, data = dataDel, verify=False)
rr = requests.post(api_url, data = dataRep, verify=False)
print(rr.text)

from pycap.

pwildenhain avatar pwildenhain commented on August 29, 2024

See my comment in the PR for how to easily delete multiple records through the API: #77 (comment)
TL:DR Change records[0] to records[] in the body of the POST request to pass a list of records to be deleted

from pycap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.