Skip to content

Commit

Permalink
Merge pull request #4 from datakind/feature/backend
Browse files Browse the repository at this point in the history
Feature/backend
  • Loading branch information
antoniomigotto authored Oct 15, 2023
2 parents b701d96 + b072b1e commit 42be012
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 127 deletions.
81 changes: 13 additions & 68 deletions workstream1/cmfportfolio.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CREATE TABLE `Metrics` (
`MetricID` int NOT NULL AUTO_INCREMENT,
`MetricName` varchar(255) NOT NULL,
PRIMARY KEY (`MetricID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand All @@ -35,39 +35,10 @@ CREATE TABLE `Metrics` (

LOCK TABLES `Metrics` WRITE;
/*!40000 ALTER TABLE `Metrics` DISABLE KEYS */;
INSERT INTO `Metrics` VALUES (1,'Units Below 30% AMI'),(2,'Units Below 50% AMI'),(3,'Units Below 60% AMI'),(4,'Units Below 80% AMI'),(5,'Units Below 120% AMI'),(6,'Units Above 120% AMI'),(7,'Total Number of Units'),(8,'Total Private Sources'),(9,'Total Public Sources'),(10,'CMF Loan Amount');
INSERT INTO `Metrics` VALUES (1,'txtUnder30'),(2,'txtUnder50'),(3,'txtUnder60'),(4,'txtUnder80'),(5,'txtUnder120'),(6,'txtAbove120'),(7,'txtUnitCount'),(8,'txtPrivCash'),(9,'txtGovCash'),(10,'txtCMFLoan'),(11,'txtNoCmfClf');
/*!40000 ALTER TABLE `Metrics` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `PortfolioMetrics`
--

DROP TABLE IF EXISTS `PortfolioMetrics`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `PortfolioMetrics` (
`PortfolioMetricID` int NOT NULL AUTO_INCREMENT,
`PortfolioID` int DEFAULT NULL,
`MetricID` int DEFAULT NULL,
`MetricValue` decimal(20,2) NOT NULL,
PRIMARY KEY (`PortfolioMetricID`),
KEY `PortfolioID` (`PortfolioID`),
KEY `MetricID` (`MetricID`),
CONSTRAINT `PortfolioMetrics_ibfk_1` FOREIGN KEY (`PortfolioID`) REFERENCES `Portfolios` (`PortfolioID`),
CONSTRAINT `PortfolioMetrics_ibfk_2` FOREIGN KEY (`MetricID`) REFERENCES `Metrics` (`MetricID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `PortfolioMetrics`
--

LOCK TABLES `PortfolioMetrics` WRITE;
/*!40000 ALTER TABLE `PortfolioMetrics` DISABLE KEYS */;
/*!40000 ALTER TABLE `PortfolioMetrics` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Portfolios`
--
Expand All @@ -80,7 +51,7 @@ CREATE TABLE `Portfolios` (
`PortfolioName` varchar(255) NOT NULL,
`PortfolioYear` int DEFAULT NULL,
PRIMARY KEY (`PortfolioID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand All @@ -89,7 +60,6 @@ CREATE TABLE `Portfolios` (

LOCK TABLES `Portfolios` WRITE;
/*!40000 ALTER TABLE `Portfolios` DISABLE KEYS */;
INSERT INTO `Portfolios` VALUES (1,'CMF',2023);
/*!40000 ALTER TABLE `Portfolios` ENABLE KEYS */;
UNLOCK TABLES;

Expand All @@ -101,11 +71,11 @@ DROP TABLE IF EXISTS `ProjectMetrics`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ProjectMetrics` (
`MetricID` int DEFAULT NULL,
`MetricType` int DEFAULT NULL,
`MetricValue` decimal(20,2) NOT NULL,
`ProjectName` varchar(255) DEFAULT NULL,
KEY `MetricID` (`MetricID`),
CONSTRAINT `ProjectMetrics_ibfk_2` FOREIGN KEY (`MetricID`) REFERENCES `Metrics` (`MetricID`)
KEY `MetricID` (`MetricType`),
CONSTRAINT `ProjectMetrics_ibfk_2` FOREIGN KEY (`MetricType`) REFERENCES `Metrics` (`MetricID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand All @@ -115,7 +85,6 @@ CREATE TABLE `ProjectMetrics` (

LOCK TABLES `ProjectMetrics` WRITE;
/*!40000 ALTER TABLE `ProjectMetrics` DISABLE KEYS */;
INSERT INTO `ProjectMetrics` VALUES (8,20100000.00,'SOS'),(9,7647015.00,'SOS'),(10,1000000.00,'SOS'),(7,72.00,'SOS'),(1,18.00,'SOS'),(2,0.00,'SOS'),(3,18.00,'SOS'),(4,36.00,'SOS'),(5,0.00,'SOS'),(6,0.00,'SOS'),(8,11793632.00,'SSW'),(9,0.00,'SSW'),(10,1000000.00,'SSW'),(7,40.00,'SSW'),(1,0.00,'SSW'),(2,40.00,'SSW'),(3,0.00,'SSW'),(4,0.00,'SSW'),(5,0.00,'SSW'),(6,0.00,'SSW');
/*!40000 ALTER TABLE `ProjectMetrics` ENABLE KEYS */;
UNLOCK TABLES;

Expand All @@ -128,11 +97,12 @@ DROP TABLE IF EXISTS `Projects`;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Projects` (
`PortfolioID` int DEFAULT NULL,
`ProjectName` varchar(255) NOT NULL,
`Address` varchar(255) DEFAULT NULL,
`CensusTract` varchar(50) DEFAULT NULL,
`AreaOfEconomicDistress` varchar(5) DEFAULT NULL,
`TotalProjectCost` decimal(20,2) DEFAULT NULL,
`txtPPN` varchar(255) NOT NULL,
`txtAddr1` varchar(255) NOT NULL,
`txtAddr2` varchar(255) DEFAULT '',
`txtCity` varchar(255) NOT NULL,
`txtState` char(2) NOT NULL,
`txtZIP` int(5) unsigned zerofill NOT NULL,
KEY `PortfolioID` (`PortfolioID`),
CONSTRAINT `Projects_ibfk_1` FOREIGN KEY (`PortfolioID`) REFERENCES `Portfolios` (`PortfolioID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
Expand All @@ -144,33 +114,8 @@ CREATE TABLE `Projects` (

LOCK TABLES `Projects` WRITE;
/*!40000 ALTER TABLE `Projects` DISABLE KEYS */;
INSERT INTO `Projects` VALUES (1,'SOS',NULL,'12011041700','Y',28747015.00),(1,'SSW',NULL,'12009064902','Y',12793632.00);
/*!40000 ALTER TABLE `Projects` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Sources`
--

DROP TABLE IF EXISTS `Sources`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `Sources` (
`SourceID` int NOT NULL AUTO_INCREMENT,
`SourceName` varchar(255) NOT NULL,
`SourceType` varchar(255) DEFAULT NULL,
PRIMARY KEY (`SourceID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Sources`
--

LOCK TABLES `Sources` WRITE;
/*!40000 ALTER TABLE `Sources` DISABLE KEYS */;
/*!40000 ALTER TABLE `Sources` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
Expand All @@ -181,4 +126,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2023-10-14 17:53:50
-- Dump completed on 2023-10-15 14:58:06
13 changes: 13 additions & 0 deletions workstream1/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
blinker==1.6.3
click==8.1.7
Flask==3.0.0
Flask-MySQL==1.5.2
Flask-MySQLdb==2.0.0
itsdangerous==2.1.2
Jinja2==3.1.2
mariadb==1.1.8
MarkupSafe==2.1.3
mysqlclient==2.2.0
packaging==23.2
PyMySQL==1.1.0
Werkzeug==3.0.0
88 changes: 29 additions & 59 deletions workstream1/templates/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">

<style>
div{ background-color: lightgrey; width:100%; padding:5px}
h1{color: #40a944; text-align: center;}
p{ font-family: verdana;font-size: 20px;}
.center {
display: flex;
justify-content: center;
}
.button {
border: 3px solid green;
padding: 10px;
}
</style>

</head>
<body>
<h1>Enter Project Details</h1>
Expand Down Expand Up @@ -54,92 +39,77 @@ <h2>Project Details:</h2>
</div>

<div class="form-group">
<label for="address">Street Address:</label>
<input type="text" id="address" name="address" placeholder="123 Street"><br>
<label for="txtAddr1">Street Address:</label>
<input type="text" id="txtAddr1" name="txtAddr1" placeholder="123 Street"><br>
</div>

<div class="form-group">
<label for="address">City:</label>
<input type="text" id="address" name="address" placeholder="Orlando"><br>
<label for="txtCity">City:</label>
<input type="text" id="txtCity" name="txtCity" placeholder="Orlando"><br>
</div>

<div class="form-group">
<label for="address">State:</label>
<input type="text" id="address" name="address" placeholder="FL"><br>
<label for="txtState">State:</label>
<input type="text" id="txtState" name="txtState" placeholder="FL"><br>
</div>

<div class="form-group">
<label for="address">ZIP Code:</label>
<input type="number" id="address" name="address" placeholder="32751"><br>
</div>

<div class="form-group">
<label for="censusTract">Census Tract:</label>
<input type="number" id="censusTract" name="censusTract" required><br>
</div>

<div class="form-group">
<label for="areaOfEconomicDistress">Area Of Economic Distress:</label>
<input type="checkbox" id="areaOfEconomicDistress" name="areaOfEconomicDistress" value="Y">Yes
</div>

<div class="form-group">
<label for="totalProjectCost">Total Project Cost:</label>
<input type="number" id="totalProjectCost" name="totalProjectCost" required><br>
<label for="txtZIP">ZIP Code:</label>
<input type="number" id="txtZIP" name="txtZIP" placeholder="32751"><br>
</div>
</div>

<div class="section" id="metrics">
<h2>Metrics:</h2>
<div class="form-group">
<label for="unitsBelow30AMI">Units Below 30% AMI:</label>
<input type="number" id="unitsBelow30AMI" name="unitsBelow30AMI" ste1" required><br>
<label for="txtUnder30">Units Below 30% AMI:</label>
<input type="number" id="txtUnder30" name="txtUnder30" step="1" required><br>
</div>

<div class="form-group">
<label for="unitsBelow50AMI">Units Below 50% AMI:</label>
<input type="number" id="unitsBelow50AMI" name="unitsBelow50AMI" step="1" required><br>
<label for="txtUnder50">Units Below 50% AMI:</label>
<input type="number" id="txtUnder50" name="unitsBelow50AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="unitsBelow60AMI">Units Below 60% AMI:</label>
<input type="number" id="unitsBelow60AMI" name="unitsBelow60AMI" step="1" required><br>
<label for="txtUnder60">Units Below 60% AMI:</label>
<input type="number" id="txtUnder60" name="unitsBelow60AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="unitsBelow80AMI">Units Below 80% AMI:</label>
<input type="number" id="unitsBelow80AMI" name="unitsBelow80AMI" step="1" required><br>
<label for="txtUnder80">Units Below 80% AMI:</label>
<input type="number" id="txtUnder80" name="unitsBelow80AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="unitsBelow120AMI">Units Below 120% AMI:</label>
<input type="number" id="unitsBelow120AMI" name="unitsBelow120AMI" step="1" required><br>
<label for="txtUnder120">Units Below 120% AMI:</label>
<input type="number" id="txtUnder120" name="unitsBelow120AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="unitsAbove120AMI">Units Above 120% AMI:</label>
<input type="number" id="unitsAbove120AMI" name="unitsAbove120AMI" step="1" required><br>
<label for="txtAbove120">Units Above 120% AMI:</label>
<input type="number" id="txtAbove120" name="unitsAbove120AMI" step="1" required><br>
</div>

<div class="form-group">
<label for="totalNumberOfUnits">Total Number of Units:</label>
<input type="number" id="totalNumberOfUnits" name="totalNumberOfUnits" step="1" required><br>
<label for="txtGovCash">Total Public Sources:</label>
<input type="number" id="txtGovCash" name="totalPublicSources" step="1" required><br>
</div>

<div class="form-group">
<label for="totalPrivateSources">Total Private Sources:</label>
<input type="number" id="totalPrivateSources" name="totalPrivateSources" step="1" required><br>
<label for="txtNoCmfClf">FCLF Cash:</label>
<input type="number" id="txtNoCmfClf" name="totalPrivateSources" step="1" required><br>
</div>

<div class="form-group">
<label for="totalPublicSources">Total Public Sources:</label>
<input type="number" id="totalPublicSources" name="totalPublicSources" step="1" required><br>
<label for="txtPrivCash">Other Private Sources:</label>
<input type="number" id="txtPrivCash" name="totalPrivateSources" step="1" required><br>
</div>

<div class="form-group">
<label for="cmfLoanAmount">CMF Loan Amount:</label>
<input type="number" id="cmfLoanAmount" name="cmfLoanAmount" step="1" required><br>
<label for="txtCMFLoan">CMF Loan Amount:</label>
<input type="number" id="txtCMFLoan" name="txtCMFLoan" step="1" required><br>
</div>

</div>
<div class="submit-btn center">
<input type="submit" id="submit" class="button" value="Submit">
Expand Down

0 comments on commit 42be012

Please sign in to comment.