Skip to content

Commit

Permalink
feat: create new entities-based xlsforms for registration/buildings
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Apr 22, 2024
1 parent 0b23528 commit 7d64844
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 24 deletions.
25 changes: 3 additions & 22 deletions osm_fieldwork/xlsforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,7 @@

xlsforms_path = os.path.dirname(os.path.abspath(__file__))

amenities = f"{xlsforms_path}/amenities.xls"
entities_registration = f"{xlsforms_path}/entities_registration.xls"
entities_registration_xml = f"{xlsforms_path}/entities_registration.xml"

buildings = f"{xlsforms_path}/buildings.xls"
camping = f"{xlsforms_path}/camping.xls"
cemeteries = f"{xlsforms_path}/cemeteries.xls"
education = f"{xlsforms_path}/education.xls"
health = f"{xlsforms_path}/health.xls"
highways = f"{xlsforms_path}/highways.xls"
historical = f"{xlsforms_path}/historical.xls"
hotspring = f"{xlsforms_path}/hotspring.xls"
landusage = f"{xlsforms_path}/landusage.xls"
landuse = f"{xlsforms_path}/landuse.xls"
municipality = f"{xlsforms_path}/municipality.xls"
nature = f"{xlsforms_path}/nature.xls"
places = f"{xlsforms_path}/places.xls"
religious = f"{xlsforms_path}/religious.xls"
solidwaste = f"{xlsforms_path}/solidwaste.xls"
toilets = f"{xlsforms_path}/toilets.xls"
towns = f"{xlsforms_path}/towns.xls"
transportation = f"{xlsforms_path}/transportation.xls"
waste_collection = f"{xlsforms_path}/waste_collection.xlsx"
wastedisposal = f"{xlsforms_path}/wastedisposal.xls"
waterpoints = f"{xlsforms_path}/waterpoints.xls"
waterways = f"{xlsforms_path}/waterways.xls"
Binary file modified osm_fieldwork/xlsforms/buildings.xls
Binary file not shown.
Binary file added osm_fieldwork/xlsforms/entities_registration.xls
Binary file not shown.
1 change: 1 addition & 0 deletions osm_fieldwork/xlsforms/entities_registration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0"?><h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa" xmlns:orx="http://openrosa.org/xforms" xmlns:odk="http://www.opendatakit.org/xforms" xmlns:entities="http://www.opendatakit.org/xforms/entities"><h:head><h:title>Entity Creation Form</h:title><model odk:xforms-version="1.0.0" entities:entities-version="2022.1.0"><instance><data id="entity_creation_form" version="1"><geometry/><project_id/><task_id/><osm_id/><tags/><version/><changeset/><timestamp/><status/><meta><instanceID/><entity dataset="features" id="" create="1"><label/></entity></meta></data></instance><instance id="features" src="jr://file-csv/features.csv"/><bind nodeset="/data/geometry" type="string" entities:saveto="geometry"/><bind nodeset="/data/project_id" type="string" entities:saveto="project_id"/><bind nodeset="/data/task_id" type="string" entities:saveto="task_id"/><bind nodeset="/data/osm_id" type="string" entities:saveto="osm_id"/><bind nodeset="/data/tags" type="string" entities:saveto="tags"/><bind nodeset="/data/version" type="string" entities:saveto="version"/><bind nodeset="/data/changeset" type="string" entities:saveto="changeset"/><bind nodeset="/data/timestamp" type="string" entities:saveto="timestamp"/><bind nodeset="/data/status" type="string" entities:saveto="status"/><bind nodeset="/data/meta/instanceID" type="string" readonly="true()" jr:preload="uid"/><bind nodeset="/data/meta/entity/@id" type="string" readonly="true()"/><setvalue ref="/data/meta/entity/@id" event="odk-instance-first-load" type="string" readonly="true()" value="uuid()"/><bind nodeset="/data/meta/entity/label" calculate="concat(if( /data/status = '1', &quot;🔒 &quot;, if( /data/status = '2', &quot;✅ &quot;, if( /data/status = '5', &quot;❌ &quot;, if( /data/status = '6', &quot;❌ &quot;, '')))), &quot;Task &quot;, /data/task_id , &quot; &quot;, &quot;Feature &quot;, /data/osm_id )" type="string" readonly="true()"/></model></h:head><h:body><select1 ref="/data/geometry"><label>Feature Location</label><itemset nodeset="instance('features')/root/item"><value ref="name"/><label ref="label"/></itemset></select1><input ref="/data/project_id"><label>Project ID</label></input><input ref="/data/task_id"><label>Task ID</label></input><input ref="/data/osm_id"><label>OSM ID</label></input><input ref="/data/tags"><label>OSM Tags</label></input><input ref="/data/version"><label>Version</label></input><input ref="/data/changeset"><label>Integer</label></input><input ref="/data/timestamp"><label>Timestamp</label></input><input ref="/data/status"><label>Mapping status</label></input></h:body></h:html>
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from osm_fieldwork.OdkCentral import OdkAppUser, OdkForm, OdkProject
from osm_fieldwork.OdkCentralAsync import OdkEntity
from osm_fieldwork.xlsforms.entities import registration_form_xml
from osm_fieldwork.xlsforms import entities_registration_xml

logging.basicConfig(
level="DEBUG",
Expand Down Expand Up @@ -180,7 +180,7 @@ async def odk_entity_cleanup(odk_entity):
entity.user,
entity.passwd,
)
form_name = form.createForm(odk_id, str(registration_form_xml), publish=True)
form_name = form.createForm(odk_id, str(entities_registration_xml), publish=True)
if not form_name:
raise AssertionError("Failed to create form")

Expand Down

0 comments on commit 7d64844

Please sign in to comment.