IllinoisLegalAidOnline / docassemble-USCISApplications

A docassemble extension.
MIT License
0 stars 0 forks source link

id: explain_add_explanations - do we want to have the question text with a help: or note:? #31

Open nonprofittechy opened 5 months ago

aidanielson commented 5 months ago

For easily getting the question text for any of the have you ever questions...

just fyi, I created a dictionary where the keys are the 'have you ever' question code (e.g. 'q8a') and the values are the full, verbatim question string. I copied it below. So you could populate the full verbatim question by calling the kv pair by the direct question ID (e.g., question_dict['q8a']) or by extracting the question ID as an iterator, like for true_answer in [a filtered list of have_you_evers that are True]: ${ question_dict['true_answer'] } (i.e., ${ question_dict['q8a'] }

code: | question_dict = { "q8a": "Have you EVER been convicted of any felony committed in the United States?", "q8b": "Have you EVER been convicted of any misdemeanor committed in the United States?", "q8c": "Have you EVER been convicted of any particularly serious crime, whether committed inside or outside of the United States?", "q9a": "Have you EVER ordered, incited, assisted, or otherwise participated in the persecution of any person on account of race, religion, nationality, membership in a particular social group, or political opinion?", "q9b": "Have you EVER committed serious nonpolitical crimes outside of the United States prior to your arrival in the United States?", "q9c": "Have you EVER or are you NOW engaged in activities that could be reasonable grounds for concluding that you are a danger to the security of the United States?", "q10a": "Have you EVER been convicted of or have you EVER committed acts which constitute the essential elements of a crime (other than a purely political offense)?", "q10b": "Have you EVER been convicted of or have you EVER committed acts which constitute the essential elements of a violation of any law relating to a controlled substance as defined in section 102 of the Controlled Substances Act?", "q10c": "Have you EVER been convicted of or have you EVER committed acts which constitute the essential elements of a conspiracy to violate any law relating to a controlled substance as defined in section 102 of the Controlled Substances Act?", "q11": "Have you EVER been convicted of two or more criminal offenses (other than purely political offenses) for which you received sentences to confinement that, when combined, total five years or more?", "q12a": "Have you EVER trafficked in or are you NOW trafficking in any controlled substance?", "q12b": "Are you NOW or have you EVER knowingly assisted, abetted, conspired, or colluded with others in the unlawful trafficking of any controlled substance?", "q12c": "Are you the spouse or child of an alien who unlawfully trafficked in any controlled substance?", "q12d": "Are you the spouse or child of an alien who assisted, abetted, conspired, or colluded with others in the unlawful trafficking of any controlled substance?", "q12e": "Within the previous five years, have you EVER obtained any financial or other benefit from the unlawful activity of your spouse (including former spouses) or parents, and you knew, or reasonably should have known, that the financial or other benefit was the product of such illicit activity?", "q13a": "Have you EVER engaged, or do you plan to engage, solely, principally, or incidentally, in any activity to violate any law of the United States relating to espionage or sabotage?", "q13b": "Have you EVER engaged, or do you plan to engage, solely, principally, or incidentally, in any activity to violate or evade any law prohibiting the export from the United States of goods, technology, or sensitive information?", "q13c": "Have you EVER engaged, or do you plan to engage, solely, principally, or incidentally, in any other unlawful activity in the United States?", "q13d": "Have you EVER engaged, or do you plan to engage, solely, principally, or incidentally, in any activity in which a purpose is to oppose, control, or overthrow the Government of the United States by force, violence, or other unlawful means, including but not limited to participating in such activities, giving support to others involved in such activities, or being a member or representative of a terrorist organization?", "q14a": "Have you EVER or are you NOW engaged in terrorist activities?", "q14b": "Have you EVER or are you NOW engaged in or plan to engage in activities in the United States that would have potentially serious adverse foreign policy consequences for the United States?", "q14c": "Have you EVER been or are you NOW a member of the Communist or other totalitarian party, except when membership was involuntary?", "q14d": "Have you EVER participated in Nazi persecution or genocide?", "q15a": "Have you EVER, whether in the United States or any other country, been arrested for breaking or violating any law or ordinance, excluding minor traffic violations?", "q15b": "Have you EVER, whether in the United States or any other country, been cited, charged, or indicted, for breaking or violating any law or ordinance, excluding minor traffic violations?", "q15c": "Have you EVER, whether in the United States or any other country, been convicted, fined, imprisoned, placed on probation, received a suspended sentence or deferral of adjudication for breaking or violating any law or ordinance, excluding minor traffic violations?", "q16": "Have you EVER been the beneficiary of a pardon, amnesty, rehabilitation decree, other act of clemency, or similar action?", "q17": "Have you EVER committed a serious criminal offense in the United States and asserted immunity from prosecution?", "q18a": "Have you EVER, within the past 10 years, or are you NOW engaged in prostitution or procurement of prostitution?", "q18b": "Have you EVER, within the past 10 years (either directly or indirectly) procured or attempted to procure or import prostitutes or persons for the purpose of prostitution?", "q18c": "Have you EVER, within the past 10 years, received, in whole or in part, the proceeds of prostitution?", "q19": "Have you EVER been or do you intend to be involved in any other commercial vice?", "q20a": "Have you EVER been ordered removed, and been deported from the United States?", "q20b": "Have you EVER voluntarily departed the United States under an order of removal?", "q20c": "Have you re-entered the United States unlawfully at any time after you were deported or you voluntarily departed?", "q20d": "Has DHS reinstated your prior order of removal?", "q20e": "Have you EVER failed to attend or remain in attendance at any immigration proceedings to determine your admissibility or deportability?", "q21": "Have you EVER, by fraud or willfully misrepresenting a material fact, sought to obtain a visa or other documentation, admission to the United States, or any other immigration benefit?", "q22": "Have you EVER assisted any other person to enter the United States in violation of the law?", "q23a": "Do you NOW have a communicable disease of public health significance?", "q23b": "Do you NOW have or have you EVER had a physical or mental disorder and behavior (or a history of behavior that is likely to recur) associated with the disorder which has posed or may pose a threat to the property, safety, or welfare of yourself or others?", "q23c": "Are you NOW or have you EVER been a drug abuser or drug addict?", "q24": "Have you EVER entered the United States as a stowaway?", "q25": "Did the former Immigration and Naturalization Service (INS) EVER impose, or has DHS EVER imposed, civil monetary penalties on you for producing or using false documentation to obtain an immigration benefit?", "q26": "Are you NOW subject to a final order for violation of section 274C (producing and/or using false documentation to unlawfully satisfy a requirement of the Immigration and Nationality Act)?", "q27": "Do you NOW practice polygamy?", "q28": "Are you NOW the guardian of, and are you accompanying, another individual who has been found to be inadmissible and who has been certified by a medical examiner to be helpless due to sickness, physical or mental disability, or infancy?", "q29": "Have you EVER detained, retained, or withheld the custody of a child having a lawful claim to U.S. citizenship, outside the United States, from a U.S. citizen granted custody?", "q30a": "Have you EVER ordered, incited, called for, committed, assisted, helped with, or otherwise participated in acts involving torture or genocide?", "q30b": "Have you EVER ordered, incited, called for, committed, assisted, helped with, or otherwise participated in killing any person?", "q30c": "Have you EVER ordered, incited, called for, committed, assisted, helped with, or otherwise participated in intentionally and severely injuring any person?", "q30d": "Have you EVER ordered, incited, called for, committed, assisted, helped with, or otherwise participated in engaging in any kind of sexual contact or relations with any person who was being forced or threatened?", "q30e": "Have you EVER ordered, incited, called for, committed, assisted, helped with, or otherwise participated in limiting or denying any person's ability to exercise religious beliefs?", "q31a": "Have you EVER served in, been a member of, assisted in, or participated in any military unit, paramilitary unit, police unit, self-defense unit, vigilante unit, rebel group, guerrilla group, militia, or insurgent organization?", "q31b": "Have you EVER served or worked in any prison, jail, prison camp, detention facility, labor camp, or any other situation that involved detaining persons?", "q32": "Have you EVER been a member of, assisted in, or participated in any group, unit, or organization of any kind in which you or other persons used any type of weapon against any person or threatened to do so?", "q33": "Have you EVER assisted with or participated in selling or providing weapons to any person who to your knowledge used them against another person, or in transporting weapons to any person who to your knowledge used them against another person?", "q34": "Have you EVER unlawfully voted in a United States Federal, state, or local election?", "q35": "Have you EVER received any type of military, paramilitary, or weapons training?", "q36": "Have you EVER claimed to be a U.S. citizen (in writing or in any other way)?", "q37a": "Have you EVER recruited, enlisted, conscripted, or used any person under 15 years of age to serve in or help an armed force or group?", "q37b": "Have you EVER used any person under 15 years of age to take part in hostilities or to help or provide services to people in combat?", "q38a": "Have you EVER committed or conspired to commit human trafficking offenses, as defined in the section 103 of the Victims of Trafficking and Violence Protection Act of 2000, in the United States or outside the United States?", "q38b": "Have you EVER knowingly aided, abetted, assisted, conspired, or colluded with a human trafficker?", "q38c": "Are you NOW the spouse or child of an alien who committed or conspired to commit human trafficking offenses?", "q38d": "Are you NOW the spouse or child of, or are you yourself, an alien who knowingly aided, abetted, assisted, conspired, or colluded with a human trafficker?", "q38e": "Within the previous five years, have you EVER obtained any financial or other benefit from the human trafficking activity of your spouse (including former spouses) or parents, and you knew, or reasonably should have known, that the financial or other benefit that you received resulted from such human trafficking?", "q39a": "Are you NOW or have you EVER engaged in money laundering as described in section 1956 or 1957 of Title 18, United States Code?", "q39b": "Are you NOW or have you EVER been a knowing aider, abettor, assister, conspirator, or colluder with others in money laundering?", "q40": "Have you EVER been responsible for or directly carried out particularly severe violations of religious freedom, as defined in section 3 of the International Religious Freedom Act of 1998 (22 U.S.C. section 6402) while serving as a foreign government official?", "q41": "Has an immigration judge or the Board of Immigration Appeals EVER determined that you filed a frivolous asylum application in the past?" }

nonprofittechy commented 4 months ago

Tony, I think this is a great to integrate now that pace of development and deployment has slowed. It will make things more maintainable.

nonprofittechy commented 4 months ago

to trigger a question:

getattr(users[i], "q8a")

or:

% for q in question_dict.items():
% if getattr(users[i], q[0]):
${ q[0] }: ${ q[1] }
% endif
% endfor
nonprofittechy commented 4 months ago

Something like this might work in the explain_add_explanations question:

  - code: |
      [
        {
          "field": users[i].attr_name(f"q{q[0]}_explanation"), 
          "label": f"Explain why '{q[1]}'",
          "datatype": "area"
        }
        for q in question_dict.items()
      ]
nonprofittechy commented 4 months ago

Only suggestion:

variable name: question_dict
data:
  q8a: "Did you ever ..."

Or refine even more, with DAContext pattern:

variable name: question_dict
data:
  q8a:
    question: Did you ever ...
    document: The applicant ...
    custom_context: "Why did you ..."

But probably not necessary

nonprofittechy commented 4 months ago

and in the "have you ever" question itself, we could do:

  - ${ question_dict["q8a"] }: users[i].q10c
    datatype: yesnoradio
    default: ${ showifdef("users[0].q10c") if i > 0 else ''}
    grid: 6
    label above field: True
mnewsted commented 3 months ago

Possible future enhancement.