Skip to content

Commit

Permalink
Merge pull request #3511 from ProjectSidewalk/develop
Browse files Browse the repository at this point in the history
v7.18.4
  • Loading branch information
misaugstad authored Mar 5, 2024
2 parents 828f693 + 06e7c77 commit a98c138
Show file tree
Hide file tree
Showing 61 changed files with 604 additions and 200 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<img src="https://github.com/ProjectSidewalk/SidewalkWebpage/assets/1621749/0e838038-14fe-48cf-a849-1025e688ae68" width="200">

# Sidewalk Webpage
Welcome to Project Sidewalk! Project Sidewalk is an open source project aimed at mapping and assessing every sidewalk in the world using remote crowdsourcing, artificial intelligence, and online satellite & streetscape imagery.

If you use or reference Project Sidewalk in your research, please cite:

> Manaswi Saha, Michael Saugstad, Hanuma Teja Maddali, Aileen Zeng, Ryan Holland, Steven Bower, Aditya Dash, Sage Chen, Anthony Li, Kotaro Hara, and Jon Froehlich. 2019. Project Sidewalk: A Web-based Crowdsourcing Tool for Collecting Sidewalk Accessibility Data At Scale. In Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems (CHI '19). Association for Computing Machinery, New York, NY, USA, Paper 62, 1–14. https://doi.org/10.1145/3290605.3300292
## Want Project Sidewalk in Your City?
Want a Project Sidewalk server set up for your city/municipality? You can read about things we consider when choosing new deployment cities on our [Wiki](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Considerations-when-Preparing-for-and-Deploying-to-New-Cities) including geographic diversity, presence of local advocates, funding, etc. You can also read some past discussions [here](https://github.com/ProjectSidewalk/SidewalkWebpage/issues/1379), [here](https://github.com/ProjectSidewalk/SidewalkWebpage/issues/1626), and [here](https://github.com/ProjectSidewalk/SidewalkWebpage/issues/281).

If you would like to suggest that we deploy in your city/municipality, please email us at [email protected]!
Expand Down Expand Up @@ -73,7 +80,7 @@ On Windows, we recommend [Windows Powershell](https://docs.microsoft.com/en-us/p
1. Email Mikey ([email protected]) and ask for a database dump, a Mapbox API key, and a Google Maps API key & secret (if you are not part of our team, you'll have to [create a Google Maps API key](https://developers.google.com/maps/documentation/javascript/get-api-key) yourself).
1. If your computer has an Apple Silicon (M1 or M2) chip, then you should modify the `platform` line in the `docker-compose.yml`, changing it to `linux/arm64`.
1. Modify the `MAPBOX_API_KEY`, `GOOGLE_MAPS_API_KEY`, and `GOOGLE_MAPS_SECRET` lines in the `docker-compose.yml` using the keys and secret you've acquired.
1. Modify the `SIDEWALK_CITY_ID` line in the `docker-compose.yml` to use the ID of the appropriate city, listed [here](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).
1. Modify the `SIDEWALK_CITY_ID` line in the `docker-compose.yml` to use the ID of the appropriate city, listed [here](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env) (it's the city that matches your database dump, so check the name of the db dump file).
1. Modify the `DATABASE_USER` line in the `docker-compose.yml`, replacing "sidewalk" with the username from the table [linked above](https://github.com/ProjectSidewalk/SidewalkWebpage/wiki/Docker-Troubleshooting#first-heres-a-table-that-youll-reference-when-setting-up-your-dev-env).
1. Rename the database dump file that you got from Mikey to "\<database_user\>-dump" (using the name from the prev step) and put it in the `db/` directory (other files in this dir include `init.sh` and `schema.sql`).
1. From the root SidewalkWebpage dir, run `make dev`. This will take time (20-30 mins or more depending on your Internet connection) as the command downloads the docker images, spins up the containers, and opens a Docker shell into the webpage container in that same terminal. The containers (running Ubuntu Stretch) will have all the necessary packages and tools so no installation is necessary. This command also initializes the database, though we still need to import the data. Successful output of this command will look like:
Expand Down
13 changes: 2 additions & 11 deletions app/controllers/AdminController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.mohiva.play.silhouette.api.{Environment, Silhouette}
import com.mohiva.play.silhouette.impl.authenticators.SessionAuthenticator
import com.vividsolutions.jts.geom.Coordinate
import controllers.headers.ProvidesHeader
import controllers.helper.ControllerUtils.parseIntegerList
import controllers.helper.ControllerUtils.{isAdmin, parseIntegerList}
import formats.json.LabelFormat
import formats.json.TaskFormats._
import formats.json.AdminUpdateSubmissionFormats._
Expand Down Expand Up @@ -43,15 +43,6 @@ import scala.concurrent.Future
class AdminController @Inject() (implicit val env: Environment[User, SessionAuthenticator])
extends Silhouette[User, SessionAuthenticator] with ProvidesHeader {

/**
* Checks if the given user is an Administrator.
*/
def isAdmin(user: Option[User]): Boolean = user match {
case Some(user) =>
if (user.role.getOrElse("") == "Administrator" || user.role.getOrElse("") == "Owner") true else false
case _ => false
}

/**
* Loads the admin page.
*/
Expand Down Expand Up @@ -170,7 +161,7 @@ class AdminController @Inject() (implicit val env: Environment[User, SessionAuth
val point = geojson.Point(geojson.LatLng(attribute.lat.toDouble, attribute.lng.toDouble))
val properties = Json.obj(
"attribute_id" -> attribute.globalAttributeId,
"label_type" -> LabelTypeTable.labelTypeIdToLabelType(attribute.labelTypeId),
"label_type" -> LabelTypeTable.labelTypeIdToLabelType(attribute.labelTypeId).get,
"severity" -> attribute.severity
)
Json.obj("type" -> "Feature", "geometry" -> point, "properties" -> properties)
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/ApplicationController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -191,18 +191,18 @@ class ApplicationController @Inject() (implicit val env: Environment[User, Sessi
}

/**
* Returns a developer page.
* Returns the API page.
*/
def developer = UserAwareAction.async { implicit request =>
def api = UserAwareAction.async { implicit request =>
request.identity match {
case Some(user) =>
val timestamp: Timestamp = new Timestamp(Instant.now.toEpochMilli)
val ipAddress: String = request.remoteAddress

WebpageActivityTable.save(WebpageActivity(0, user.userId.toString, ipAddress, "Visit_Developer", timestamp))
Future.successful(Ok(views.html.developer("Sidewalk - API", Some(user))))
Future.successful(Ok(views.html.api("Sidewalk - API", Some(user))))
case None =>
Future.successful(Redirect("/anonSignUp?url=/developer"))
Future.successful(Redirect("/anonSignUp?url=/api"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/AttributeController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class AttributeController @Inject() (implicit val env: Environment[User, Session
UserAttribute(0,
userSessionId,
thresholds(cluster.labelType),
LabelTypeTable.labelTypeToId(cluster.labelType),
LabelTypeTable.labelTypeToId(cluster.labelType).get,
RegionTable.selectRegionIdOfClosestNeighborhood(cluster.lng, cluster.lat),
cluster.lat,
cluster.lng,
Expand Down Expand Up @@ -203,7 +203,7 @@ class AttributeController @Inject() (implicit val env: Environment[User, Session
GlobalAttribute(0,
globalSessionId,
thresholds(cluster.labelType),
LabelTypeTable.labelTypeToId(cluster.labelType),
LabelTypeTable.labelTypeToId(cluster.labelType).get,
LabelTable.getStreetEdgeIdClosestToLatLng(cluster.lat, cluster.lng).get,
RegionTable.selectRegionIdOfClosestNeighborhood(cluster.lng, cluster.lat),
cluster.lat,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/LabelController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class LabelController @Inject() (implicit val env: Environment[User, SessionAuth
val tags: List[Tag] = TagTable.selectAllTags().filter( tag => !excludedTags.contains(tag.tag))
Future.successful(Ok(JsArray(tags.map { tag => Json.obj(
"tag_id" -> tag.tagId,
"label_type" -> LabelTypeTable.labelTypeIdToLabelType(tag.labelTypeId),
"label_type" -> LabelTypeTable.labelTypeIdToLabelType(tag.labelTypeId).get,
"tag" -> tag.tag
)})))
}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/TaskController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class TaskController @Inject() (implicit val env: Environment[User, SessionAuthe

// Insert labels.
for (label: LabelSubmission <- data.labels) {
val labelTypeId: Int = LabelTypeTable.labelTypeToId(label.labelType)
val labelTypeId: Int = LabelTypeTable.labelTypeToId(label.labelType).get

val existingLabel: Option[Label] = if (userOption.isDefined) {
LabelTable.find(label.temporaryLabelId, userOption.get.userId)
Expand Down
Loading

0 comments on commit a98c138

Please sign in to comment.