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 scanner, rules for HotOSM Projects #37

Open
LivInTheLookingGlass opened this issue Nov 5, 2022 · 0 comments
Open

Add scanner, rules for HotOSM Projects #37

LivInTheLookingGlass opened this issue Nov 5, 2022 · 0 comments
Labels
4 - Low enhancement New feature or request rule

Comments

@LivInTheLookingGlass
Copy link
Owner

Idea

Scan the various OpenStreetMap tasking managers and make markets based on their status. This both encourages crossover between the communities, encourages humanitarian work, and yields an ETA for complete data

Notes

https://tasks.hotosm.org/api-docs

Scanner

Request using something like the following:

results = []
last_checked = "2022-05-20"
_start = datetime.now()
start = f"{_start.year}-{_start.month:2}-{_start.day:2}"
for page in count(start=1):
    url = f"https://instance.tld/api/v2/projects/?page={page}&createdFrom={last_checked}&orderBy=id&orderByType=DESC&mappingTypesExact=false&omitMapResults=false"
    cur_len = len(results)
    response = requests.get(url)
    if response.statusCode == 404:
        break
    results.extend(response.json())
    if len(results) == cur_len:
        break
last_checked = start
# queue the new projects

Rules

All of these can be resolved by a single query to the project statistics API. Unfortunately, I need to iterate through every sector to determine if it's complete

url = https://{instance}/api/v2/projects/{project_id}/?as_file=false&abbreviated=false

Is Completed

Return true if all squares register as either "MAPPED" or "VERIFIED"

Is Verified

Return true if all squares register as "VERIFIED"

Completion Date

Return the completion date of a project as a fractional year, or inf if not complete

Completed Before

This is a composite rule. It is equivalent to LessThan(CompletionDate(id), ResolveToValue(deadline))

Verified Date

Verified Before

Automatic Market Ideas

Completion Date of Project {title}

  • Pseudo numeric
    • min = creation date
    • max = + 1 year
    • log scale
  • Resolve if >= 1 year passed
  • Resolve if completed
  • Resolve to completion date

Validation Date of Project {title}

  • Pseudo numeric
    • min = creation date
    • max = + 1 year
    • log scale
  • Resolve if >= 1 year passed
  • Resolve if validated
  • Resolve to validation date

Will Project {title} be completed in less than 6 months?

  • Binary
  • Resolve if >= 6 months passed
  • Resolve if completed
  • Resolve to completion before (+ 6 months)

Will Project {title} be completed in less than 3 months?

  • Binary
  • Resolve if >= 3 months passed
  • Resolve if completed
  • Resolve to completion before (+ 3 months)

Will Project {title} be completed in less than 6 weeks?

  • Binary
  • Resolve if >= 6 weeks passed
  • Resolve if completed
  • Resolve to completion before (+ 6 weeks)

Will Project {title} be completed in less than 3 weeks?

  • Binary
  • Resolve if >= 3 weeks passed
  • Resolve if completed
  • Resolve to completion before (+ 3 weeks)

Will Project {title} be completed in less than 1 week?

  • Binary
  • Resolve if >= 1 week passed
  • Resolve if completed
  • Resolve to completion before (+ 1 week)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - Low enhancement New feature or request rule
Projects
Status: Unchecked
Development

No branches or pull requests

1 participant