Skip to content

Commit

Permalink
Merge pull request #589 from CityOfNewYork/johnyu95-close-requests-cli
Browse files Browse the repository at this point in the history
Updated close requests cli with date closed
  • Loading branch information
johnyu95 authored Jan 21, 2025
2 parents 75bc599 + 522d902 commit 9970698
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ def es_update(self):
user.get_id() for user in self.agency_users
],
"title_private": self.privacy["title"],
"agency_ein": self.agency_ein,
"agency_request_summary_private": not self.agency_request_summary_released,
"date_due": self.due_date.strftime(ES_DATETIME_FORMAT),
"date_closed": self.date_closed.strftime(ES_DATETIME_FORMAT)
Expand Down
15 changes: 10 additions & 5 deletions app/response/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,23 +450,27 @@ def add_closing(request_id, reason_ids, content, method, letter_template_id):
request_id=request_id,
reason="Request is already closed or has not been acknowledged")

def add_closing_cli(request_id, reason_text):
def add_closing_cli(request_id, reason_text, date_closed):
"""
Create and store a closing-determination response for the specified request and update the request accordingly.
Meant to be used with the CLI command close_requests
:param request_id: FOIL request ID
:param reason_text: reason text for closing
:param date_closed: date the request is closed
"""
request = Requests.query.filter_by(id=request_id).one()
if request.status != request_status.CLOSED:
previous_status = request.status
previous_date_closed = request.date_closed.isoformat() if request.date_closed else None
update_vals = {'status': request_status.CLOSED}
if not calendar.isbusday(datetime.utcnow()) or datetime.utcnow().date() < request.date_submitted.date():
update_vals['date_closed'] = get_next_business_day()
if date_closed:
update_vals['date_closed'] = date_closed
else:
update_vals['date_closed'] = datetime.utcnow()
if not calendar.isbusday(datetime.utcnow()) or datetime.utcnow().date() < request.date_submitted.date():
update_vals['date_closed'] = get_next_business_day()
else:
update_vals['date_closed'] = datetime.utcnow()
if not request.privacy['agency_request_summary'] and request.agency_request_summary is not None:
update_vals['agency_request_summary_release_date'] = calendar.addbusdays(datetime.utcnow(),
RELEASE_PUBLIC_DAYS)
Expand Down Expand Up @@ -507,7 +511,8 @@ def add_closing_cli(request_id, reason_text):
RELEASE_AND_PUBLIC,
determination_type.CLOSING,
reason_text,
release_date=datetime.utcnow()
date_modified=date_closed if date_closed else datetime.utcnow(),
release_date=date_closed if date_closed else datetime.utcnow()
)
create_object(response)
create_response_event(event_type.REQ_CLOSED, response)
Expand Down
2 changes: 1 addition & 1 deletion data/agencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@
},
"monitor_agency_requests": [],
"specific_request_instructions": {
"text": ""
"text": "<div><h2>Freedom of Information Law (FOIL) Requests</h2><p>Pursuant to 43 RCNY, Section 1-08</p><p>If you are requesting records that have been sealed, please submit a completed <a target='_blank' rel='noopener noreferrer' href='https://www.nyc.gov/assets/doc/downloads/pdf/CPL_160_50_Unsealing.pdf'>Designation of Agency for Access to Sealed Records Pursuant to NYCPL 160.50[1][d].</a></p><h3>Procedures for Requesting or Inspecting Records</h3><ul><li>All FOIL requests must be made in writing and should include sufficient identifying information, such as the nature, content, and date of the record. It must reasonably describe the record in compliance with the New York State Freedom of Information Law. No particular form or format is required.</li><li>If you are requesting records that have been sealed, please submit a completed <a target='_blank' rel='noopener noreferrer' href='https://www.nyc.gov/assets/doc/downloads/pdf/CPL_160_50_Unsealing.pdf'>Designation of Agency for Access to Sealed Records Pursuant to NYCPL 160.50[1][d].</a></li><li>If you are requesting records on behalf of another person, please provide a notarized nonmedical release signed by that person authorizing you to receive the records on their behalf. Please be advised that the Department of Correction cannot accept a HIPAA or other medical records release form.</li><li>The Department of Correction does not maintain or possess person in custody medical records. If you are seeking medical records, please contact:<br><strong><br>CHS Medical Records Unit<br></strong>NYC Health and Hospitals Corporation<br>Correctional Health Services, Medical Records<br>49-09 19th Avenue<br>Astoria, NY 11105<br>Telephone 646-614-0100<br>Fax: 347-774-8153</li><br><li>Records to be disclosed under the New York State Freedom of Information Law can be made available for public inspection and copying upon appointment on weekdays, between the hours of 9:00 a.m. and 4:00 p.m.</li><li>All Freedom of Information Law (FOIL) requests to the New York City Department of Correction should be submitted via NYC OpenRecords (<a target='_blank' rel='noopener noreferrer' href='https://nyc.gov/openrecords'>nyc.gov/openrecords</a>). Select 'Request a Record' and choose 'Department of Correction (DOC)' from the agency drop down menu.<br><br><strong>Mail<br></strong>Peter L. Faherty, Esq.<br>Records Access Officer<br>New York City Department of Correction<br>Legal Division<br>75-20 Astoria Blvd<br>East Elmhurst, New York 11370</li></ul><h3>Procedure for Appeals</h3><p>If you are denied access to a record in response to a FOIL request, you may appeal the denial in writing to Charlotte Owens, Esq., Records Appeals Officer, at the address listed above within thirty (30) days of receiving the FOIL response or via e-mail to <a href='mailto:[email protected]'>[email protected]</a>.</p><p><strong>Copying Fees</strong> <br>The fees for copying records are<br>a. 25 cents per page, or <br>b. actual costs of reproduction</p><p><br></p></div>"
}
},
"acronym": "DOC"
Expand Down
4 changes: 3 additions & 1 deletion openrecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ def extend_requests(agency_ein: str, agency_name: str, user_guid: str, extension
@click.option("--agency_ein", prompt="Agency EIN (e.g. 0056)")
@click.option("--user_guid", prompt="User GUID")
@click.option("--reason_text", prompt="Reason text")
@click.option("--date_closed", prompt="Date closed", default="")
@click.option("--requests_to_close_file", prompt="Requests to close file", default="")
def close_requests(agency_ein: str, user_guid: str, reason_text: str, requests_to_close_file: str):
def close_requests(agency_ein: str, user_guid: str, reason_text: str, date_closed: str, requests_to_close_file: str):
# Create request context
ctx = app.test_request_context()
ctx.push()
Expand All @@ -304,6 +305,7 @@ def close_requests(agency_ein: str, user_guid: str, reason_text: str, requests_t
add_closing_cli(
request.id,
reason_text,
date_closed
)
print(request.id, 'closed')
except Exception as e:
Expand Down

0 comments on commit 9970698

Please sign in to comment.